From 367b2e8b01c42c34c7782c4410db359c2b3ca060 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Mon, 6 Feb 2012 23:01:49 +0100 Subject: Fixed searching for wallpapers on 64-bit machines The check whether a filename contains any '%' character was failing because the 'unsigned int separator' was too small to hold std::string::npos. Reviewed-by: Yohann Ferreira --- src/resources/wallpaper.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 5f5cc29a..727ccced 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -103,12 +103,10 @@ void Wallpaper::loadWallpapers() // First, get the base filename of the image: std::string filename = *i; - unsigned int separator = filename.rfind("_"); - filename = filename.substr(0, separator); + filename = filename.substr(0, filename.rfind("_")); // Check that the base filename doesn't have any '%' markers. - separator = filename.find("%"); - if (separator == std::string::npos) + if (filename.find("%") == std::string::npos) { // Then, append the width and height search mask. filename.append("_%dx%d.png"); -- cgit v1.2.3-70-g09d2