On Tue, 17 May 2016, Diego Biurrun wrote:

On Tue, May 17, 2016 at 01:15:40PM -0400, Vittorio Giovara wrote:
On Tue, May 17, 2016 at 12:49 PM, Diego Biurrun <[email protected]> wrote:
--- a/libavutil/tests/xtea.c
+++ b/libavutil/tests/xtea.c
@@ -22,6 +22,7 @@
 #include <string.h>

 #include "libavutil/intreadwrite.h"
+#include "libavutil/mem.h"
 #include "libavutil/xtea.h"

 #define XTEA_NUM_TESTS 6
@@ -80,41 +81,44 @@ static void test_xtea(AVXTEA *ctx, uint8_t *dst, const 
uint8_t *src,

 int main(void)
 {
-    AVXTEA ctx;
     uint8_t buf[16], iv[8];
     int i, j;
     static const uint8_t src[32] = "HelloWorldHelloWorldHelloWorld";
     uint8_t ct[32];
     uint8_t pl[32];
+    AVXTEA *ctx = av_xtea_alloc();
+    if (!ctx)
+        return -1;

I think you have to return positive values for errors.

I don't think so.  What gives you the idea?

Because the return value of a process is in the range 0-255. Normally, the range 0-127 is used for return values directly returned by the main function, while the range 128-255 is used for cases when the process is killed by a signal, where the value somehow hints about what signal killed it. Now if you return a negative value from main, this ends up mapped into the high half of the range, making it alias the return code or signals.


The FATE test relies on comparing output and I think it's somewhat beneficial to have different return values for different errors.

Yes, multiple different return values is obviously good, but you should use 1-127 for that, not negative values. Otherwise you can't differentiate between code errors and signals.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to