From d3e87739e3a94d7882e8e71d17ac91d1a0cd7fcc Mon Sep 17 00:00:00 2001 From: Tomas Jakobsson Date: Sat, 28 Oct 2017 22:07:31 +0200 Subject: [PATCH] fix warnings --- es-app/src/SystemData.cpp | 1 - es-app/src/guis/GuiGamelistFilter.cpp | 1 - es-app/src/main.cpp | 1 - es-app/src/scrapers/Scraper.cpp | 2 +- es-core/src/HttpReq.cpp | 2 +- es-core/src/ImageIO.cpp | 2 -- es-core/src/ThemeData.cpp | 12 ++++++------ es-core/src/components/ComponentList.cpp | 2 +- es-core/src/components/ImageGridComponent.h | 3 +-- es-core/src/resources/Font.cpp | 3 ++- es-core/src/resources/TextureDataManager.cpp | 2 -- 11 files changed, 12 insertions(+), 19 deletions(-) diff --git a/es-app/src/SystemData.cpp b/es-app/src/SystemData.cpp index ff0096332..984fe6086 100644 --- a/es-app/src/SystemData.cpp +++ b/es-app/src/SystemData.cpp @@ -197,7 +197,6 @@ bool SystemData::loadConfig() for(pugi::xml_node system = systemList.child("system"); system; system = system.next_sibling("system")) { std::string name, fullname, path, cmd, themeFolder; - PlatformIds::PlatformId platformId = PlatformIds::PLATFORM_UNKNOWN; name = system.child("name").text().get(); fullname = system.child("fullname").text().get(); diff --git a/es-app/src/guis/GuiGamelistFilter.cpp b/es-app/src/guis/GuiGamelistFilter.cpp index 0ecb85710..8a59a1f29 100644 --- a/es-app/src/guis/GuiGamelistFilter.cpp +++ b/es-app/src/guis/GuiGamelistFilter.cpp @@ -55,7 +55,6 @@ void GuiGamelistFilter::addFiltersToMenu() FilterIndexType type = (*it).type; // type of filter std::map* allKeys = (*it).allIndexKeys; // all possible filters for this type - std::vector* allFilteredKeys = (*it).currentFilteredKeys; // current keys being filtered for std::string menuLabel = (*it).menuLabel; // text to show in menu std::shared_ptr< OptionListComponent > optionList; diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index a0cfc5d8d..2fc749ded 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -313,7 +313,6 @@ int main(int argc, char* argv[]) int ps_time = SDL_GetTicks(); bool running = true; - bool ps_standby = false; while(running) { diff --git a/es-app/src/scrapers/Scraper.cpp b/es-app/src/scrapers/Scraper.cpp index 72ec9e6d4..bf91491cb 100644 --- a/es-app/src/scrapers/Scraper.cpp +++ b/es-app/src/scrapers/Scraper.cpp @@ -258,7 +258,7 @@ bool resizeImage(const std::string& path, int maxWidth, int maxHeight) return false; } - bool saved = FreeImage_Save(format, imageRescaled, path.c_str()); + bool saved = (FreeImage_Save(format, imageRescaled, path.c_str()) != 0); FreeImage_Unload(imageRescaled); if(!saved) diff --git a/es-core/src/HttpReq.cpp b/es-core/src/HttpReq.cpp index dfece200b..ca32b205b 100644 --- a/es-core/src/HttpReq.cpp +++ b/es-core/src/HttpReq.cpp @@ -117,7 +117,7 @@ HttpReq::Status HttpReq::status() int msgs_left; CURLMsg* msg; - while(msg = curl_multi_info_read(s_multi_handle, &msgs_left)) + while((msg = curl_multi_info_read(s_multi_handle, &msgs_left)) != nullptr) { if(msg->msg == CURLMSG_DONE) { diff --git a/es-core/src/ImageIO.cpp b/es-core/src/ImageIO.cpp index b6b5c8067..982aa97be 100644 --- a/es-core/src/ImageIO.cpp +++ b/es-core/src/ImageIO.cpp @@ -21,7 +21,6 @@ std::vector ImageIO::loadFromMemoryRGBA32(const unsigned char * d if (fiBitmap != nullptr) { //loaded. convert to 32bit if necessary - FIBITMAP * fiConverted = nullptr; if (FreeImage_GetBPP(fiBitmap) != 32) { FIBITMAP * fiConverted = FreeImage_ConvertTo32Bits(fiBitmap); @@ -36,7 +35,6 @@ std::vector ImageIO::loadFromMemoryRGBA32(const unsigned char * d { width = FreeImage_GetWidth(fiBitmap); height = FreeImage_GetHeight(fiBitmap); - unsigned int pitch = FreeImage_GetPitch(fiBitmap); //loop through scanlines and add all pixel data to the return vector //this is necessary, because width*height*bpp might not be == pitch unsigned char * tempData = new unsigned char[width * height * 4]; diff --git a/es-core/src/ThemeData.cpp b/es-core/src/ThemeData.cpp index 5cecba10d..b1e57b394 100644 --- a/es-core/src/ThemeData.cpp +++ b/es-core/src/ThemeData.cpp @@ -275,14 +275,14 @@ void ThemeData::parseIncludes(const pugi::xml_node& root) if(!result) throw error << "Error parsing file: \n " << result.description(); - pugi::xml_node root = includeDoc.child("theme"); - if(!root) + pugi::xml_node theme = includeDoc.child("theme"); + if(!theme) throw error << "Missing tag!"; - parseVariables(root); - parseIncludes(root); - parseViews(root); - parseFeatures(root); + parseVariables(theme); + parseIncludes(theme); + parseViews(theme); + parseFeatures(theme); mPaths.pop_back(); } diff --git a/es-core/src/components/ComponentList.cpp b/es-core/src/components/ComponentList.cpp index 9abd1ef8c..933b674c9 100644 --- a/es-core/src/components/ComponentList.cpp +++ b/es-core/src/components/ComponentList.cpp @@ -179,7 +179,7 @@ void ComponentList::render(const Eigen::Affine3f& parentTrans) for(unsigned int i = 0; i < mEntries.size(); i++) { auto& entry = mEntries.at(i); - drawAll = !mFocused || i != mCursor; + drawAll = !mFocused || i != (unsigned int)mCursor; for(auto it = entry.data.elements.begin(); it != entry.data.elements.end(); it++) { if(drawAll || it->invert_when_selected) diff --git a/es-core/src/components/ImageGridComponent.h b/es-core/src/components/ImageGridComponent.h index b00a6c624..d7701bdfd 100644 --- a/es-core/src/components/ImageGridComponent.h +++ b/es-core/src/components/ImageGridComponent.h @@ -218,7 +218,6 @@ void ImageGridComponent::updateImages() Eigen::Vector2i gridSize = getGridSize(); int cursorRow = mCursor / gridSize.x(); - int cursorCol = mCursor % gridSize.x(); int start = (cursorRow - (gridSize.y() / 2)) * gridSize.x(); @@ -240,7 +239,7 @@ void ImageGridComponent::updateImages() } Eigen::Vector2f squareSize = getSquareSize(mEntries.at(i).data.texture); - if(i == mCursor) + if(i == (unsigned int)mCursor) { image.setColorShift(0xFFFFFFFF); image.setResize(squareSize.x() + getPadding().x() * 0.95f, squareSize.y() + getPadding().y() * 0.95f); diff --git a/es-core/src/resources/Font.cpp b/es-core/src/resources/Font.cpp index 7e02249b1..b31a69861 100644 --- a/es-core/src/resources/Font.cpp +++ b/es-core/src/resources/Font.cpp @@ -142,7 +142,8 @@ Font::FontFace::FontFace(ResourceData&& d, int size) : data(d) int err = FT_New_Memory_Face(sLibrary, data.ptr.get(), data.length, 0, &face); assert(!err); - FT_Set_Pixel_Sizes(face, 0, size); + if(!err) + FT_Set_Pixel_Sizes(face, 0, size); } Font::FontFace::~FontFace() diff --git a/es-core/src/resources/TextureDataManager.cpp b/es-core/src/resources/TextureDataManager.cpp index 55720d14a..bd1f04d3e 100644 --- a/es-core/src/resources/TextureDataManager.cpp +++ b/es-core/src/resources/TextureDataManager.cpp @@ -107,8 +107,6 @@ void TextureDataManager::load(std::shared_ptr tex, bool block) size_t size = TextureResource::getTotalMemUsage(); size_t max_texture = (size_t)Settings::getInstance()->getInt("MaxVRAM") * 1024 * 1024; - size_t in = size; - for (auto it = mTextures.rbegin(); it != mTextures.rend(); ++it) { if (size < max_texture)