[FFmpeg-cvslog] r23015 - in trunk/libavutil: error.c error.h
stefano
subversion
Mon May 3 23:56:21 CEST 2010
Author: stefano
Date: Mon May 3 23:56:21 2010
New Revision: 23015
Log:
Make av_strerror() print an error message mentioning the error code
number if strerror_r() did not succeed for whatever reason.
This avoids the need for the application to fill the string in case
strerror_r() fails, for example because the error code is not known.
Modified:
trunk/libavutil/error.c
trunk/libavutil/error.h
Modified: trunk/libavutil/error.c
==============================================================================
--- trunk/libavutil/error.c Mon May 3 21:21:35 2010 (r23014)
+++ trunk/libavutil/error.c Mon May 3 23:56:21 2010 (r23015)
@@ -36,9 +36,9 @@ int av_strerror(int errnum, char *errbuf
} else {
#if HAVE_STRERROR_R
ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
-#else
- snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
#endif
+ if (!HAVE_STRERROR_R || ret < 0)
+ snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
}
return ret;
Modified: trunk/libavutil/error.h
==============================================================================
--- trunk/libavutil/error.h Mon May 3 21:21:35 2010 (r23014)
+++ trunk/libavutil/error.h Mon May 3 23:56:21 2010 (r23015)
@@ -60,7 +60,8 @@
/**
* Puts a description of the AVERROR code errnum in errbuf.
* In case of failure the global variable errno is set to indicate the
- * error.
+ * error. Even in case of failure av_strerror() will print a generic
+ * error message indicating the errnum provided to errbuf.
*
* @param errbuf_size the size in bytes of errbuf
* @return 0 on success, a negative value otherwise
More information about the ffmpeg-cvslog
mailing list