]> git.sesse.net Git - vlc/commitdiff
Probably fix LoadMessages() on windows. (Untested ... I'm not even sure that the...
authorAntoine Cellerier <dionoea@videolan.org>
Tue, 22 Dec 2009 10:08:59 +0000 (11:08 +0100)
committerAntoine Cellerier <dionoea@videolan.org>
Tue, 22 Dec 2009 10:08:59 +0000 (11:08 +0100)
src/libvlc.c

index aa512d2b238558d5bd74fc9672aec2d355e9685c..72f455a8a78334abe241b2146c17f7184daf5f7a 100644 (file)
@@ -210,7 +210,7 @@ void vlc_release (gc_object_t *p_gc)
     ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
 static void SetLanguage   ( char const * );
 #endif
-static inline int LoadMessages (void);
+static inline int LoadMessages ( libvlc_int_t * );
 static int  GetFilenames  ( libvlc_int_t *, int, const char *[] );
 static void Help          ( libvlc_int_t *, char const *psz_help_name );
 static void Usage         ( libvlc_int_t *, char const *psz_search );
@@ -315,7 +315,7 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
     /*
      * Support for gettext
      */
-    LoadMessages ();
+    LoadMessages( p_libvlc );
 
     /* Initialize the module bank and load the configuration of the
      * main module. We need to do this at this stage to be able to display
@@ -1235,7 +1235,7 @@ static void SetLanguage ( const char *psz_lang )
 #endif
 
 
-static inline int LoadMessages (void)
+static inline int LoadMessages (libvlc_int_t *p_libvlc)
 {
 #if defined( ENABLE_NLS ) \
      && ( defined( HAVE_GETTEXT ) || defined( HAVE_INCLUDED_GETTEXT ) )
@@ -1243,11 +1243,16 @@ static inline int LoadMessages (void)
 #if !defined( __APPLE__ ) && !defined( WIN32 ) && !defined( SYS_BEOS )
     static const char psz_path[] = LOCALEDIR;
 #else
+    char *psz_datapath = config_GetDataDir (p_libvlc);
     char psz_path[1024];
     if (snprintf (psz_path, sizeof (psz_path), "%s" DIR_SEP "%s",
-                  config_GetDataDir(), "locale")
+                  psz_datapath, "locale")
                      >= (int)sizeof (psz_path))
+    {
+        free (psz_datapath);
         return -1;
+    }
+    free (psz_datapath);
 
 #endif
     if (bindtextdomain (PACKAGE_NAME, psz_path) == NULL)