diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-09 02:53:42 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-09 02:53:42 +0200 |
commit | f8b536a786bf8ba2c65f102fa5cdc3963672d790 (patch) | |
tree | 2e4e95305b16e9aebe418eae1c0a6e9c2da90e68 | |
parent | 9501b932418335f87efef092737a2ac7266bbec8 (diff) | |
download | ffmpeg-f8b536a786bf8ba2c65f102fa5cdc3963672d790.tar.gz |
parseutils: use strings instead of integers for error codes.
error values can differ between platforms.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavutil/parseutils.c | 6 | ||||
-rw-r--r-- | tests/ref/fate/parseutils | 50 |
2 files changed, 29 insertions, 27 deletions
diff --git a/libavutil/parseutils.c b/libavutil/parseutils.c index 3ab99355ef..7a13d0ba58 100644 --- a/libavutil/parseutils.c +++ b/libavutil/parseutils.c @@ -723,10 +723,12 @@ int main(void) for (i = 0; i < FF_ARRAY_ELEMS(rates); i++) { int ret; + char err[1024]; AVRational q = (AVRational){0, 0}; ret = av_parse_video_rate(&q, rates[i]); - printf("'%s' -> %d/%d ret:%d\n", - rates[i], q.num, q.den, ret); + av_strerror(ret, err, sizeof(err)); + printf("'%s' -> %d/%d ret:%s\n", + rates[i], q.num, q.den, err); } } diff --git a/tests/ref/fate/parseutils b/tests/ref/fate/parseutils index e6e4fb97e9..992429f620 100644 --- a/tests/ref/fate/parseutils +++ b/tests/ref/fate/parseutils @@ -1,29 +1,29 @@ Testing av_parse_video_rate() -'-inf' -> -1/0 ret:-22 -'inf' -> 1/0 ret:-22 -'nan' -> 0/0 ret:-22 -'123/0' -> 1/0 ret:-22 -'-123 / 0' -> -1/0 ret:-22 -'' -> 0/0 ret:-22 -'/' -> 0/0 ret:-22 -' 123 / 321' -> 41/107 ret:0 -'foo/foo' -> 0/0 ret:-22 -'foo/1' -> 0/0 ret:-22 -'1/foo' -> 1/0 ret:-22 -'0/0' -> 0/0 ret:-22 -'/0' -> 0/0 ret:-22 -'1/' -> 1/0 ret:-22 -'1' -> 1/1 ret:0 -'0' -> 0/1 ret:-22 -'-123/123' -> -1/1 ret:-22 -'-foo' -> 0/0 ret:-22 -'123.23' -> 12323/100 ret:0 -'.23' -> 23/100 ret:0 -'-.23' -> -23/100 ret:-22 -'-0.234' -> -117/500 ret:-22 -'-0.0000001' -> 0/1 ret:-22 -' 21332.2324 ' -> 917286/43 ret:0 -' -21332.2324 ' -> -917286/43 ret:-22 +'-inf' -> -1/0 ret:Invalid argument +'inf' -> 1/0 ret:Invalid argument +'nan' -> 0/0 ret:Invalid argument +'123/0' -> 1/0 ret:Invalid argument +'-123 / 0' -> -1/0 ret:Invalid argument +'' -> 0/0 ret:Invalid argument +'/' -> 0/0 ret:Invalid argument +' 123 / 321' -> 41/107 ret:Success +'foo/foo' -> 0/0 ret:Invalid argument +'foo/1' -> 0/0 ret:Invalid argument +'1/foo' -> 1/0 ret:Invalid argument +'0/0' -> 0/0 ret:Invalid argument +'/0' -> 0/0 ret:Invalid argument +'1/' -> 1/0 ret:Invalid argument +'1' -> 1/1 ret:Success +'0' -> 0/1 ret:Invalid argument +'-123/123' -> -1/1 ret:Invalid argument +'-foo' -> 0/0 ret:Invalid argument +'123.23' -> 12323/100 ret:Success +'.23' -> 23/100 ret:Success +'-.23' -> -23/100 ret:Invalid argument +'-0.234' -> -117/500 ret:Invalid argument +'-0.0000001' -> 0/1 ret:Invalid argument +' 21332.2324 ' -> 917286/43 ret:Success +' -21332.2324 ' -> -917286/43 ret:Invalid argument Testing av_parse_color() bikeshed -> R(80) G(64) B(140) A(59) |