comparison src/audacious/pluginenum.c @ 4768:d470630b8cea

The famed "multiple plugins in one module" feature didn't actually work, because structure indices were being indexed by same variable (which was never reset for different plugin structs.) Fixed.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 13 Aug 2008 21:33:54 +0300
parents f084f639e962
children c2dc7a3a7240
comparison
equal deleted inserted replaced
4767:ba9eb9cc287f 4768:d470630b8cea
652 } 652 }
653 653
654 void 654 void
655 plugin2_process(PluginHeader *header, GModule *module, const gchar *filename) 655 plugin2_process(PluginHeader *header, GModule *module, const gchar *filename)
656 { 656 {
657 int i; 657 gint i, n;
658 mowgli_node_t *hlist_node; 658 mowgli_node_t *hlist_node;
659 659
660 if (header->magic != PLUGIN_MAGIC) 660 if (header->magic != PLUGIN_MAGIC)
661 return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename); 661 return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename);
662 662
672 672
673 header->priv_assoc = g_new0(Plugin, 1); 673 header->priv_assoc = g_new0(Plugin, 1);
674 header->priv_assoc->handle = module; 674 header->priv_assoc->handle = module;
675 header->priv_assoc->filename = g_strdup(filename); 675 header->priv_assoc->filename = g_strdup(filename);
676 676
677 i = 0; 677 n = 0;
678 678
679 if (header->ip_list) 679 if (header->ip_list)
680 { 680 {
681 for (; (header->ip_list)[i] != NULL; i++) 681 for (i = 0; (header->ip_list)[i] != NULL; i++, n++)
682 { 682 {
683 PLUGIN((header->ip_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, i); 683 PLUGIN((header->ip_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, n);
684 input_plugin_init(PLUGIN((header->ip_list)[i])); 684 input_plugin_init(PLUGIN((header->ip_list)[i]));
685 } 685 }
686 } 686 }
687 687
688 if (header->op_list) 688 if (header->op_list)
689 { 689 {
690 for (; (header->op_list)[i] != NULL; i++) 690 for (i = 0; (header->op_list)[i] != NULL; i++, n++)
691 { 691 {
692 PLUGIN((header->op_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, i); 692 PLUGIN((header->op_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, n);
693 output_plugin_init(PLUGIN((header->op_list)[i])); 693 output_plugin_init(PLUGIN((header->op_list)[i]));
694 } 694 }
695 } 695 }
696 696
697 if (header->ep_list) 697 if (header->ep_list)
698 { 698 {
699 for (; (header->ep_list)[i] != NULL; i++) 699 for (i = 0; (header->ep_list)[i] != NULL; i++, n++)
700 { 700 {
701 PLUGIN((header->ep_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, i); 701 PLUGIN((header->ep_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, n);
702 effect_plugin_init(PLUGIN((header->ep_list)[i])); 702 effect_plugin_init(PLUGIN((header->ep_list)[i]));
703 } 703 }
704 } 704 }
705
705 706
706 if (header->gp_list) 707 if (header->gp_list)
707 { 708 {
708 for (; (header->gp_list)[i] != NULL; i++) 709 for (i = 0; (header->gp_list)[i] != NULL; i++, n++)
709 { 710 {
710 PLUGIN((header->gp_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, i); 711 PLUGIN((header->gp_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, n);
711 general_plugin_init(PLUGIN((header->gp_list)[i])); 712 general_plugin_init(PLUGIN((header->gp_list)[i]));
712 } 713 }
713 } 714 }
714 715
715 if (header->vp_list) 716 if (header->vp_list)
716 { 717 {
717 for (; (header->vp_list)[i] != NULL; i++) 718 for (i = 0; (header->vp_list)[i] != NULL; i++, n++)
718 { 719 {
719 PLUGIN((header->vp_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, i); 720 PLUGIN((header->vp_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, n);
720 vis_plugin_init(PLUGIN((header->vp_list)[i])); 721 vis_plugin_init(PLUGIN((header->vp_list)[i]));
721 } 722 }
722 } 723 }
723 724
724 if (header->dp_list) 725 if (header->dp_list)
725 { 726 {
726 for (; (header->dp_list)[i] != NULL; i++) 727 for (i = 0; (header->dp_list)[i] != NULL; i++, n++)
727 { 728 {
728 PLUGIN((header->dp_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, i); 729 PLUGIN((header->dp_list)[i])->filename = g_strdup_printf("%s (#%d)", filename, n);
729 discovery_plugin_init(PLUGIN((header->dp_list)[i])); 730 discovery_plugin_init(PLUGIN((header->dp_list)[i]));
730 } 731 }
731 } 732 }
732 733
733 if (header->interface) 734 if (header->interface)