@@ -20,6 +20,7 @@
#define _XOPEN_SOURCE 600 /* XSI-compliant version of strerror_r */
#include <stdio.h>
#include <string.h>
+#include "avutil.h"
#include "config.h"
#include "avstring.h"
#include "error.h"
@@ -119,6 +120,8 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
}
if (entry) {
av_strlcpy(errbuf, entry->str, errbuf_size);
+ } else if (errnum >= 0) {
+ snprintf(errbuf, errbuf_size, "Impossible: non-negative error number %d occurred, please report this bug", errnum);
} else {
#if HAVE_STRERROR_R
ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size));
@@ -126,7 +129,7 @@ int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
ret = -1;
#endif
if (ret < 0)
- snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
+ snprintf(errbuf, errbuf_size, "Error number -0x%X (%s) occurred, please report this bug", -errnum, av_fourcc2str(-errnum));
}
return ret;