]> git.sesse.net Git - vlc/commitdiff
Remove remaining strerror() calls from core - refs #1297
authorRémi Denis-Courmont <rem@videolan.org>
Tue, 18 Sep 2007 15:52:21 +0000 (15:52 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Tue, 18 Sep 2007 15:52:21 +0000 (15:52 +0000)
src/extras/libc.c
src/interface/interaction.c
src/libvlc-common.c
src/misc/image.c
src/modules/configuration.c
src/modules/modules.c
src/playlist/loadsave.c

index 4be2dd27f5e3cf9e957af8548aae58b5bded9537..03321034bf8f5246834762400b27bdd9909325f2 100644 (file)
@@ -947,7 +947,7 @@ int __vlc_execve( vlc_object_t *p_object, int i_argc, char *const *ppsz_argv,
     switch (pid)
     {
         case -1:
-            msg_Err (p_object, "unable to fork (%s)", strerror (errno));
+            msg_Err (p_object, "unable to fork (%m)");
             close (fds[0]);
             close (fds[1]);
             return -1;
index 1a991ce018ea170d205a67e1107d136f03d56f71..1382fdb276d20d3b707fe724b98e63c033c64a90 100644 (file)
@@ -35,7 +35,7 @@
 
 #include <stdlib.h>                                      /* free(), strtol() */
 #include <stdio.h>                                                   /* FILE */
-#include <string.h>                                            /* strerror() */
+#include <string.h>
 
 #include <vlc_interface.h>
 #include <vlc_playlist.h>
index 35a8479ed6a603bbd26855619f933fff28677861..61f2842b2292b21f789a9b0947e391d398c94a76 100644 (file)
@@ -41,7 +41,7 @@
 
 #include <errno.h>                                                 /* ENOMEM */
 #include <stdio.h>                                              /* sprintf() */
-#include <string.h>                                            /* strerror() */
+#include <string.h>
 #include <stdlib.h>                                                /* free() */
 
 #ifndef WIN32
@@ -374,8 +374,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] )
             }
             else
             {
-                msg_Err( p_libvlc, "cannot open pid file for writing: %s (%s)",
-                         psz_pidfile, strerror(errno) );
+                msg_Err( p_libvlc, "cannot open pid file for writing: %s (%m)",
+                         psz_pidfile );
             }
         }
         free( psz_pidfile );
@@ -1035,8 +1035,8 @@ int libvlc_InternalDestroy( libvlc_int_t *p_libvlc, vlc_bool_t b_release )
             msg_Dbg( p_libvlc, "removing pid file %s", psz_pidfile );
             if( unlink( psz_pidfile ) == -1 )
             {
-                msg_Dbg( p_libvlc, "removing pid file %s: failed: %s",
-                        psz_pidfile, strerror(errno) );
+                msg_Dbg( p_libvlc, "removing pid file %s: %m",
+                        psz_pidfile );
             }
         }
         free ( psz_pidfile );
@@ -1210,7 +1210,7 @@ static inline int LoadMessages (void)
     }
 
     /* LibVLC wants all messages in UTF-8.
-     * Unfortunately, we cannot ask UTF-8 for strerror(), strsignal()
+     * Unfortunately, we cannot ask UTF-8 for strerror_r(), strsignal_r()
      * and other functions that are not part of our text domain.
      */
     if (bind_textdomain_codeset (PACKAGE_NAME, "UTF-8") == NULL)
