summaryrefslogtreecommitdiff
path: root/src/resources/wallpaper.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-08 23:29:21 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-09 22:51:37 +0200
commitdefb43bcd7dd1b3a475214bb3c36cb44bf16358f (patch)
tree40930c6d2e0f83723d230657b1250c600162c5ee /src/resources/wallpaper.cpp
parent69d8407badcb703709534f5097b9b5697ac3404c (diff)
downloadmana-defb43bcd7dd1b3a475214bb3c36cb44bf16358f.tar.gz
mana-defb43bcd7dd1b3a475214bb3c36cb44bf16358f.tar.bz2
mana-defb43bcd7dd1b3a475214bb3c36cb44bf16358f.tar.xz
mana-defb43bcd7dd1b3a475214bb3c36cb44bf16358f.zip
Fixed some warnings
Unused variable, compiler suggested braces to disambiguate an else statement and another comparision between signed and unsigned integers.
Diffstat (limited to 'src/resources/wallpaper.cpp')
-rw-r--r--src/resources/wallpaper.cpp17
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);