]> git.sesse.net Git - vlc/blobdiff - src/modules/entry.c
Revert "modules: added a hack to work-around the buggy 64bit runtime on OS X Leopard"
[vlc] / src / modules / entry.c
index 6af3fbac767295aa161239664b56ff32cf66c00d..647bf9d8b4932a3a234b952ca1e3e27e1d1ca3a0 100644 (file)
 #include <assert.h>
 #include <stdarg.h>
 
+#ifdef ENABLE_NLS
+# include <libintl.h>
+#endif
+
 #include "modules/modules.h"
 #include "config/configuration.h"
 #include "libvlc.h"
-#ifndef ENABLE_NLS
-# define dgettext(d, m) ((char *)(m))
+
+static const char *mdgettext (const char *domain, const char *msg)
+{
+    assert (msg);
+#ifdef ENABLE_NLS
+    if (*msg) /* Do not translate ""! */
+        return dgettext (domain, msg);
 #endif
+    return msg;
+}
 
 static void vlc_module_destruct (gc_object_t *obj)
 {
@@ -110,8 +121,9 @@ module_t *vlc_submodule_create (module_t *module)
     module->submodule_count++;
 
     /* Muahahaha! Heritage! Polymorphism! Ugliness!! */
-    memcpy (submodule->pp_shortcuts, module->pp_shortcuts,
-            sizeof (submodule->pp_shortcuts));
+    submodule->pp_shortcuts[0] = module->pp_shortcuts[0]; /* object name */
+    for (unsigned i = 1; i < MODULE_SHORTCUT_MAX; i++)
+        submodule->pp_shortcuts[i] = NULL;
 
     submodule->psz_object_name = strdup( module->psz_object_name );
     submodule->psz_shortname = module->psz_shortname;
@@ -232,7 +244,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
             const char *domain = va_arg (ap, const char *);
             if (domain == NULL)
                 domain = PACKAGE;
-            module->psz_shortname = dgettext (domain, va_arg (ap, char *));
+            module->psz_shortname = mdgettext (domain, va_arg (ap, char *));
             break;
         }
 
@@ -241,7 +253,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
             const char *domain = va_arg (ap, const char *);
             if (domain == NULL)
                 domain = PACKAGE;
-            module->psz_longname = dgettext (domain, va_arg (ap, char *));
+            module->psz_longname = mdgettext (domain, va_arg (ap, char *));
             break;
         }
 
@@ -250,7 +262,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
             const char *domain = va_arg (ap, const char *);
             if (domain == NULL)
                 domain = PACKAGE;
-            module->psz_help = dgettext (domain, va_arg (ap, char *));
+            module->psz_help = mdgettext (domain, va_arg (ap, char *));
             break;
         }
 
@@ -361,9 +373,9 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
 
             if (domain == NULL)
                 domain = PACKAGE;
-            item->psz_text = text ? strdup (dgettext (domain, text)) : NULL;
+            item->psz_text = text ? strdup (mdgettext (domain, text)) : NULL;
             item->psz_longtext =
-                longtext ? strdup (dgettext (domain, longtext)) : NULL;
+                longtext ? strdup (mdgettext (domain, longtext)) : NULL;
             break;
         }
 
@@ -414,7 +426,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
                 {
                     for (size_t i = 0; i < len; i++)
                         dtext[i] = text[i] ?
-                                        strdup( dgettext( domain, text[i] ) ) :
+                                        strdup (mdgettext( domain, text[i] )) :
                                         NULL;
                     dtext[len] = NULL;
                 }
@@ -452,7 +464,7 @@ int vlc_plugin_set (module_t *module, module_config_t *item, int propid, ...)
             if (domain == NULL)
                 domain = PACKAGE;
             if (name)
-                tabtext[item->i_action] = strdup (dgettext (domain, name));
+                tabtext[item->i_action] = strdup (mdgettext (domain, name));
             else
                 tabtext[item->i_action] = NULL;
             tabtext[item->i_action + 1] = NULL;