changeset 5929:aaeed46a74fd libavcodec

use sizeof in snprintf (note the changed code is all under #if 0)
author michael
date Mon, 19 Nov 2007 20:18:30 +0000
parents de81a7e065fc
children 8a9716d0ccff
files dvbsubdec.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/dvbsubdec.c	Mon Nov 19 20:14:46 2007 +0000
+++ b/dvbsubdec.c	Mon Nov 19 20:18:30 2007 +0000
@@ -102,7 +102,7 @@
     char fname[40], fname2[40];
     char command[1024];
 
-    snprintf(fname, 40, "%s.ppm", filename);
+    snprintf(fname, sizeof(fname), "%s.ppm", filename);
 
     f = fopen(fname, "w");
     if (!f) {
@@ -124,7 +124,7 @@
     fclose(f);
 
 
-    snprintf(fname2, 40, "%s-a.pgm", filename);
+    snprintf(fname2, sizeof(fname2), "%s-a.pgm", filename);
 
     f = fopen(fname2, "w");
     if (!f) {
@@ -143,10 +143,10 @@
     }
     fclose(f);
 
-    snprintf(command, 1024, "pnmtopng -alpha %s %s > %s.png 2> /dev/null", fname2, fname, filename);
+    snprintf(command, sizeof(command), "pnmtopng -alpha %s %s > %s.png 2> /dev/null", fname2, fname, filename);
     system(command);
 
-    snprintf(command, 1024, "rm %s %s", fname, fname2);
+    snprintf(command, sizeof(command), "rm %s %s", fname, fname2);
     system(command);
 }
 #endif
@@ -1262,7 +1262,7 @@
 
         }
 
-        snprintf(filename, 32, "dvbs.%d", fileno_index);
+        snprintf(filename, sizeof(filename), "dvbs.%d", fileno_index);
 
         png_save2(filename, pbuf, width, height);