aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/utils/string_util.cpp
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
committerEinar Johan Trøan Sømåen2012-07-26 15:59:26 +0200
commitef11f9d0c53cbdd9d88a99143de6f43f34d7e24d (patch)
tree8dfaee0ba16e18a8e3772dd5afc9123d5c4e78d2 /engines/wintermute/utils/string_util.cpp
parent38507fa9895620639d8733dbb4e085dfb2282a33 (diff)
downloadscummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.gz
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.tar.bz2
scummvm-rg350-ef11f9d0c53cbdd9d88a99143de6f43f34d7e24d.zip
WINTERMUTE: Run Astyle with add-braces to break one-line statements into easier-to-read-code.
Diffstat (limited to 'engines/wintermute/utils/string_util.cpp')
-rw-r--r--engines/wintermute/utils/string_util.cpp22
1 files changed, 14 insertions, 8 deletions
diff --git a/engines/wintermute/utils/string_util.cpp b/engines/wintermute/utils/string_util.cpp
index 748016d9c4..f864a8480a 100644
--- a/engines/wintermute/utils/string_util.cpp
+++ b/engines/wintermute/utils/string_util.cpp
@@ -215,14 +215,15 @@ bool StringUtil::startsWith(const AnsiString &str, const AnsiString &pattern, bo
if (ignoreCase) return CompareNoCase(startPart, pattern);
else return (startPart == pattern);*/
- if (!ignoreCase)
+ if (!ignoreCase) {
return str.hasPrefix(pattern);
- else {
+ } else {
size_t strLength = str.size();
size_t patternLength = pattern.size();
- if (strLength < patternLength || patternLength == 0)
+ if (strLength < patternLength || patternLength == 0) {
return false;
+ }
AnsiString startPart(str.c_str(), patternLength);
uint32 likeness = startPart.compareToIgnoreCase(pattern.c_str());
@@ -248,8 +249,9 @@ bool StringUtil::endsWith(const AnsiString &str, const AnsiString &pattern, bool
size_t strLength = str.size();
size_t patternLength = pattern.size();
- if (strLength < patternLength || patternLength == 0)
+ if (strLength < patternLength || patternLength == 0) {
return false;
+ }
Common::String endPart(str.c_str() + (strLength - patternLength), patternLength);
uint32 likeness = str.compareToIgnoreCase(pattern.c_str());
@@ -259,8 +261,11 @@ bool StringUtil::endsWith(const AnsiString &str, const AnsiString &pattern, bool
//////////////////////////////////////////////////////////////////////////
bool StringUtil::isUtf8BOM(const byte *Buffer, uint32 BufferSize) {
- if (BufferSize > 3 && Buffer[0] == 0xEF && Buffer[1] == 0xBB && Buffer[2] == 0xBF) return true;
- else return false;
+ if (BufferSize > 3 && Buffer[0] == 0xEF && Buffer[1] == 0xBB && Buffer[2] == 0xBF) {
+ return true;
+ } else {
+ return false;
+ }
}
//////////////////////////////////////////////////////////////////////////
@@ -269,10 +274,11 @@ int StringUtil::indexOf(const WideString &str, const WideString &toFind, size_t
if (pos == str.npos) return -1;
else return pos;*/
const char *index = strstr(str.c_str(), toFind.c_str());
- if (index == NULL)
+ if (index == NULL) {
return -1;
- else
+ } else {
return index - str.c_str();
+ }
}