]> git.sesse.net Git - vlc/blobdiff - src/modules/entry.c
psz_object_name should not be const! (else module name aliasing cannot work)
[vlc] / src / modules / entry.c
index 7cb0ebf11626cce9a92350e2a39f315f34367833..63e668fd9b7533a2fa586e61deee7dc7c7ddab1a 100644 (file)
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <assert.h>
 #include <stdarg.h>
 
 #include "modules/modules.h"
-#include "config/config.h"
+#include "config/configuration.h"
 #include "libvlc.h"
 
 static const char default_name[] = "unnamed";
@@ -36,9 +40,10 @@ module_t *vlc_module_create (vlc_object_t *obj)
     if (module == NULL)
         return NULL;
 
-    module->b_reentrant = module->b_unloadable = VLC_TRUE;
-    module->psz_object_name = module->psz_longname = default_name;
-    module->psz_capability = "";
+    module->b_reentrant = module->b_unloadable = true;
+    module->psz_object_name = strdup( default_name );
+    module->psz_longname = default_name;
+    module->psz_capability = (char*)"";
     module->i_score = 1;
     module->i_config_items = module->i_bool_items = 0;
 
@@ -58,13 +63,13 @@ module_t *vlc_submodule_create (module_t *module)
         return NULL;
 
     vlc_object_attach (submodule, module);
-    submodule->b_submodule = VLC_TRUE;
+    submodule->b_submodule = true;
 
     /* Muahahaha! Heritage! Polymorphism! Ugliness!! */
     memcpy (submodule->pp_shortcuts, module->pp_shortcuts,
             sizeof (submodule->pp_shortcuts));
 
-    submodule->psz_object_name = module->psz_object_name;
+    submodule->psz_object_name = strdup( module->psz_object_name );
     submodule->psz_shortname = module->psz_shortname;
     submodule->psz_longname = module->psz_longname;
     submodule->psz_capability = module->psz_capability;
@@ -127,7 +132,9 @@ int vlc_module_set (module_t *module, int propid, void *value)
             break;
 
         case VLC_MODULE_NAME:
-            module->pp_shortcuts[0] = module->psz_object_name = (char *)value;
+            free( module->psz_object_name );
+            module->psz_object_name = strdup( (char *)value );
+            module->pp_shortcuts[0] = (char *)value;
             if (module->psz_longname == default_name)
                 module->psz_longname = (char *)value;
             break;
@@ -200,8 +207,8 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             const char *text = va_arg (ap, const char *);
             const char *longtext = va_arg (ap, const char *);
 
-            item->psz_text = text ? strdup (gettext (text)) : NULL;
-            item->psz_longtext = longtext ? strdup (gettext (text)) : NULL;
+            item->psz_text = text ? strdup ( _(text)) : NULL;
+            item->psz_longtext = longtext ? strdup ( _(longtext)) : NULL;
             ret = 0;
             break;
         }
@@ -252,32 +259,32 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
         }
 
         case VLC_CONFIG_ADVANCED:
-            item->b_advanced = VLC_TRUE;
+            item->b_advanced = true;
             ret = 0;
             break;
 
         case VLC_CONFIG_VOLATILE:
-            item->b_unsaveable = VLC_TRUE;
+            item->b_unsaveable = true;
             ret = 0;
             break;
 
         case VLC_CONFIG_PERSISTENT:
-            item->b_autosave = VLC_TRUE;
+            item->b_autosave = true;
             ret = 0;
             break;
 
         case VLC_CONFIG_RESTART:
-            item->b_restart = VLC_TRUE;
+            item->b_restart = true;
             ret = 0;
             break;
 
         case VLC_CONFIG_PRIVATE:
-            item->b_internal = VLC_TRUE;
+            item->b_internal = true;
             ret = 0;
             break;
 
         case VLC_CONFIG_REMOVED:
-            item->b_removed = VLC_TRUE;
+            item->b_removed = true;
             ret = 0;
             break;
 
@@ -352,7 +359,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             if (text != NULL)
             {
                 for (size_t i = 0; i < len; i++)
-                    dtext[i] = text[i] ? strdup (gettext (text[i])) : NULL;
+                    dtext[i] = text[i] ? strdup ( _(text[i])) : NULL;
 
                 dtext[len] = NULL;
                 item->ppsz_list_text = dtext;
@@ -364,6 +371,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             }
 
             item->i_list = len;
+            item->pf_update_list = va_arg (ap, vlc_callback_t);
             ret = 0;
             break;
         }
@@ -389,7 +397,7 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             item->ppsz_action_text = tabtext;
 
             if (name)
-                tabtext[item->i_action] = strdup (gettext (name));
+                tabtext[item->i_action] = strdup ( _(name));
             else
                 tabtext[item->i_action] = NULL;
             tabtext[item->i_action + 1] = NULL;
@@ -406,6 +414,11 @@ int vlc_config_set (module_config_t *restrict item, int id, ...)
             ret = 0;
             break;
         }
+
+        case VLC_CONFIG_SAFE:
+            item->b_safe = true;
+            ret = 0;
+            break;
     }
 
     va_end (ap);