From cd26b200b2abcd6779067b139cd299e09c2903d5 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 3 Dec 2014 17:02:21 -0500 Subject: [PATCH] Core: Get rid of a few c_str/strlen calls --- Core/Dialog/SavedataParam.cpp | 4 ++-- Core/FileSystems/VirtualDiscFileSystem.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/Dialog/SavedataParam.cpp b/Core/Dialog/SavedataParam.cpp index 272ffb4e42..f217fbeb0c 100644 --- a/Core/Dialog/SavedataParam.cpp +++ b/Core/Dialog/SavedataParam.cpp @@ -1271,8 +1271,8 @@ int SavedataParam::SetPspParam(SceUtilitySavedataParam *param) std::string gameName = GetGameName(param); std::string saveName = ""; for(auto it = allSaves.begin(); it != allSaves.end(); ++it) { - if(strncmp(it->name.c_str(),gameName.c_str(),strlen(gameName.c_str())) == 0) { - saveName = it->name.substr(strlen(gameName.c_str())); + if(it->name.compare(0, gameName.length(), gameName) == 0) { + saveName = it->name.substr(gameName.length()); if(IsInSaveDataList(saveName, realCount)) // Already in SaveDataList, skip... continue; diff --git a/Core/FileSystems/VirtualDiscFileSystem.cpp b/Core/FileSystems/VirtualDiscFileSystem.cpp index 17443358ef..f94f370474 100644 --- a/Core/FileSystems/VirtualDiscFileSystem.cpp +++ b/Core/FileSystems/VirtualDiscFileSystem.cpp @@ -88,7 +88,7 @@ void VirtualDiscFileSystem::LoadFileListIndex() { line = line.substr(3); } - if (strlen(line.data()) < 1 || line[0] == ';') { + if (line.empty() || line[0] == ';') { continue; }