From 4a14c7d2d8f31420ddf578e4cbc54fae1dade30d Mon Sep 17 00:00:00 2001 From: somewhatlurker <52014015+somewhatlurker@users.noreply.github.com> Date: Sat, 14 Sep 2019 16:08:38 +1000 Subject: [PATCH] make BOM checks more correct (& to &&) --- source-code/source/plugins/Launcher/framework.h | 4 ++-- source-code/source/plugins/TLAC/FileSystem/ConfigFile.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index 4af850d..dafe78e 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -248,7 +248,7 @@ bool IsLineInFile(LPCSTR searchLine, LPCWSTR fileName) // check for BOM std::getline(fileStream, line); - if (line.size() >= 3 & line.rfind("\xEF\xBB\xBF", 0) == 0) + if (line.size() >= 3 && line.rfind("\xEF\xBB\xBF", 0) == 0) fileStream.seekg(3); else fileStream.seekg(0); @@ -284,7 +284,7 @@ void PrependFile(LPCSTR newStr, LPCWSTR fileName) // check for BOM std::string BOMcheckLine; std::getline(fileStream, BOMcheckLine); - if (BOMcheckLine.size() >= 3 & BOMcheckLine.rfind("\xEF\xBB\xBF", 0) == 0) + if (BOMcheckLine.size() >= 3 && BOMcheckLine.rfind("\xEF\xBB\xBF", 0) == 0) fileStream.seekg(3); else fileStream.seekg(0); diff --git a/source-code/source/plugins/TLAC/FileSystem/ConfigFile.cpp b/source-code/source/plugins/TLAC/FileSystem/ConfigFile.cpp index b365338..b0a4a69 100644 --- a/source-code/source/plugins/TLAC/FileSystem/ConfigFile.cpp +++ b/source-code/source/plugins/TLAC/FileSystem/ConfigFile.cpp @@ -53,7 +53,7 @@ namespace TLAC::FileSystem // check for BOM std::getline(fileStream, line); - if (line.size() >= 3 & line.rfind("\xEF\xBB\xBF", 0) == 0) + if (line.size() >= 3 && line.rfind("\xEF\xBB\xBF", 0) == 0) fileStream.seekg(3); else fileStream.seekg(0); @@ -74,6 +74,6 @@ namespace TLAC::FileSystem bool ConfigFile::IsComment(const std::string &line) { - return line.size() <= 0 || line[0] == '#' || line[0] == '[' || (line.size() >= 2 & line.rfind("//", 0) == 0); + return line.size() <= 0 || line[0] == '#' || line[0] == '[' || (line.size() >= 2 && line.rfind("//", 0) == 0); } }