summaryrefslogtreecommitdiffstats
path: root/src/StringUtils.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2014-05-08 20:17:31 +0200
committerMattes D <github@xoft.cz>2014-05-08 20:17:31 +0200
commitccf44f18d1258e7b75db36afdc39bc816f7c78fe (patch)
tree7a5a436db251e032af712374830d394753fccc83 /src/StringUtils.cpp
parentcNetherFortGen uses cGridStructGen. (diff)
parentFixed MSVC 64-bit build warnings. (diff)
downloadcuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.gz
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.bz2
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.lz
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.xz
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.tar.zst
cuberite-ccf44f18d1258e7b75db36afdc39bc816f7c78fe.zip
Diffstat (limited to 'src/StringUtils.cpp')
-rw-r--r--src/StringUtils.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/src/StringUtils.cpp b/src/StringUtils.cpp
index 33b04505f..7488a3073 100644
--- a/src/StringUtils.cpp
+++ b/src/StringUtils.cpp
@@ -247,18 +247,22 @@ int NoCaseCompare(const AString & s1, const AString & s2)
-unsigned int RateCompareString(const AString & s1, const AString & s2 )
+size_t RateCompareString(const AString & s1, const AString & s2)
{
- unsigned int MatchedLetters = 0;
- unsigned int s1Length = s1.length();
+ size_t MatchedLetters = 0;
+ size_t s1Length = s1.length();
- if( s1Length > s2.length() ) return 0; // Definitely not a match
+ if (s1Length > s2.length())
+ {
+ // Definitely not a match
+ return 0;
+ }
- for (unsigned int i = 0; i < s1Length; i++)
+ for (size_t i = 0; i < s1Length; i++)
{
- char c1 = (char)toupper( s1[i] );
- char c2 = (char)toupper( s2[i] );
- if( c1 == c2 )
+ char c1 = (char)toupper(s1[i]);
+ char c2 = (char)toupper(s2[i]);
+ if (c1 == c2)
{
++MatchedLetters;
}
@@ -288,11 +292,11 @@ void ReplaceString(AString & iHayStack, const AString & iNeedle, const AString &
// Converts a stream of BE shorts into UTF-8 string; returns a ref to a_UTF8
-AString & RawBEToUTF8(const char * a_RawData, int a_NumShorts, AString & a_UTF8)
+AString & RawBEToUTF8(const char * a_RawData, size_t a_NumShorts, AString & a_UTF8)
{
a_UTF8.clear();
a_UTF8.reserve(3 * a_NumShorts / 2); // a quick guess of the resulting size
- for (int i = 0; i < a_NumShorts; i++)
+ for (size_t i = 0; i < a_NumShorts; i++)
{
int c = GetBEShort(&a_RawData[i * 2]);
if (c < 0x80)