Changed toChar to toCharArray in String and MozillaString. Also provided is a
version of the function which creates its own char* buffer. These classes are part of TransforMIIX and are not part of the automatic build process for the rest of Mozilla. git-svn-id: svn://10.0.0.236/trunk@64616 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -616,6 +616,17 @@ String& MozillaString::subString(Int32 start, Int32 end, String& dest) const
|
||||
return dest;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiate a new character buffer (remembering the null terminator) and pass
|
||||
* it to toChar(char*).
|
||||
**/
|
||||
char* MozillaString::toCharArray() const
|
||||
{
|
||||
char* tmpBuffer = new char[ptrNSString->Length()+1];
|
||||
|
||||
return toCharArray(tmpBuffer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert the internally represented string to a character buffer. Store
|
||||
* the resultant character array in the buffer provided by the caller. A
|
||||
@@ -624,14 +635,14 @@ String& MozillaString::subString(Int32 start, Int32 end, String& dest) const
|
||||
* Use ( nsString::GetUnicode() ) to retreive the nsString's buffer, then
|
||||
* copy it to dest.
|
||||
**/
|
||||
char* MozillaString::toChar(char* dest) const
|
||||
char* MozillaString::toCharArray(char* dest) const
|
||||
{
|
||||
Int32 copyLoop;
|
||||
Int32 strLength = ptrNSString->Length();
|
||||
const char* strBuffer = ptrNSString->GetBuffer();
|
||||
|
||||
for (copyLoop=0;copyLoop<strLength;copyLoop++)
|
||||
dest[copyLoop] = strBuffer[copyLoop];
|
||||
dest[copyLoop] = strBuffer[copyLoop];
|
||||
|
||||
//Place a NULL terminator at the end of the character buffer
|
||||
dest[copyLoop] = 0;
|
||||
|
||||
Reference in New Issue
Block a user