"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "util/String.cpp" between
muscle7.61.zip and muscle7.62.zip

About: MUSCLE (Multi User Server Client Linking Environment) is a messaging server and networking API. The included server program ("muscled") lets its clients message each other, and/or store information in its serverside hierarchical database.

String.cpp  (muscle7.61):String.cpp  (muscle7.62)
skipping to change at line 383 skipping to change at line 383
const String & withMe = iter.GetValue(); const String & withMe = iter.GetValue();
const char * readPtr = Cstr(); const char * readPtr = Cstr();
while((maxReplaceCount > (uint32)0)&&((uint32)(nullTerminator-readPtr)>=re placeMe.Length())) while((maxReplaceCount > (uint32)0)&&((uint32)(nullTerminator-readPtr)>=re placeMe.Length()))
{ {
const char * nextFind = strstr(readPtr, replaceMe()); const char * nextFind = strstr(readPtr, replaceMe());
if (nextFind) if (nextFind)
{ {
// Check to see if all of the reservation-char-slots for this substr ing are still open (if not, we'll skip this match) // Check to see if all of the reservation-char-slots for this substr ing are still open (if not, we'll skip this match)
bool alreadyReserved = false; bool alreadyReserved = false;
const uint32 startOffset = (nextFind-Cstr()); const uint32 startOffset = (uint32)(nextFind-Cstr());
const uint32 endOffset = startOffset+replaceMe.Length(); const uint32 endOffset = startOffset+replaceMe.Length();
for (uint32 i=startOffset; i<endOffset; i++) {if (reservations[i] != NULL) alreadyReserved = true; break;} for (uint32 i=startOffset; i<endOffset; i++) {if (reservations[i] != NULL) alreadyReserved = true; break;}
if (alreadyReserved == false) if (alreadyReserved == false)
{ {
// Make the reservation! // Make the reservation!
for (uint32 i=startOffset; i<endOffset; i++) reservations[i] = &r eplaceMe; for (uint32 i=startOffset; i<endOffset; i++) reservations[i] = &r eplaceMe;
stringLengthDelta += (withMe.Length()-replaceMe.Length()); stringLengthDelta += (withMe.Length()-replaceMe.Length());
if (maxReplaceCount != MUSCLE_NO_LIMIT) maxReplaceCount--; if (maxReplaceCount != MUSCLE_NO_LIMIT) maxReplaceCount--;
} }
readPtr = nextFind + replaceMe.Length(); readPtr = nextFind + replaceMe.Length();
skipping to change at line 861 skipping to change at line 861
while(ret.EndsWith(c)) while(ret.EndsWith(c))
{ {
ret--; ret--;
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
return ret; return ret;
} }
String String :: WithoutSuffix(const String & str, uint32 maxToRemove) const String String :: WithoutSuffix(const String & str, uint32 maxToRemove) const
{ {
if (str.IsEmpty()) return *this;
String ret = *this; String ret = *this;
while(ret.EndsWith(str)) while(ret.EndsWith(str))
{ {
ret.TruncateChars(str.Length()); ret.TruncateChars(str.Length());
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
return ret; return ret;
} }
String String :: WithoutPrefix(char c, uint32 maxToRemove) const String String :: WithoutPrefix(char c, uint32 maxToRemove) const
skipping to change at line 889 skipping to change at line 891
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
else break; else break;
} }
return Substring(numInitialChars); return Substring(numInitialChars);
} }
String String :: WithoutPrefix(const String & str, uint32 maxToRemove) const String String :: WithoutPrefix(const String & str, uint32 maxToRemove) const
{ {
if (StartsWith(str) == false) return *this; if ((str.IsEmpty())||(StartsWith(str) == false)) return *this;
String ret = *this; String ret = *this;
while(ret.StartsWith(str)) while(ret.StartsWith(str))
{ {
ret = ret.Substring(str.Length()); ret = ret.Substring(str.Length());
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
return ret; return ret;
} }
skipping to change at line 915 skipping to change at line 917
while(ret.EndsWithIgnoreCase(c)) while(ret.EndsWithIgnoreCase(c))
{ {
ret--; ret--;
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
return ret; return ret;
} }
String String :: WithoutSuffixIgnoreCase(const String & str, uint32 maxToRemove) const String String :: WithoutSuffixIgnoreCase(const String & str, uint32 maxToRemove) const
{ {
if (EndsWithIgnoreCase(str) == false) return *this; if ((str.IsEmpty())||(EndsWithIgnoreCase(str) == false)) return *this;
String ret = *this; String ret = *this;
while(ret.EndsWithIgnoreCase(str)) while(ret.EndsWithIgnoreCase(str))
{ {
ret.TruncateChars(str.Length()); ret.TruncateChars(str.Length());
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
return ret; return ret;
} }
skipping to change at line 948 skipping to change at line 950
numInitialChars++; numInitialChars++;
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
else break; else break;
} }
return Substring(numInitialChars); return Substring(numInitialChars);
} }
String String :: WithoutPrefixIgnoreCase(const String & str, uint32 maxToRemove) const String String :: WithoutPrefixIgnoreCase(const String & str, uint32 maxToRemove) const
{ {
if (StartsWithIgnoreCase(str) == false) return *this; if ((str.IsEmpty())||(StartsWithIgnoreCase(str) == false)) return *this;
String ret = *this; String ret = *this;
while(ret.StartsWithIgnoreCase(str)) while(ret.StartsWithIgnoreCase(str))
{ {
ret = ret.Substring(str.Length()); ret = ret.Substring(str.Length());
if (--maxToRemove == 0) break; if (--maxToRemove == 0) break;
} }
return ret; return ret;
} }
 End of changes. 5 change blocks. 
4 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)