changeset 32914:692c174b6dc9

Move declaration of char array into scope of fExist() where it's used. (Besides, replace constant for size by sizeof expression.)
author ib
date Wed, 02 Mar 2011 17:30:14 +0000
parents d971fcdbb787
children 0cd5c0498962
files gui/bitmap.c
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/gui/bitmap.c	Wed Mar 02 17:17:19 2011 +0000
+++ b/gui/bitmap.c	Wed Mar 02 17:30:14 2011 +0000
@@ -155,10 +155,9 @@
 #endif
 }
 
-static unsigned char tmp[512];
-
 static unsigned char *fExist(unsigned char *fname)
 {
+    static unsigned char tmp[512];
     FILE *fl;
     unsigned char ext[][6] = { ".png\0", ".PNG\0" };
     int i;
@@ -171,7 +170,7 @@
     }
 
     for (i = 0; i < 2; i++) {
-        snprintf(tmp, 511, "%s%s", fname, ext[i]);
+        snprintf(tmp, sizeof(tmp), "%s%s", fname, ext[i]);
         fl = fopen(tmp, "rb");
 
         if (fl != NULL) {