1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-13 00:04:19 +00:00

Refactored various string processing in the library. Removed a couple of String accessors that relied on assumptions about the format of the string's internal data (if your code has any problems with these changes, you should probably use the String::getCharPointer() method instead).

This commit is contained in:
Julian Storer 2011-01-31 17:59:38 +00:00
parent c10c810aee
commit 3bacbe2a8c
37 changed files with 780 additions and 893 deletions

View file

@ -336,15 +336,14 @@ const String MemoryBlock::toBase64Encoding() const
const int initialLen = destString.length();
destString.preallocateStorage (initialLen + 2 + numChars);
juce_wchar* d = destString;
String::CharPointerType d (destString.getCharPointer());
d += initialLen;
*d++ = '.';
d.write ('.');
for (size_t i = 0; i < numChars; ++i)
*d++ = encodingTable [getBitRange (i * 6, 6)];
*d++ = 0;
d.write (encodingTable [getBitRange (i * 6, 6)]);
d.writeNull();
return destString;
}
@ -360,13 +359,14 @@ bool MemoryBlock::fromBase64Encoding (const String& s)
setSize (numBytesNeeded, true);
const int numChars = s.length() - startPos;
const juce_wchar* srcChars = s;
String::CharPointerType srcChars (s.getCharPointer());
srcChars += startPos;
int pos = 0;
for (int i = 0; i < numChars; ++i)
{
const char c = (char) srcChars[i];
const char c = (char) srcChars.getAndAdvance();
for (int j = 0; j < 64; ++j)
{