Mercurial > pidgin
comparison libpurple/plugins/perl/perl-common.c @ 29520:1e4781fb144b
disapproval of revision '18b85ae6ad8091af43d91826cf054e4569ba74aa'
The change broke things. See #11431 for details.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 04 Mar 2010 09:20:10 +0000 |
parents | 6288bbd53f44 |
children |
comparison
equal
deleted
inserted
replaced
29018:6288bbd53f44 | 29520:1e4781fb144b |
---|---|
470 | 470 |
471 return sv_2mortal(purple_perl_bless_object(arg, stash)); | 471 return sv_2mortal(purple_perl_bless_object(arg, stash)); |
472 } | 472 } |
473 | 473 |
474 SV * | 474 SV * |
475 purple_perl_sv_from_vargs(const PurpleValue *value, va_list args, void ***copy_arg) | 475 purple_perl_sv_from_vargs(const PurpleValue *value, va_list *args, void ***copy_arg) |
476 { | 476 { |
477 if (purple_value_is_outgoing(value)) { | 477 if (purple_value_is_outgoing(value)) { |
478 switch (purple_value_get_type(value)) { | 478 switch (purple_value_get_type(value)) { |
479 case PURPLE_TYPE_SUBTYPE: | 479 case PURPLE_TYPE_SUBTYPE: |
480 if ((*copy_arg = va_arg(args, void **)) == NULL) | 480 if ((*copy_arg = va_arg(*args, void **)) == NULL) |
481 return &PL_sv_undef; | 481 return &PL_sv_undef; |
482 | 482 |
483 return purple_perl_sv_from_subtype(value, *(void **)*copy_arg); | 483 return purple_perl_sv_from_subtype(value, *(void **)*copy_arg); |
484 | 484 |
485 case PURPLE_TYPE_BOOLEAN: | 485 case PURPLE_TYPE_BOOLEAN: |
486 if ((*copy_arg = (void *)va_arg(args, gboolean *)) == NULL) | 486 if ((*copy_arg = (void *)va_arg(*args, gboolean *)) == NULL) |
487 return &PL_sv_undef; | 487 return &PL_sv_undef; |
488 | 488 |
489 return newSViv(*(gboolean *)*copy_arg); | 489 return newSViv(*(gboolean *)*copy_arg); |
490 | 490 |
491 case PURPLE_TYPE_INT: | 491 case PURPLE_TYPE_INT: |
492 if ((*copy_arg = (void *)va_arg(args, int *)) == NULL) | 492 if ((*copy_arg = (void *)va_arg(*args, int *)) == NULL) |
493 return &PL_sv_undef; | 493 return &PL_sv_undef; |
494 | 494 |
495 return newSViv(*(int *)*copy_arg); | 495 return newSViv(*(int *)*copy_arg); |
496 | 496 |
497 case PURPLE_TYPE_UINT: | 497 case PURPLE_TYPE_UINT: |
498 if ((*copy_arg = (void *)va_arg(args, unsigned int *)) == NULL) | 498 if ((*copy_arg = (void *)va_arg(*args, unsigned int *)) == NULL) |
499 return &PL_sv_undef; | 499 return &PL_sv_undef; |
500 | 500 |
501 return newSVuv(*(unsigned int *)*copy_arg); | 501 return newSVuv(*(unsigned int *)*copy_arg); |
502 | 502 |
503 case PURPLE_TYPE_LONG: | 503 case PURPLE_TYPE_LONG: |
504 if ((*copy_arg = (void *)va_arg(args, long *)) == NULL) | 504 if ((*copy_arg = (void *)va_arg(*args, long *)) == NULL) |
505 return &PL_sv_undef; | 505 return &PL_sv_undef; |
506 | 506 |
507 return newSViv(*(long *)*copy_arg); | 507 return newSViv(*(long *)*copy_arg); |
508 | 508 |
509 case PURPLE_TYPE_ULONG: | 509 case PURPLE_TYPE_ULONG: |
510 if ((*copy_arg = (void *)va_arg(args, | 510 if ((*copy_arg = (void *)va_arg(*args, |
511 unsigned long *)) == NULL) | 511 unsigned long *)) == NULL) |
512 return &PL_sv_undef; | 512 return &PL_sv_undef; |
513 | 513 |
514 return newSVuv(*(unsigned long *)*copy_arg); | 514 return newSVuv(*(unsigned long *)*copy_arg); |
515 | 515 |
516 case PURPLE_TYPE_INT64: | 516 case PURPLE_TYPE_INT64: |
517 if ((*copy_arg = (void *)va_arg(args, gint64 *)) == NULL) | 517 if ((*copy_arg = (void *)va_arg(*args, gint64 *)) == NULL) |
518 return &PL_sv_undef; | 518 return &PL_sv_undef; |
519 | 519 |
520 return newSViv(*(gint64 *)*copy_arg); | 520 return newSViv(*(gint64 *)*copy_arg); |
521 | 521 |
522 case PURPLE_TYPE_UINT64: | 522 case PURPLE_TYPE_UINT64: |
523 if ((*copy_arg = (void *)va_arg(args, guint64 *)) == NULL) | 523 if ((*copy_arg = (void *)va_arg(*args, guint64 *)) == NULL) |
524 return &PL_sv_undef; | 524 return &PL_sv_undef; |
525 | 525 |
526 return newSVuv(*(guint64 *)*copy_arg); | 526 return newSVuv(*(guint64 *)*copy_arg); |
527 | 527 |
528 case PURPLE_TYPE_STRING: | 528 case PURPLE_TYPE_STRING: |
529 if ((*copy_arg = (void *)va_arg(args, char **)) == NULL) | 529 if ((*copy_arg = (void *)va_arg(*args, char **)) == NULL) |
530 return &PL_sv_undef; | 530 return &PL_sv_undef; |
531 | 531 |
532 return newSVGChar(*(char **)*copy_arg); | 532 return newSVGChar(*(char **)*copy_arg); |
533 | 533 |
534 case PURPLE_TYPE_POINTER: | 534 case PURPLE_TYPE_POINTER: |
535 if ((*copy_arg = va_arg(args, void **)) == NULL) | 535 if ((*copy_arg = va_arg(*args, void **)) == NULL) |
536 return &PL_sv_undef; | 536 return &PL_sv_undef; |
537 | 537 |
538 return newSViv((IV)*(void **)*copy_arg); | 538 return newSViv((IV)*(void **)*copy_arg); |
539 | 539 |
540 case PURPLE_TYPE_BOXED: | 540 case PURPLE_TYPE_BOXED: |
541 /* Uh.. I dunno. Try this? */ | 541 /* Uh.. I dunno. Try this? */ |
542 if ((*copy_arg = va_arg(args, void **)) == NULL) | 542 if ((*copy_arg = va_arg(*args, void **)) == NULL) |
543 return &PL_sv_undef; | 543 return &PL_sv_undef; |
544 | 544 |
545 return sv_2mortal(purple_perl_bless_object( | 545 return sv_2mortal(purple_perl_bless_object( |
546 *(void **)*copy_arg, | 546 *(void **)*copy_arg, |
547 purple_value_get_specific_type(value))); | 547 purple_value_get_specific_type(value))); |
551 return NULL; | 551 return NULL; |
552 } | 552 } |
553 } else { | 553 } else { |
554 switch (purple_value_get_type(value)) { | 554 switch (purple_value_get_type(value)) { |
555 case PURPLE_TYPE_SUBTYPE: | 555 case PURPLE_TYPE_SUBTYPE: |
556 if ((*copy_arg = va_arg(args, void *)) == NULL) | 556 if ((*copy_arg = va_arg(*args, void *)) == NULL) |
557 return &PL_sv_undef; | 557 return &PL_sv_undef; |
558 | 558 |
559 return purple_perl_sv_from_subtype(value, *copy_arg); | 559 return purple_perl_sv_from_subtype(value, *copy_arg); |
560 | 560 |
561 case PURPLE_TYPE_BOOLEAN: | 561 case PURPLE_TYPE_BOOLEAN: |
562 *copy_arg = GINT_TO_POINTER( va_arg(args, gboolean) ); | 562 *copy_arg = GINT_TO_POINTER( va_arg(*args, gboolean) ); |
563 | 563 |
564 return newSViv((gboolean)GPOINTER_TO_INT(*copy_arg)); | 564 return newSViv((gboolean)GPOINTER_TO_INT(*copy_arg)); |
565 | 565 |
566 case PURPLE_TYPE_INT: | 566 case PURPLE_TYPE_INT: |
567 *copy_arg = GINT_TO_POINTER( va_arg(args, int) ); | 567 *copy_arg = GINT_TO_POINTER( va_arg(*args, int) ); |
568 | 568 |
569 return newSViv(GPOINTER_TO_INT(*copy_arg)); | 569 return newSViv(GPOINTER_TO_INT(*copy_arg)); |
570 | 570 |
571 case PURPLE_TYPE_UINT: | 571 case PURPLE_TYPE_UINT: |
572 *copy_arg = GUINT_TO_POINTER(va_arg(args, unsigned int)); | 572 *copy_arg = GUINT_TO_POINTER(va_arg(*args, unsigned int)); |
573 | 573 |
574 return newSVuv(GPOINTER_TO_UINT(*copy_arg)); | 574 return newSVuv(GPOINTER_TO_UINT(*copy_arg)); |
575 | 575 |
576 case PURPLE_TYPE_LONG: | 576 case PURPLE_TYPE_LONG: |
577 *copy_arg = (void *)va_arg(args, long); | 577 *copy_arg = (void *)va_arg(*args, long); |
578 | 578 |
579 return newSViv((long)*copy_arg); | 579 return newSViv((long)*copy_arg); |
580 | 580 |
581 case PURPLE_TYPE_ULONG: | 581 case PURPLE_TYPE_ULONG: |
582 *copy_arg = (void *)va_arg(args, unsigned long); | 582 *copy_arg = (void *)va_arg(*args, unsigned long); |
583 | 583 |
584 return newSVuv((unsigned long)*copy_arg); | 584 return newSVuv((unsigned long)*copy_arg); |
585 | 585 |
586 case PURPLE_TYPE_INT64: | 586 case PURPLE_TYPE_INT64: |
587 #if 0 | 587 #if 0 |
588 /* XXX This yells and complains. */ | 588 /* XXX This yells and complains. */ |
589 *copy_arg = va_arg(args, gint64); | 589 *copy_arg = va_arg(*args, gint64); |
590 | 590 |
591 return newSViv(*copy_arg); | 591 return newSViv(*copy_arg); |
592 #endif | 592 #endif |
593 break; | 593 break; |
594 | 594 |
595 case PURPLE_TYPE_UINT64: | 595 case PURPLE_TYPE_UINT64: |
596 /* XXX This also yells and complains. */ | 596 /* XXX This also yells and complains. */ |
597 #if 0 | 597 #if 0 |
598 *copy_arg = (void *)va_arg(args, guint64); | 598 *copy_arg = (void *)va_arg(*args, guint64); |
599 | 599 |
600 return newSVuv(*copy_arg); | 600 return newSVuv(*copy_arg); |
601 #endif | 601 #endif |
602 break; | 602 break; |
603 | 603 |
604 case PURPLE_TYPE_STRING: | 604 case PURPLE_TYPE_STRING: |
605 if ((*copy_arg = (void *)va_arg(args, char *)) == NULL) | 605 if ((*copy_arg = (void *)va_arg(*args, char *)) == NULL) |
606 return &PL_sv_undef; | 606 return &PL_sv_undef; |
607 | 607 |
608 return newSVGChar((char *)*copy_arg); | 608 return newSVGChar((char *)*copy_arg); |
609 | 609 |
610 case PURPLE_TYPE_POINTER: | 610 case PURPLE_TYPE_POINTER: |
611 if ((*copy_arg = (void *)va_arg(args, void *)) == NULL) | 611 if ((*copy_arg = (void *)va_arg(*args, void *)) == NULL) |
612 return &PL_sv_undef; | 612 return &PL_sv_undef; |
613 | 613 |
614 return newSViv((IV)*copy_arg); | 614 return newSViv((IV)*copy_arg); |
615 | 615 |
616 case PURPLE_TYPE_BOXED: | 616 case PURPLE_TYPE_BOXED: |
617 /* Uh.. I dunno. Try this? */ | 617 /* Uh.. I dunno. Try this? */ |
618 if ((*copy_arg = (void *)va_arg(args, void *)) == NULL) | 618 if ((*copy_arg = (void *)va_arg(*args, void *)) == NULL) |
619 return &PL_sv_undef; | 619 return &PL_sv_undef; |
620 | 620 |
621 return sv_2mortal(purple_perl_bless_object(*copy_arg, | 621 return sv_2mortal(purple_perl_bless_object(*copy_arg, |
622 purple_value_get_specific_type(value))); | 622 purple_value_get_specific_type(value))); |
623 | 623 |