index 0d5470d3a7424ee331252c1eb4e052facd212dc5..463b43ce233b3bbbfea0afbe405a2ada34755985 100644 (file)
@@ -352,7 +352,7 @@ static int ImageWriteUrl( image_handler_t *p_image, picture_t *p_pic,
     file = utf8_fopen( psz_url, "wb" );
     if( !file )
     {
-        msg_Err( p_image->p_parent, "%s: %s", psz_url, strerror( errno ) );
+        msg_Err( p_image->p_parent, "%s: %m", psz_url );
         return VLC_EGENERIC;
     }
 
@@ -370,7 +370,10 @@ static int ImageWriteUrl( image_handler_t *p_image, picture_t *p_pic,
         err = errno;
 
     if( err )
-       msg_Err( p_image->p_parent, "%s: %s", psz_url, strerror( err ) );
+    {
+       errno = err;
+       msg_Err( p_image->p_parent, "%s: %m", psz_url );
+    }
 
     return err ? VLC_EGENERIC : VLC_SUCCESS;
 }
index 4e74b417eedefe50fd2a1657445e927b84c9e05a..064ac41f7d6847254556e46f7b976929038effc6 100644 (file)
@@ -799,8 +799,8 @@ static FILE *config_OpenConfigFile( vlc_object_t *p_obj, const char *mode )
     p_stream = utf8_fopen( psz_filename, mode );
     if( p_stream == NULL && errno != ENOENT )
     {
-        msg_Err( p_obj, "cannot open config file (%s): %s",
-                 psz_filename, strerror(errno) );
+        msg_Err( p_obj, "cannot open config file (%s): %m",
+                 psz_filename );
 
     }
 #if !( defined(WIN32) || defined(__APPLE__) || defined(SYS_BEOS) )
@@ -988,9 +988,8 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
                 {
                     long l = strtoi (psz_option_value);
                     if (errno)
-                        msg_Warn (p_this, "Integer value (%s) for %s: %s",
-                                  psz_option_value, psz_option_name,
-                                  strerror (errno));
+                        msg_Warn (p_this, "Integer value (%s) for %s: %m",
+                                  psz_option_value, psz_option_name);
                     else
                         p_item->saved.i = p_item->value.i = (int)l;
                     break;
@@ -1030,7 +1029,7 @@ int __config_LoadConfigFile( vlc_object_t *p_this, const char *psz_module_name )
 
     if (ferror (file))
     {
-        msg_Err (p_this, "error reading configuration: %s", strerror (errno));
+        msg_Err (p_this, "error reading configuration: %m");
         clearerr (file);
     }
     fclose (file);
@@ -1069,8 +1068,7 @@ int config_CreateDir( vlc_object_t *p_this, const char *psz_dirname )
             }
             free( psz_parent );
         }
-        msg_Err( p_this, "could not create %s (%s)",
-                 psz_dirname, strerror(errno) );
+        msg_Err( p_this, "could not create %s: %m", psz_dirname );
         return -1;
     }
 
index ec3b393b6badab1373d9963581fc7651cc8a5686..66135e2fcefc0bdbbaa2fe1ed5dc2ed2db7c2c14 100644 (file)
@@ -1370,8 +1370,8 @@ static int CallEntry( module_t * p_module )
         msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s' (%s)",
                             psz_name, p_module->psz_filename, dlerror() );
 #elif defined(HAVE_DL_SHL_LOAD)
-        msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s' (%s)",
-                            psz_name, p_module->psz_filename, strerror(errno) );
+        msg_Warn( p_module, "cannot find symbol \"%s\" in file `%s' (%m)",
+                            psz_name, p_module->psz_filename );
 #else
 #   error "Something is wrong in modules.c"
 #endif
@@ -1503,8 +1503,7 @@ static int LoadModule( vlc_object_t *p_this, char *psz_file,
     handle = shl_load( psz_file, BIND_IMMEDIATE | BIND_NONFATAL, NULL );
     if( handle == NULL )
     {
-        msg_Warn( p_this, "cannot load module `%s' (%s)",
-                          psz_file, strerror(errno) );
+        msg_Warn( p_this, "cannot load module `%s' (%m)", psz_file );
         return -1;
     }
 
index 2d48375da53628eb64a10ff7e0fefae0c9cb3a72..55db54d2550abe88e4a5ddbe5c79c4cf9dfd8aa9 100644 (file)
@@ -55,8 +55,8 @@ int playlist_Export( playlist_t * p_playlist, const char *psz_filename ,
     p_export->p_file = utf8_fopen( psz_filename, "wt" );
     if( !p_export->p_file )
     {
-        msg_Err( p_playlist , "could not create playlist file %s"
-                 " (%s)", psz_filename, strerror(errno) );
+        msg_Err( p_playlist , "could not create playlist file %s (%m)",
+                 psz_filename );
         return VLC_EGENERIC;
     }