diff options
Diffstat (limited to 'src/resources/wallpaper.cpp')
-rw-r--r-- | src/resources/wallpaper.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 24c6fff2..2c8c4a00 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -54,26 +54,35 @@ void Wallpaper::loadWallpapers() { char **imgs = PHYSFS_enumerateFiles(WALLPAPER_FOLDER); char **i; - int baseLen = strlen(WALLPAPER_BASE), width, height; + size_t baseLen = strlen(WALLPAPER_BASE); + int width; + int height; wallpapers.clear(); haveBackup = false; for (i = imgs; *i != NULL; i++) + { if (strncmp(*i, WALLPAPER_BASE, baseLen) == 0) + { if (strlen(*i) == baseLen + 4) + { if (haveBackup) logger->log("Duplicate default wallpaper!"); - else haveBackup = true; - else if (sscanf(*i, WALLPAPER_BASE "_%dx%d.png", &width, - &height) == 2) + else + haveBackup = true; + } + else if (sscanf(*i, WALLPAPER_BASE "_%dx%d.png", + &width, &height) == 2) { struct wallpaper wp; wp.width = width; wp.height = height; wallpapers.push_back(wp); } + } + } PHYSFS_freeList(imgs); |