diff options
-rw-r--r-- | libavutil/error.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libavutil/error.h b/libavutil/error.h index f3fd7bbff6..a1f68e570b 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -87,6 +87,17 @@ */ int av_strerror(int errnum, char *errbuf, size_t errbuf_size); +#ifdef __cplusplus + +static inline const char *av_err2str(int errnum) +{ + static char errbuf[AV_ERROR_MAX_STRING_SIZE]; + av_strerror(errnum, errbuf, AV_ERROR_MAX_STRING_SIZE); + return errbuf; +} + +#else + /** * Fill the provided buffer with a string containing an error string * corresponding to the AVERROR code errnum. @@ -110,6 +121,7 @@ static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int e #define av_err2str(errnum) \ av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum) +#endif /* __cplusplus */ /** * @} */ |