Browse Source

over 9000 years of shame on me.

What where I thinking when I wrote that?!
Godzil 4 years ago
parent
commit
6bef6a1b77
1 changed files with 2 additions and 2 deletions
  1. 2 2
      source/canvas.cpp

+ 2 - 2
source/canvas.cpp

@@ -61,7 +61,7 @@ Canvas::Canvas(const char *imgfile)
     {
         printf("ERROR: Invalid file name '%s' - Can't determine the file format\n", imgfile);
     }
-    else if (strncasecmp(fileExt, ".png", sizeof(fileExt)) == 0)
+    else if (strncasecmp(fileExt, ".png", strlen(fileExt)) == 0)
     {
         uint32_t ret = lodepng_decode24_file(&this->bitmap, &this->width, &this->height, imgfile);
         if (ret)
@@ -69,7 +69,7 @@ Canvas::Canvas(const char *imgfile)
             printf("ERROR: %s\n", lodepng_error_text(ret));
         }
     }
-    else if ( (strncasecmp(fileExt, ".jpg", sizeof(fileExt)) == 0) || (strncasecmp(fileExt, ".jpeg", sizeof(fileExt)) == 0) )
+    else if ( (strncasecmp(fileExt, ".jpg", strlen(fileExt)) == 0) || (strncasecmp(fileExt, ".jpeg", strlen(fileExt)) == 0) )
     {
         FILE *fp;
         char *fileBuff;