[FFmpeg-cvslog] rotozoom: Make init_demo() return int and check for errors on invocation.

Diego Biurrun git at videolan.org
Thu May 12 04:55:11 CEST 2011


ffmpeg | branch: master | Diego Biurrun <diego at biurrun.de> | Mon May  9 12:33:45 2011 +0200| [2131e8590c447575a1c23bbc9f7e0bf9592d8997] | committer: Diego Biurrun

rotozoom: Make init_demo() return int and check for errors on invocation.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2131e8590c447575a1c23bbc9f7e0bf9592d8997
---

 tests/rotozoom.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/tests/rotozoom.c b/tests/rotozoom.c
index 642cefa..aebcc8e 100644
--- a/tests/rotozoom.c
+++ b/tests/rotozoom.c
@@ -234,7 +234,7 @@ static void gen_image(int num, int w, int h)
 #define W 256
 #define H 256
 
-static void init_demo(const char *filename)
+static int init_demo(const char *filename)
 {
     int i, j;
     int h;
@@ -246,7 +246,7 @@ static void init_demo(const char *filename)
     fichier = fopen(filename, "rb");
     if (!fichier) {
         perror(filename);
-        exit(1);
+        return 1;
     }
 
     fread(line, 1, 15, fichier);
@@ -267,6 +267,8 @@ static void init_demo(const char *filename)
         h_cos[i] = h * int_sin(radian + MY_PI / 2) / 2 / FIXP;
         h_sin[i] = h * int_sin(radian)             / 2 / FIXP;
     }
+
+  return 0;
 }
 
 int main(int argc, char **argv)
@@ -288,7 +290,8 @@ int main(int argc, char **argv)
     width   = w;
     height  = h;
 
-    init_demo(argv[2]);
+    if (init_demo(argv[2]))
+        return 1;
 
     for (i = 0; i < DEFAULT_NB_PICT; i++) {
         snprintf(buf, sizeof(buf), "%s%02d.pgm", argv[1], i);



More information about the ffmpeg-cvslog mailing list