Merge pull request #343 from tomaz82/misc_fixes

Silence warnings
This commit is contained in:
Jools Wills 2018-01-13 13:25:41 +00:00 committed by GitHub
commit 0df13ca373
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 38 additions and 43 deletions

View file

@ -14,7 +14,6 @@
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <pugixml/src/pugixml.hpp> #include <pugixml/src/pugixml.hpp>
#include <fstream> #include <fstream>
#include <unordered_map>
std::string myCollectionsName = "collections"; std::string myCollectionsName = "collections";
@ -1023,9 +1022,7 @@ std::string getCollectionsFolder()
bool systemSort(SystemData* sys1, SystemData* sys2) bool systemSort(SystemData* sys1, SystemData* sys2)
{ {
std::string name1 = sys1->getName(); std::string name1 = Utils::String::toUpper(sys1->getName());
std::string name2 = sys2->getName(); std::string name2 = Utils::String::toUpper(sys2->getName());
transform(name1.cbegin(), name1.cend(), name1.begin(), ::toupper);
transform(name2.cbegin(), name2.cend(), name2.begin(), ::toupper);
return name1.compare(name2) < 0; return name1.compare(name2) < 0;
} }

View file

@ -1,5 +1,7 @@
#include "FileSorts.h" #include "FileSorts.h"
#include "utils/StringUtil.h"
namespace FileSorts namespace FileSorts
{ {
const FileData::SortType typesArr[] = { const FileData::SortType typesArr[] = {
@ -40,10 +42,8 @@ namespace FileSorts
bool compareName(const FileData* file1, const FileData* file2) bool compareName(const FileData* file1, const FileData* file2)
{ {
// we compare the actual metadata name, as collection files have the system appended which messes up the order // we compare the actual metadata name, as collection files have the system appended which messes up the order
std::string name1 = file1->metadata.get("name"); std::string name1 = Utils::String::toUpper(file1->metadata.get("name"));
std::string name2 = file2->metadata.get("name"); std::string name2 = Utils::String::toUpper(file2->metadata.get("name"));
transform(name1.cbegin(), name1.cend(), name1.begin(), ::toupper);
transform(name2.cbegin(), name2.cend(), name2.begin(), ::toupper);
return name1.compare(name2) < 0; return name1.compare(name2) < 0;
} }
@ -84,37 +84,29 @@ namespace FileSorts
bool compareGenre(const FileData* file1, const FileData* file2) bool compareGenre(const FileData* file1, const FileData* file2)
{ {
std::string genre1 = file1->metadata.get("genre"); std::string genre1 = Utils::String::toUpper(file1->metadata.get("genre"));
std::string genre2 = file2->metadata.get("genre"); std::string genre2 = Utils::String::toUpper(file2->metadata.get("genre"));
transform(genre1.cbegin(), genre1.cend(), genre1.begin(), ::toupper);
transform(genre2.cbegin(), genre2.cend(), genre2.begin(), ::toupper);
return genre1.compare(genre2) < 0; return genre1.compare(genre2) < 0;
} }
bool compareDeveloper(const FileData* file1, const FileData* file2) bool compareDeveloper(const FileData* file1, const FileData* file2)
{ {
std::string developer1 = file1->metadata.get("developer"); std::string developer1 = Utils::String::toUpper(file1->metadata.get("developer"));
std::string developer2 = file2->metadata.get("developer"); std::string developer2 = Utils::String::toUpper(file2->metadata.get("developer"));
transform(developer1.cbegin(), developer1.cend(), developer1.begin(), ::toupper);
transform(developer2.cbegin(), developer2.cend(), developer2.begin(), ::toupper);
return developer1.compare(developer2) < 0; return developer1.compare(developer2) < 0;
} }
bool comparePublisher(const FileData* file1, const FileData* file2) bool comparePublisher(const FileData* file1, const FileData* file2)
{ {
std::string publisher1 = file1->metadata.get("publisher"); std::string publisher1 = Utils::String::toUpper(file1->metadata.get("publisher"));
std::string publisher2 = file2->metadata.get("publisher"); std::string publisher2 = Utils::String::toUpper(file2->metadata.get("publisher"));
transform(publisher1.cbegin(), publisher1.cend(), publisher1.begin(), ::toupper);
transform(publisher2.cbegin(), publisher2.cend(), publisher2.begin(), ::toupper);
return publisher1.compare(publisher2) < 0; return publisher1.compare(publisher2) < 0;
} }
bool compareSystem(const FileData* file1, const FileData* file2) bool compareSystem(const FileData* file1, const FileData* file2)
{ {
std::string system1 = file1->getSystemName(); std::string system1 = Utils::String::toUpper(file1->getSystemName());
std::string system2 = file2->getSystemName(); std::string system2 = Utils::String::toUpper(file2->getSystemName());
transform(system1.cbegin(), system1.cend(), system1.begin(), ::toupper);
transform(system2.cbegin(), system2.cend(), system2.begin(), ::toupper);
return system1.compare(system2) < 0; return system1.compare(system2) < 0;
} }
}; };

View file

@ -35,8 +35,8 @@ GuiFastSelect::GuiFastSelect(Window* window, IGameListView* gamelist) : GuiCompo
mSortId = 0; // TODO mSortId = 0; // TODO
updateSortText(); updateSortText();
mLetterId = (int)LETTERS.find(mGameList->getCursor()->getName()[0]); mLetterId = LETTERS.find(mGameList->getCursor()->getName()[0]);
if(mLetterId == (int)std::string::npos) if(mLetterId == std::string::npos)
mLetterId = 0; mLetterId = 0;
mScrollDir = 0; mScrollDir = 0;
@ -115,9 +115,9 @@ void GuiFastSelect::scroll()
{ {
mLetterId += mScrollDir; mLetterId += mScrollDir;
if(mLetterId < 0) if(mLetterId < 0)
mLetterId += (int)LETTERS.length(); mLetterId += LETTERS.length();
else if(mLetterId >= (int)LETTERS.length()) else if(mLetterId >= LETTERS.length())
mLetterId -= (int)LETTERS.length(); mLetterId -= LETTERS.length();
mLetterText.setText(LETTERS.substr(mLetterId, 1)); mLetterText.setText(LETTERS.substr(mLetterId, 1));
} }

View file

@ -24,7 +24,7 @@ private:
void updateSortText(); void updateSortText();
int mSortId; int mSortId;
int mLetterId; size_t mLetterId;
int mScrollDir; int mScrollDir;
int mScrollAccumulator; int mScrollAccumulator;

View file

@ -169,29 +169,31 @@ CECInput::~CECInput()
std::string CECInput::getAlertTypeString(const unsigned int _type) std::string CECInput::getAlertTypeString(const unsigned int _type)
{ {
#ifdef HAVE_LIBCEC
switch(_type) switch(_type)
{ {
#ifdef HAVE_LIBCEC
case CEC::CEC_ALERT_SERVICE_DEVICE: { return "Service-Device"; } break; case CEC::CEC_ALERT_SERVICE_DEVICE: { return "Service-Device"; } break;
case CEC::CEC_ALERT_CONNECTION_LOST: { return "Connection-Lost"; } break; case CEC::CEC_ALERT_CONNECTION_LOST: { return "Connection-Lost"; } break;
case CEC::CEC_ALERT_PERMISSION_ERROR: { return "Permission-Error"; } break; case CEC::CEC_ALERT_PERMISSION_ERROR: { return "Permission-Error"; } break;
case CEC::CEC_ALERT_PORT_BUSY: { return "Port-Busy"; } break; case CEC::CEC_ALERT_PORT_BUSY: { return "Port-Busy"; } break;
case CEC::CEC_ALERT_PHYSICAL_ADDRESS_ERROR: { return "Physical-Address-Error"; } break; case CEC::CEC_ALERT_PHYSICAL_ADDRESS_ERROR: { return "Physical-Address-Error"; } break;
case CEC::CEC_ALERT_TV_POLL_FAILED: { return "TV-Poll-Failed"; } break; case CEC::CEC_ALERT_TV_POLL_FAILED: { return "TV-Poll-Failed"; } break;
} #else // HAVE_LIBCEC
case 0:
#endif // HAVE_LIBCEC #endif // HAVE_LIBCEC
return "Unknown"; default: { return "Unknown"; } break;
}
} // getAlertTypeString } // getAlertTypeString
std::string CECInput::getOpCodeString(const unsigned int _opCode) std::string CECInput::getOpCodeString(const unsigned int _opCode)
{ {
#ifdef HAVE_LIBCEC
switch(_opCode) switch(_opCode)
{ {
#ifdef HAVE_LIBCEC
case CEC::CEC_OPCODE_ACTIVE_SOURCE: { return "Active-Source"; } break; case CEC::CEC_OPCODE_ACTIVE_SOURCE: { return "Active-Source"; } break;
case CEC::CEC_OPCODE_IMAGE_VIEW_ON: { return "Image-View-On"; } break; case CEC::CEC_OPCODE_IMAGE_VIEW_ON: { return "Image-View-On"; } break;
case CEC::CEC_OPCODE_TEXT_VIEW_ON: { return "Text-View-On"; } break; case CEC::CEC_OPCODE_TEXT_VIEW_ON: { return "Text-View-On"; } break;
@ -262,19 +264,21 @@ std::string CECInput::getOpCodeString(const unsigned int _opCode)
case CEC::CEC_OPCODE_END_ARC: { return "End-Arc"; } break; case CEC::CEC_OPCODE_END_ARC: { return "End-Arc"; } break;
case CEC::CEC_OPCODE_CDC: { return "CDC"; } break; case CEC::CEC_OPCODE_CDC: { return "CDC"; } break;
case CEC::CEC_OPCODE_NONE: { return "None"; } break; case CEC::CEC_OPCODE_NONE: { return "None"; } break;
} #else // HAVE_LIBCEC
case 0:
#endif // HAVE_LIBCEC #endif // HAVE_LIBCEC
return "Unknown"; default: { return "Unknown"; } break;
}
} // getOpCodeString } // getOpCodeString
std::string CECInput::getKeyCodeString(const unsigned int _keyCode) std::string CECInput::getKeyCodeString(const unsigned int _keyCode)
{ {
#ifdef HAVE_LIBCEC
switch(_keyCode) switch(_keyCode)
{ {
#ifdef HAVE_LIBCEC
case CEC::CEC_USER_CONTROL_CODE_SELECT: { return "Select"; } break; case CEC::CEC_USER_CONTROL_CODE_SELECT: { return "Select"; } break;
case CEC::CEC_USER_CONTROL_CODE_UP: { return "Up"; } break; case CEC::CEC_USER_CONTROL_CODE_UP: { return "Up"; } break;
case CEC::CEC_USER_CONTROL_CODE_DOWN: { return "Down"; } break; case CEC::CEC_USER_CONTROL_CODE_DOWN: { return "Down"; } break;
@ -362,9 +366,11 @@ std::string CECInput::getKeyCodeString(const unsigned int _keyCode)
case CEC::CEC_USER_CONTROL_CODE_DATA: { return "Data"; } break; case CEC::CEC_USER_CONTROL_CODE_DATA: { return "Data"; } break;
case CEC::CEC_USER_CONTROL_CODE_AN_RETURN: { return "AN-Return"; } break; case CEC::CEC_USER_CONTROL_CODE_AN_RETURN: { return "AN-Return"; } break;
case CEC::CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST: { return "AN-Channels-List"; } break; case CEC::CEC_USER_CONTROL_CODE_AN_CHANNELS_LIST: { return "AN-Channels-List"; } break;
} #else // HAVE_LIBCEC
case 0:
#endif // HAVE_LIBCEC #endif // HAVE_LIBCEC
return "Unknown"; default: { return "Unknown"; } break;
}
} // getKeyCodeString } // getKeyCodeString