diff --git a/mozilla/editor/base/nsHTMLEditRules.cpp b/mozilla/editor/base/nsHTMLEditRules.cpp
index ee029c35ee6..9d2299816e8 100644
--- a/mozilla/editor/base/nsHTMLEditRules.cpp
+++ b/mozilla/editor/base/nsHTMLEditRules.cpp
@@ -1059,7 +1059,6 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
// dont spaz my selection in subtransactions
nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
- nsSubsumeStr subStr;
nsAutoString tString(*inString);
const PRUnichar *unicodeBuf = tString.get();
nsCOMPtr unused;
@@ -1070,6 +1069,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
// it is to search for both tabs and newlines.
if (isPRE || bPlaintext)
{
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char newlineChar = '\n';
while (unicodeBuf && (pos != -1) && (pos < (PRInt32)(*inString).Length()))
{
@@ -1090,10 +1090,10 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
// is it a return?
- if (subStr.EqualsWithConversion("\n"))
+ if (subStr.Equals(newlineStr))
{
res = mHTMLEditor->CreateBRImpl(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
pos++;
@@ -1107,6 +1107,8 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
}
else
{
+ NS_NAMED_LITERAL_STRING(tabStr, "\t");
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char specialChars[] = {'\t','\n',0};
nsAutoString tabString; tabString.AssignWithConversion(" ");
while (unicodeBuf && (pos != -1) && (pos < (PRInt32)inString->Length()))
@@ -1128,12 +1130,12 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
nsWSRunObject wsObj(mHTMLEditor, curNode, curOffset);
// is it a tab?
- if (subStr.EqualsWithConversion("\t"))
+ if (subStr.Equals(tabStr))
{
// res = mHTMLEditor->InsertTextImpl(tabString, address_of(curNode), &curOffset, doc);
res = wsObj.InsertText(tabString, address_of(curNode), &curOffset, doc);
@@ -1141,7 +1143,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
pos++;
}
// is it a return?
- else if (subStr.EqualsWithConversion("\n"))
+ else if (subStr.Equals(newlineStr))
{
// res = mHTMLEditor->CreateBRImpl(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
res = wsObj.InsertBreak(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
diff --git a/mozilla/editor/base/nsTextEditRules.cpp b/mozilla/editor/base/nsTextEditRules.cpp
index 54ff4c7c30f..c280ff32c7a 100644
--- a/mozilla/editor/base/nsTextEditRules.cpp
+++ b/mozilla/editor/base/nsTextEditRules.cpp
@@ -607,7 +607,6 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
// dont spaz my selection in subtransactions
nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
- nsSubsumeStr subStr;
nsString tString(*outString);
const PRUnichar *unicodeBuf = tString.get();
nsCOMPtr unused;
@@ -618,6 +617,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
// it is to search for both tabs and newlines.
if (isPRE)
{
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char newlineChar = '\n';
while (unicodeBuf && (pos != -1) && ((PRUint32)pos < tString.Length()))
{
@@ -638,10 +638,10 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
// is it a return?
- if (subStr.EqualsWithConversion("\n"))
+ if (subStr.Equals(newlineStr))
{
if (nsIPlaintextEditor::eEditorSingleLineMask & mFlags)
{
@@ -662,6 +662,8 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
}
else
{
+ NS_NAMED_LITERAL_STRING(tabStr, "\t");
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char specialChars[] = {'\t','\n',0};
nsAutoString tabString; tabString.AssignWithConversion(" ");
while (unicodeBuf && (pos != -1) && ((PRUint32)pos < tString.Length()))
@@ -683,16 +685,16 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
// is it a tab?
- if (subStr.EqualsWithConversion("\t"))
+ if (subStr.Equals(tabStr))
{
res = mEditor->InsertTextImpl(tabString, address_of(curNode), &curOffset, doc);
pos++;
}
// is it a return?
- else if (subStr.EqualsWithConversion("\n"))
+ else if (subStr.Equals(newlineStr))
{
res = mEditor->CreateBRImpl(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
pos++;
diff --git a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp
index ee029c35ee6..9d2299816e8 100644
--- a/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp
+++ b/mozilla/editor/libeditor/html/nsHTMLEditRules.cpp
@@ -1059,7 +1059,6 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
// dont spaz my selection in subtransactions
nsAutoTxnsConserveSelection dontSpazMySelection(mHTMLEditor);
- nsSubsumeStr subStr;
nsAutoString tString(*inString);
const PRUnichar *unicodeBuf = tString.get();
nsCOMPtr unused;
@@ -1070,6 +1069,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
// it is to search for both tabs and newlines.
if (isPRE || bPlaintext)
{
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char newlineChar = '\n';
while (unicodeBuf && (pos != -1) && (pos < (PRInt32)(*inString).Length()))
{
@@ -1090,10 +1090,10 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
// is it a return?
- if (subStr.EqualsWithConversion("\n"))
+ if (subStr.Equals(newlineStr))
{
res = mHTMLEditor->CreateBRImpl(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
pos++;
@@ -1107,6 +1107,8 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
}
else
{
+ NS_NAMED_LITERAL_STRING(tabStr, "\t");
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char specialChars[] = {'\t','\n',0};
nsAutoString tabString; tabString.AssignWithConversion(" ");
while (unicodeBuf && (pos != -1) && (pos < (PRInt32)inString->Length()))
@@ -1128,12 +1130,12 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
nsWSRunObject wsObj(mHTMLEditor, curNode, curOffset);
// is it a tab?
- if (subStr.EqualsWithConversion("\t"))
+ if (subStr.Equals(tabStr))
{
// res = mHTMLEditor->InsertTextImpl(tabString, address_of(curNode), &curOffset, doc);
res = wsObj.InsertText(tabString, address_of(curNode), &curOffset, doc);
@@ -1141,7 +1143,7 @@ nsHTMLEditRules::WillInsertText(PRInt32 aAction,
pos++;
}
// is it a return?
- else if (subStr.EqualsWithConversion("\n"))
+ else if (subStr.Equals(newlineStr))
{
// res = mHTMLEditor->CreateBRImpl(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
res = wsObj.InsertBreak(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
diff --git a/mozilla/editor/libeditor/text/nsTextEditRules.cpp b/mozilla/editor/libeditor/text/nsTextEditRules.cpp
index 54ff4c7c30f..c280ff32c7a 100644
--- a/mozilla/editor/libeditor/text/nsTextEditRules.cpp
+++ b/mozilla/editor/libeditor/text/nsTextEditRules.cpp
@@ -607,7 +607,6 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
// dont spaz my selection in subtransactions
nsAutoTxnsConserveSelection dontSpazMySelection(mEditor);
- nsSubsumeStr subStr;
nsString tString(*outString);
const PRUnichar *unicodeBuf = tString.get();
nsCOMPtr unused;
@@ -618,6 +617,7 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
// it is to search for both tabs and newlines.
if (isPRE)
{
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char newlineChar = '\n';
while (unicodeBuf && (pos != -1) && ((PRUint32)pos < tString.Length()))
{
@@ -638,10 +638,10 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
// is it a return?
- if (subStr.EqualsWithConversion("\n"))
+ if (subStr.Equals(newlineStr))
{
if (nsIPlaintextEditor::eEditorSingleLineMask & mFlags)
{
@@ -662,6 +662,8 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
}
else
{
+ NS_NAMED_LITERAL_STRING(tabStr, "\t");
+ NS_NAMED_LITERAL_STRING(newlineStr, "\n");
char specialChars[] = {'\t','\n',0};
nsAutoString tabString; tabString.AssignWithConversion(" ");
while (unicodeBuf && (pos != -1) && ((PRUint32)pos < tString.Length()))
@@ -683,16 +685,16 @@ nsTextEditRules::WillInsertText(PRInt32 aAction,
pos = tString.Length();
}
- subStr.Subsume((PRUnichar*)&unicodeBuf[oldPos], PR_FALSE, subStrLen);
+ nsDependentSubstring subStr(tString, oldPos, subStrLen);
// is it a tab?
- if (subStr.EqualsWithConversion("\t"))
+ if (subStr.Equals(tabStr))
{
res = mEditor->InsertTextImpl(tabString, address_of(curNode), &curOffset, doc);
pos++;
}
// is it a return?
- else if (subStr.EqualsWithConversion("\n"))
+ else if (subStr.Equals(newlineStr))
{
res = mEditor->CreateBRImpl(address_of(curNode), &curOffset, address_of(unused), nsIEditor::eNone);
pos++;
diff --git a/mozilla/layout/html/tests/TestCSSPropertyLookup.cpp b/mozilla/layout/html/tests/TestCSSPropertyLookup.cpp
index d414466718c..1fb9abc5742 100644
--- a/mozilla/layout/html/tests/TestCSSPropertyLookup.cpp
+++ b/mozilla/layout/html/tests/TestCSSPropertyLookup.cpp
@@ -51,7 +51,7 @@ int TestProps() {
PL_strcpy(tagName, *et);
index = nsCSSProperty(PRInt32(index) + 1);
- id = nsCSSProps::LookupProperty(nsSubsumeCStr(tagName, PR_FALSE));
+ id = nsCSSProps::LookupProperty(nsCString(tagName));
if (id == eCSSProperty_UNKNOWN) {
printf("bug: can't find '%s'\n", tagName);
rv = -1;
@@ -118,7 +118,7 @@ int TestKeywords() {
}
index = nsCSSKeyword(PRInt32(index) + 1);
- id = nsCSSKeywords::LookupKeyword(nsSubsumeCStr(tagName, PR_FALSE));
+ id = nsCSSKeywords::LookupKeyword(nsCString(tagName));
if (id <= eCSSKeyword_UNKNOWN) {
printf("bug: can't find '%s'\n", tagName);
rv = -1;
@@ -132,7 +132,7 @@ int TestKeywords() {
if (('a' <= tagName[0]) && (tagName[0] <= 'z')) {
tagName[0] = tagName[0] - 32;
}
- id = nsCSSKeywords::LookupKeyword(nsSubsumeCStr(tagName, PR_FALSE));
+ id = nsCSSKeywords::LookupKeyword(nsCString(tagName));
if (id <= eCSSKeyword_UNKNOWN) {
printf("bug: can't find '%s'\n", tagName);
rv = -1;
diff --git a/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp b/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp
index 3d560524cb3..a13cdef8bd6 100644
--- a/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mozilla/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -409,7 +409,7 @@ void nsImapServerResponseParser::ProcessOkCommand(const char *commandToken)
if (fZeroLengthMessageUidString.Length())
{
// "Deleting zero length message");
- fServerConnection.Store(fZeroLengthMessageUidString, "+Flags (\\Deleted)", PR_TRUE);
+ fServerConnection.Store(fZeroLengthMessageUidString.get(), "+Flags (\\Deleted)", PR_TRUE);
if (LastCommandSuccessful())
fServerConnection.Expunge();
@@ -1287,11 +1287,11 @@ void nsImapServerResponseParser::envelope_data()
headerLine += ": ";
if (EnvelopeTable[tableIndex].type == envelopeString)
{
- char *strValue = CreateNilString();
+ nsXPIDLCString strValue;
+ strValue.Adopt(CreateNilString());
if (strValue)
{
- nsSubsumeCStr str(strValue, PR_TRUE);
- headerLine += str;
+ headerLine.Append(strValue);
}
else
headerNonNil = PR_FALSE;
@@ -1326,7 +1326,8 @@ void nsImapServerResponseParser::xaolenvelope_data()
{
fNextToken = GetNextToken();
fNextToken++; // eat '('
- nsSubsumeCStr subject(CreateNilString(), PR_TRUE);
+ nsXPIDLCString subject;
+ subject.Adopt(CreateNilString());
nsCAutoString subjectLine("Subject: ");
subjectLine += subject;
fServerConnection.HandleMessageDownLoadLine(subjectLine.get(), PR_FALSE);
diff --git a/mozilla/mailnews/mime/src/mimetpla.cpp b/mozilla/mailnews/mime/src/mimetpla.cpp
index 23874d15acf..705dc0c445b 100644
--- a/mozilla/mailnews/mime/src/mimetpla.cpp
+++ b/mozilla/mailnews/mime/src/mimetpla.cpp
@@ -29,6 +29,8 @@
#include "nsCOMPtr.h"
#include "nsIComponentManager.h"
#include "nsString.h"
+#include "nsXPIDLString.h"
+#include "nsReadableUtils.h"
#include "nsMimeStringResources.h"
#include "mimemoz2.h"
#include "nsIServiceManager.h"
@@ -376,18 +378,15 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
is always ASCII and I save 2 conversions this way. */
// Convert to HTML
- PRUnichar* citeTagsResultUnichar = nsnull;
+ nsXPIDLString citeTagsResultUnichar;
rv = conv->ScanTXT(citeTagsSource.get(), 0 /* no recognition */,
- &citeTagsResultUnichar);
+ getter_Copies(citeTagsResultUnichar));
if (NS_FAILED(rv)) return -1;
// Convert to char* and write out
- nsSubsumeStr citeTagsResultStr(citeTagsResultUnichar,
- PR_TRUE /* assume ownership */);
- char* citeTagsResultCStr = citeTagsResultStr.ToNewCString();
-
+ nsCAutoString citeTagsResultCStr;
+ CopyUCS2toASCII(citeTagsResultUnichar, citeTagsResultCStr);
prefaceResultStr += citeTagsResultCStr;
- Recycle(citeTagsResultCStr);
if (!plainHTML)
prefaceResultStr += "";
}
@@ -412,13 +411,13 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
/* This is the main TXT to HTML conversion:
escaping (very important), eventually recognizing etc. */
- PRUnichar* lineResultUnichar = nsnull;
+ nsXPIDLString lineResultUnichar;
if (obj->options->format_out != nsMimeOutput::nsMimeMessageSaveAs ||
!mailCharset || !nsMsgI18Nstateful_charset(mailCharset))
{
rv = conv->ScanTXT(lineSourceStr.get() + logicalLineStart,
- whattodo, &lineResultUnichar);
+ whattodo, getter_Copies(lineResultUnichar));
if (NS_FAILED(rv)) return -1;
}
else
@@ -432,19 +431,17 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
rv = nsMsgI18NConvertToUnicode(mailCharsetStr, cstr, ustr);
if (NS_SUCCEEDED(rv))
{
- PRUnichar *u;
- rv = conv->ScanTXT(ustr.get() + logicalLineStart, whattodo, &u);
+ nsXPIDLString u;
+ rv = conv->ScanTXT(ustr.get() + logicalLineStart, whattodo, getter_Copies(u));
if (NS_SUCCEEDED(rv))
{
ustr.Assign(u);
- Recycle(u);
rv = nsMsgI18NConvertFromUnicode(mailCharsetStr, ustr, cstr);
if (NS_SUCCEEDED(rv))
{
// create PRUnichar* which contains NON unicode
// as the following code expecting it
- ustr.AssignWithConversion(cstr);
- lineResultUnichar = ustr.ToNewUnicode();
+ lineResultUnichar.Adopt(ToNewUnicode(cstr));
if (!lineResultUnichar) return -1;
}
}
@@ -454,21 +451,14 @@ MimeInlineTextPlain_parse_line (char *line, PRInt32 length, MimeObject *obj)
}
- // avoid an extra string copy by using nsSubsumeStr, this transfers
- // ownership of wresult to strresult so don't try to free wresult later.
- nsSubsumeStr lineResultStr(lineResultUnichar,
- PR_TRUE /* assume ownership */);
-
if (!(text->mIsSig && quoting))
{
- char* tmp = prefaceResultStr.ToNewCString();
- status = MimeObject_write(obj, tmp, prefaceResultStr.Length(), PR_TRUE);
+ status = MimeObject_write(obj, NS_CONST_CAST(char*, prefaceResultStr.get()), prefaceResultStr.Length(), PR_TRUE);
if (status < 0) return status;
- Recycle(tmp);
- tmp = lineResultStr.ToNewCString();
- status = MimeObject_write(obj, tmp, lineResultStr.Length(), PR_TRUE);
+ nsCAutoString lineResultCStr;
+ CopyUCS2toASCII(lineResultUnichar, lineResultCStr);
+ status = MimeObject_write(obj, NS_CONST_CAST(char*, lineResultCStr.get()), lineResultCStr.Length(), PR_TRUE);
if (status < 0) return status;
- Recycle(tmp);
}
else
{
diff --git a/mozilla/modules/libreg/xpcom/nsRegistry.cpp b/mozilla/modules/libreg/xpcom/nsRegistry.cpp
index 885ce2eda43..5e4438cb899 100644
--- a/mozilla/modules/libreg/xpcom/nsRegistry.cpp
+++ b/mozilla/modules/libreg/xpcom/nsRegistry.cpp
@@ -642,15 +642,7 @@ NS_IMETHODIMP nsRegistry::AddKey( nsRegistryKey baseKey, const PRUnichar *keynam
if ( !keyname )
return NS_ERROR_NULL_POINTER;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,keyname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = AddSubtree( baseKey, utf8name, _retval );
-
- Recycle( utf8name );
- return rv;
+ return AddSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get(), _retval );
}
/*--------------------------- nsRegistry::GetKey -------------------------------
@@ -661,15 +653,7 @@ NS_IMETHODIMP nsRegistry::GetKey(nsRegistryKey baseKey, const PRUnichar *keyname
if ( !keyname || !_retval )
return NS_ERROR_NULL_POINTER;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,keyname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = GetSubtree( baseKey, utf8name, _retval );
-
- Recycle( utf8name );
- return rv;
+ return GetSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get(), _retval );
}
/*--------------------------- nsRegistry::RemoveKey ----------------------------
@@ -680,44 +664,28 @@ NS_IMETHODIMP nsRegistry::RemoveKey(nsRegistryKey baseKey, const PRUnichar *keyn
if ( !keyname )
return NS_ERROR_NULL_POINTER;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,keyname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = RemoveSubtree( baseKey, utf8name );
-
- Recycle( utf8name );
- return rv;
+ return RemoveSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get() );
}
NS_IMETHODIMP nsRegistry::GetString(nsRegistryKey baseKey, const PRUnichar *valname, PRUnichar **_retval)
{
- nsresult rv = NS_OK;
-
// Make sure caller gave us place for result.
if ( !valname || !_retval )
return NS_ERROR_NULL_POINTER;
// initialize the return value
*_retval = nsnull;
- char *tmpstr = nsnull;
+ nsXPIDLCString tmpstr;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,valname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
+ nsresult rv = GetStringUTF8( baseKey, NS_ConvertUCS2toUTF8(valname).get(), getter_Copies(tmpstr) );
- rv = GetStringUTF8( baseKey, utf8name, &tmpstr );
if (NS_SUCCEEDED(rv))
{
- *_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr );
- nsCRT::free(tmpstr);
+ *_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr.get() );
if ( *_retval == nsnull )
rv = NS_ERROR_OUT_OF_MEMORY;
}
- Recycle( utf8name );
return rv;
}
@@ -726,22 +694,9 @@ NS_IMETHODIMP nsRegistry::SetString(nsRegistryKey baseKey, const PRUnichar *valn
if ( !valname || ! value )
return NS_ERROR_NULL_POINTER;
- nsresult rv = NS_OK;
-
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,valname), PR_FALSE ) );
- nsString val( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,value), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- char* utf8val = val.ToNewUTF8String();
-
- if ( utf8name && utf8val )
- rv = SetStringUTF8( baseKey, utf8name, utf8val );
- else
- rv = NS_ERROR_OUT_OF_MEMORY;
-
- if ( utf8name ) Recycle(utf8name);
- if ( utf8val ) Recycle(utf8val);
-
- return rv;
+ return SetStringUTF8( baseKey,
+ NS_ConvertUCS2toUTF8(valname).get(),
+ NS_ConvertUCS2toUTF8(value).get() );
}
/*--------------------------- nsRegistry::GetString ----------------------------
diff --git a/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp b/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
index e8535350013..24642fbc0df 100644
--- a/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -194,7 +194,7 @@ mozTXTToHTMLConv::FindURLStart(const PRUnichar * aInString, PRInt32 aInLength,
}
case RFC2396E:
{
- nsString temp (nsSubsumeStr( (PRUnichar *) aInString, PR_FALSE, aInLength));
+ nsString temp(aInString, aInLength);
PRInt32 i = pos <= 0 ? kNotFound : temp.RFindCharInSet("<>\"", pos - 1);
if (i != kNotFound && (temp[PRUint32(i)] == '<' ||
temp[PRUint32(i)] == '"'))
@@ -267,7 +267,7 @@ mozTXTToHTMLConv::FindURLEnd(const PRUnichar * aInString, PRInt32 aInStringLengt
case RFC1738:
case RFC2396E:
{
- nsString temp (nsSubsumeStr( (PRUnichar *) aInString, PR_FALSE, aInStringLength));
+ nsString temp(aInString, aInStringLength);
PRInt32 i = temp.FindCharInSet("<>\"", pos + 1);
if (i != kNotFound && temp[PRUint32(i--)] ==
diff --git a/mozilla/string/obsolete/nsString.cpp b/mozilla/string/obsolete/nsString.cpp
index d7b0ee753e0..bf62e92ffa5 100644
--- a/mozilla/string/obsolete/nsString.cpp
+++ b/mozilla/string/obsolete/nsString.cpp
@@ -48,26 +48,6 @@ nsCString::GetFlatBufferHandle() const
return NS_REINTERPRET_CAST(const nsBufferHandle*, 1);
}
-static void CSubsume(nsStr& aDest,nsStr& aSource){
- if(aSource.mStr && aSource.mLength) {
- if(aSource.mOwnsBuffer){
- nsStr::Destroy(aDest);
- aDest.mStr=aSource.mStr;
- aDest.mLength=aSource.mLength;
- aDest.mCharSize=aSource.mCharSize;
- aDest.mCapacity=aSource.mCapacity;
- aDest.mOwnsBuffer=aSource.mOwnsBuffer;
- aSource.mOwnsBuffer=PR_FALSE;
- aSource.mStr=0;
- }
- else{
- nsStr::StrAssign(aDest,aSource,0,aSource.mLength);
- }
- }
- else nsStr::StrTruncate(aDest,0);
-}
-
-
/**
* Default constructor.
*/
@@ -124,15 +104,6 @@ nsCString::nsCString(const nsCString& aString) {
StrAssign(*this,aString,0,aString.mLength);
}
-/**
- * construct from subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-nsCString::nsCString(nsSubsumeCStr& aSubsumeStr) {
- CSubsume(*this,aSubsumeStr);
-}
-
/**
* Destructor
*/
@@ -1573,21 +1544,6 @@ nsCAutoString::nsCAutoString(PRUnichar aChar) : nsCString(){
#endif
-/**
- * construct from a subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
-nsCAutoString::nsCAutoString(const nsSubsumeCStr& aSubsumeStr) :nsCString() {
- nsSubsumeCStr temp(aSubsumeStr); // a temp is needed for the AIX and VAC++ compilers
- CSubsume(*this,temp);
-#else
-nsCAutoString::nsCAutoString( nsSubsumeCStr& aSubsumeStr) :nsCString() {
- CSubsume(*this,aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-}
-
/**
* deconstructor
* @param
@@ -1600,22 +1556,3 @@ void nsCAutoString::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
*aResult = sizeof(*this) + mCapacity * mCharSize;
}
}
-
-nsSubsumeCStr::nsSubsumeCStr(nsStr& aString) : nsCString() {
- CSubsume(*this,aString);
-}
-
-nsSubsumeCStr::nsSubsumeCStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength) : nsCString() {
- mUStr=aString;
- mCapacity=mLength=(-1==aLength) ? nsCRT::strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-nsSubsumeCStr::nsSubsumeCStr(char* aString,PRBool assumeOwnership,PRInt32 aLength) : nsCString() {
- mStr=aString;
- mCapacity=mLength=(-1==aLength) ? strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-
-
diff --git a/mozilla/string/obsolete/nsString.h b/mozilla/string/obsolete/nsString.h
index d84c7aefa9e..5f5328ebfff 100644
--- a/mozilla/string/obsolete/nsString.h
+++ b/mozilla/string/obsolete/nsString.h
@@ -64,8 +64,6 @@
// for compatibility
-class NS_COM nsSubsumeCStr;
-
class NS_COM nsCString :
public nsAFlatCString,
public nsStr {
@@ -95,12 +93,6 @@ public:
explicit nsCString(const char*);
nsCString(const char*, PRInt32);
- /**
- * This constructor takes a subsumestr
- * @param reference to subsumestr
- */
- explicit nsCString(nsSubsumeCStr& aSubsumeStr);
-
/**
* Destructor
*
@@ -491,13 +483,6 @@ public:
nsCAutoString(const char* aString,PRInt32 aLength);
explicit nsCAutoString(const CBufDescriptor& aBuffer);
-#if defined(AIX) || defined(XP_OS2_VACPP)
- explicit nsCAutoString(const nsSubsumeCStr& aSubsumeStr); // AIX and VAC++ require a const
-#else
- explicit nsCAutoString(nsSubsumeCStr& aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-
-
nsCAutoString& operator=( const nsCAutoString& aString ) { Assign(aString); return *this; }
private:
void operator=( PRUnichar ); // NOT TO BE IMPLEMENTED
@@ -556,36 +541,6 @@ class NS_COM NS_ConvertUCS2toUTF8
operator const char*() const; // use |get()|
};
-
-/***************************************************************
- The subsumestr class is very unusual.
- It differs from a normal string in that it doesn't use normal
- copy semantics when another string is assign to this.
- Instead, it "steals" the contents of the source string.
-
- This is very handy for returning nsString classes as part of
- an operator+(...) for example, in that it cuts down the number
- of copy operations that must occur.
-
- You should probably not use this class unless you really know
- what you're doing.
- ***************************************************************/
-class NS_COM nsSubsumeCStr : public nsCString {
-public:
- explicit nsSubsumeCStr(nsStr& aString);
- nsSubsumeCStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
- nsSubsumeCStr(char* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
-
- nsSubsumeCStr& operator=( const nsSubsumeCStr& aString ) { Assign(aString); return *this; }
- nsSubsumeCStr& operator=( const nsACString& aReadable ) { Assign(aReadable); return *this; }
-//nsSubsumeCStr& operator=( const nsPromiseReadable& aReadable ) { Assign(aReadable); return *this; }
- nsSubsumeCStr& operator=( const char* aPtr ) { Assign(aPtr); return *this; }
- nsSubsumeCStr& operator=( char aChar ) { Assign(aChar); return *this; }
-private:
- void operator=( PRUnichar ); // NOT TO BE IMPLEMENTED
-};
-
-
#endif
diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp
index 4e856c13636..f035e9a9ba1 100644
--- a/mozilla/string/obsolete/nsString2.cpp
+++ b/mozilla/string/obsolete/nsString2.cpp
@@ -45,28 +45,6 @@ nsString::GetFlatBufferHandle() const
return NS_REINTERPRET_CAST(const nsBufferHandle*, 1);
}
-
-
-static void Subsume(nsStr& aDest,nsStr& aSource){
- if(aSource.mStr && aSource.mLength) {
- if(aSource.mOwnsBuffer){
- nsStr::Destroy(aDest);
- aDest.mStr=aSource.mStr;
- aDest.mLength=aSource.mLength;
- aDest.mCharSize=aSource.mCharSize;
- aDest.mCapacity=aSource.mCapacity;
- aDest.mOwnsBuffer=aSource.mOwnsBuffer;
- aSource.mOwnsBuffer=PR_FALSE;
- aSource.mStr=0;
- }
- else{
- nsStr::StrAssign(aDest,aSource,0,aSource.mLength);
- }
- }
- else nsStr::StrTruncate(aDest,0);
-}
-
-
/**
* Default constructor.
*/
@@ -100,25 +78,6 @@ nsString::nsString(const nsString& aString) {
StrAssign(*this,aString,0,aString.mLength);
}
-/**
- * construct from subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
-nsString::nsString(const nsSubsumeStr& aSubsumeStr) {
- Initialize(*this,eTwoByte);
-
- nsSubsumeStr temp(aSubsumeStr); // a temp is needed for the AIX and VAC++ compilers
- Subsume(*this,temp);
-#else
-nsString::nsString(nsSubsumeStr& aSubsumeStr) {
- Initialize(*this,eTwoByte);
-
- Subsume(*this,aSubsumeStr);
-#endif /* AIX || XP_OS2_VACPP */
-}
-
/**
* Destructor
* Make sure we call nsStr::Destroy.
@@ -1870,21 +1829,6 @@ nsAutoString::nsAutoString(PRUnichar aChar) : nsString(){
Append(aChar);
}
-/**
- * construct from a subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
-nsAutoString::nsAutoString(const nsSubsumeStr& aSubsumeStr) :nsString() {
- nsSubsumeStr temp(aSubsumeStr); // a temp is needed for the AIX and VAC++ compilers
- Subsume(*this,temp);
-#else
-nsAutoString::nsAutoString( nsSubsumeStr& aSubsumeStr) :nsString() {
- Subsume(*this,aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-}
-
/**
* deconstruct the autstring
* @param
@@ -1898,32 +1842,3 @@ void nsAutoString::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const {
}
}
-nsSubsumeStr::nsSubsumeStr() : nsString() {
-}
-
-nsSubsumeStr::nsSubsumeStr(nsStr& aString) : nsString() {
- ::Subsume(*this,aString);
-}
-
-nsSubsumeStr::nsSubsumeStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength) : nsString() {
- mUStr=aString;
- mCharSize=eTwoByte;
- mCapacity=mLength=(-1==aLength) ? nsCRT::strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-nsSubsumeStr::nsSubsumeStr(char* aString,PRBool assumeOwnership,PRInt32 aLength) : nsString() {
- mStr=aString;
- mCharSize=eOneByte;
- mCapacity=mLength=(-1==aLength) ? strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-int nsSubsumeStr::Subsume(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength) {
- mUStr=aString;
- mCharSize=eTwoByte;
- mCapacity=mLength=(-1==aLength) ? nsCRT::strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
- return 0;
-}
-
diff --git a/mozilla/string/obsolete/nsString2.h b/mozilla/string/obsolete/nsString2.h
index 67c16e35372..2443f0d3ef3 100644
--- a/mozilla/string/obsolete/nsString2.h
+++ b/mozilla/string/obsolete/nsString2.h
@@ -67,8 +67,6 @@ class nsISizeOfHandler;
#define nsString2 nsString
#define nsAutoString2 nsAutoString
-class NS_COM nsSubsumeStr;
-
class NS_COM nsString :
public nsAFlatString,
public nsStr {
@@ -99,16 +97,6 @@ public:
nsString(const PRUnichar*, PRInt32);
- /**
- * This constructor takes a subsumestr
- * @param reference to subsumestr
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
- explicit nsString(const nsSubsumeStr& aSubsumeStr); // AIX and VAC++ require a const here
-#else
- explicit nsString(nsSubsumeStr& aSubsumeStr);
-#endif
-
/**
* Destructor
*
@@ -568,13 +556,6 @@ public:
explicit nsAutoString(PRUnichar aChar);
explicit nsAutoString(const CBufDescriptor& aBuffer);
-#if defined(AIX) || defined(XP_OS2_VACPP)
- explicit nsAutoString(const nsSubsumeStr& aSubsumeStr); // AIX and VAC++ requires a const
-#else
- explicit nsAutoString(nsSubsumeStr& aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-
-
nsAutoString& operator=( const nsAutoString& aString ) { Assign(aString); return *this; }
private:
void operator=( char ); // NOT TO BE IMPLEMENTED
@@ -646,37 +627,6 @@ class NS_COM NS_ConvertUTF8toUCS2
NS_ConvertUTF8toUCS2( PRUnichar );
};
-/***************************************************************
- The subsumestr class is very unusual.
- It differs from a normal string in that it doesn't use normal
- copy semantics when another string is assign to this.
- Instead, it "steals" the contents of the source string.
-
- This is very handy for returning nsString classes as part of
- an operator+(...) for example, in that it cuts down the number
- of copy operations that must occur.
-
- You should probably not use this class unless you really know
- what you're doing.
- ***************************************************************/
-class NS_COM nsSubsumeStr : public nsString {
-public:
- nsSubsumeStr();
- explicit nsSubsumeStr(nsStr& aString);
- nsSubsumeStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
- nsSubsumeStr(char* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
- int Subsume(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
-
- nsSubsumeStr& operator=( const nsSubsumeStr& aReadable ) { Assign(aReadable); return *this; }
- nsSubsumeStr& operator=( const nsAString& aReadable ) { Assign(aReadable); return *this; }
-//nsSubsumeStr& operator=( const nsPromiseReadable& aReadable ) { Assign(aReadable); return *this; }
- nsSubsumeStr& operator=( const PRUnichar* aPtr ) { Assign(aPtr); return *this; }
- nsSubsumeStr& operator=( PRUnichar aChar ) { Assign(aChar); return *this; }
-private:
- void operator=( char ); // NOT TO BE IMPLEMENTED
-};
-
-
#endif
diff --git a/mozilla/xpcom/components/nsRegistry.cpp b/mozilla/xpcom/components/nsRegistry.cpp
index 885ce2eda43..5e4438cb899 100644
--- a/mozilla/xpcom/components/nsRegistry.cpp
+++ b/mozilla/xpcom/components/nsRegistry.cpp
@@ -642,15 +642,7 @@ NS_IMETHODIMP nsRegistry::AddKey( nsRegistryKey baseKey, const PRUnichar *keynam
if ( !keyname )
return NS_ERROR_NULL_POINTER;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,keyname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = AddSubtree( baseKey, utf8name, _retval );
-
- Recycle( utf8name );
- return rv;
+ return AddSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get(), _retval );
}
/*--------------------------- nsRegistry::GetKey -------------------------------
@@ -661,15 +653,7 @@ NS_IMETHODIMP nsRegistry::GetKey(nsRegistryKey baseKey, const PRUnichar *keyname
if ( !keyname || !_retval )
return NS_ERROR_NULL_POINTER;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,keyname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = GetSubtree( baseKey, utf8name, _retval );
-
- Recycle( utf8name );
- return rv;
+ return GetSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get(), _retval );
}
/*--------------------------- nsRegistry::RemoveKey ----------------------------
@@ -680,44 +664,28 @@ NS_IMETHODIMP nsRegistry::RemoveKey(nsRegistryKey baseKey, const PRUnichar *keyn
if ( !keyname )
return NS_ERROR_NULL_POINTER;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,keyname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
-
- nsresult rv = RemoveSubtree( baseKey, utf8name );
-
- Recycle( utf8name );
- return rv;
+ return RemoveSubtree( baseKey, NS_ConvertUCS2toUTF8(keyname).get() );
}
NS_IMETHODIMP nsRegistry::GetString(nsRegistryKey baseKey, const PRUnichar *valname, PRUnichar **_retval)
{
- nsresult rv = NS_OK;
-
// Make sure caller gave us place for result.
if ( !valname || !_retval )
return NS_ERROR_NULL_POINTER;
// initialize the return value
*_retval = nsnull;
- char *tmpstr = nsnull;
+ nsXPIDLCString tmpstr;
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,valname), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- if ( !utf8name )
- return NS_ERROR_OUT_OF_MEMORY;
+ nsresult rv = GetStringUTF8( baseKey, NS_ConvertUCS2toUTF8(valname).get(), getter_Copies(tmpstr) );
- rv = GetStringUTF8( baseKey, utf8name, &tmpstr );
if (NS_SUCCEEDED(rv))
{
- *_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr );
- nsCRT::free(tmpstr);
+ *_retval = nsTextFormatter::smprintf( widestrFormat, tmpstr.get() );
if ( *_retval == nsnull )
rv = NS_ERROR_OUT_OF_MEMORY;
}
- Recycle( utf8name );
return rv;
}
@@ -726,22 +694,9 @@ NS_IMETHODIMP nsRegistry::SetString(nsRegistryKey baseKey, const PRUnichar *valn
if ( !valname || ! value )
return NS_ERROR_NULL_POINTER;
- nsresult rv = NS_OK;
-
- nsString name( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,valname), PR_FALSE ) );
- nsString val( nsSubsumeStr( NS_CONST_CAST(PRUnichar*,value), PR_FALSE ) );
- char* utf8name = name.ToNewUTF8String();
- char* utf8val = val.ToNewUTF8String();
-
- if ( utf8name && utf8val )
- rv = SetStringUTF8( baseKey, utf8name, utf8val );
- else
- rv = NS_ERROR_OUT_OF_MEMORY;
-
- if ( utf8name ) Recycle(utf8name);
- if ( utf8val ) Recycle(utf8val);
-
- return rv;
+ return SetStringUTF8( baseKey,
+ NS_ConvertUCS2toUTF8(valname).get(),
+ NS_ConvertUCS2toUTF8(value).get() );
}
/*--------------------------- nsRegistry::GetString ----------------------------
diff --git a/mozilla/xpcom/string/obsolete/nsString.cpp b/mozilla/xpcom/string/obsolete/nsString.cpp
index d7b0ee753e0..bf62e92ffa5 100644
--- a/mozilla/xpcom/string/obsolete/nsString.cpp
+++ b/mozilla/xpcom/string/obsolete/nsString.cpp
@@ -48,26 +48,6 @@ nsCString::GetFlatBufferHandle() const
return NS_REINTERPRET_CAST(const nsBufferHandle*, 1);
}
-static void CSubsume(nsStr& aDest,nsStr& aSource){
- if(aSource.mStr && aSource.mLength) {
- if(aSource.mOwnsBuffer){
- nsStr::Destroy(aDest);
- aDest.mStr=aSource.mStr;
- aDest.mLength=aSource.mLength;
- aDest.mCharSize=aSource.mCharSize;
- aDest.mCapacity=aSource.mCapacity;
- aDest.mOwnsBuffer=aSource.mOwnsBuffer;
- aSource.mOwnsBuffer=PR_FALSE;
- aSource.mStr=0;
- }
- else{
- nsStr::StrAssign(aDest,aSource,0,aSource.mLength);
- }
- }
- else nsStr::StrTruncate(aDest,0);
-}
-
-
/**
* Default constructor.
*/
@@ -124,15 +104,6 @@ nsCString::nsCString(const nsCString& aString) {
StrAssign(*this,aString,0,aString.mLength);
}
-/**
- * construct from subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-nsCString::nsCString(nsSubsumeCStr& aSubsumeStr) {
- CSubsume(*this,aSubsumeStr);
-}
-
/**
* Destructor
*/
@@ -1573,21 +1544,6 @@ nsCAutoString::nsCAutoString(PRUnichar aChar) : nsCString(){
#endif
-/**
- * construct from a subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
-nsCAutoString::nsCAutoString(const nsSubsumeCStr& aSubsumeStr) :nsCString() {
- nsSubsumeCStr temp(aSubsumeStr); // a temp is needed for the AIX and VAC++ compilers
- CSubsume(*this,temp);
-#else
-nsCAutoString::nsCAutoString( nsSubsumeCStr& aSubsumeStr) :nsCString() {
- CSubsume(*this,aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-}
-
/**
* deconstructor
* @param
@@ -1600,22 +1556,3 @@ void nsCAutoString::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const
*aResult = sizeof(*this) + mCapacity * mCharSize;
}
}
-
-nsSubsumeCStr::nsSubsumeCStr(nsStr& aString) : nsCString() {
- CSubsume(*this,aString);
-}
-
-nsSubsumeCStr::nsSubsumeCStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength) : nsCString() {
- mUStr=aString;
- mCapacity=mLength=(-1==aLength) ? nsCRT::strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-nsSubsumeCStr::nsSubsumeCStr(char* aString,PRBool assumeOwnership,PRInt32 aLength) : nsCString() {
- mStr=aString;
- mCapacity=mLength=(-1==aLength) ? strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-
-
diff --git a/mozilla/xpcom/string/obsolete/nsString.h b/mozilla/xpcom/string/obsolete/nsString.h
index d84c7aefa9e..5f5328ebfff 100644
--- a/mozilla/xpcom/string/obsolete/nsString.h
+++ b/mozilla/xpcom/string/obsolete/nsString.h
@@ -64,8 +64,6 @@
// for compatibility
-class NS_COM nsSubsumeCStr;
-
class NS_COM nsCString :
public nsAFlatCString,
public nsStr {
@@ -95,12 +93,6 @@ public:
explicit nsCString(const char*);
nsCString(const char*, PRInt32);
- /**
- * This constructor takes a subsumestr
- * @param reference to subsumestr
- */
- explicit nsCString(nsSubsumeCStr& aSubsumeStr);
-
/**
* Destructor
*
@@ -491,13 +483,6 @@ public:
nsCAutoString(const char* aString,PRInt32 aLength);
explicit nsCAutoString(const CBufDescriptor& aBuffer);
-#if defined(AIX) || defined(XP_OS2_VACPP)
- explicit nsCAutoString(const nsSubsumeCStr& aSubsumeStr); // AIX and VAC++ require a const
-#else
- explicit nsCAutoString(nsSubsumeCStr& aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-
-
nsCAutoString& operator=( const nsCAutoString& aString ) { Assign(aString); return *this; }
private:
void operator=( PRUnichar ); // NOT TO BE IMPLEMENTED
@@ -556,36 +541,6 @@ class NS_COM NS_ConvertUCS2toUTF8
operator const char*() const; // use |get()|
};
-
-/***************************************************************
- The subsumestr class is very unusual.
- It differs from a normal string in that it doesn't use normal
- copy semantics when another string is assign to this.
- Instead, it "steals" the contents of the source string.
-
- This is very handy for returning nsString classes as part of
- an operator+(...) for example, in that it cuts down the number
- of copy operations that must occur.
-
- You should probably not use this class unless you really know
- what you're doing.
- ***************************************************************/
-class NS_COM nsSubsumeCStr : public nsCString {
-public:
- explicit nsSubsumeCStr(nsStr& aString);
- nsSubsumeCStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
- nsSubsumeCStr(char* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
-
- nsSubsumeCStr& operator=( const nsSubsumeCStr& aString ) { Assign(aString); return *this; }
- nsSubsumeCStr& operator=( const nsACString& aReadable ) { Assign(aReadable); return *this; }
-//nsSubsumeCStr& operator=( const nsPromiseReadable& aReadable ) { Assign(aReadable); return *this; }
- nsSubsumeCStr& operator=( const char* aPtr ) { Assign(aPtr); return *this; }
- nsSubsumeCStr& operator=( char aChar ) { Assign(aChar); return *this; }
-private:
- void operator=( PRUnichar ); // NOT TO BE IMPLEMENTED
-};
-
-
#endif
diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp
index 4e856c13636..f035e9a9ba1 100644
--- a/mozilla/xpcom/string/obsolete/nsString2.cpp
+++ b/mozilla/xpcom/string/obsolete/nsString2.cpp
@@ -45,28 +45,6 @@ nsString::GetFlatBufferHandle() const
return NS_REINTERPRET_CAST(const nsBufferHandle*, 1);
}
-
-
-static void Subsume(nsStr& aDest,nsStr& aSource){
- if(aSource.mStr && aSource.mLength) {
- if(aSource.mOwnsBuffer){
- nsStr::Destroy(aDest);
- aDest.mStr=aSource.mStr;
- aDest.mLength=aSource.mLength;
- aDest.mCharSize=aSource.mCharSize;
- aDest.mCapacity=aSource.mCapacity;
- aDest.mOwnsBuffer=aSource.mOwnsBuffer;
- aSource.mOwnsBuffer=PR_FALSE;
- aSource.mStr=0;
- }
- else{
- nsStr::StrAssign(aDest,aSource,0,aSource.mLength);
- }
- }
- else nsStr::StrTruncate(aDest,0);
-}
-
-
/**
* Default constructor.
*/
@@ -100,25 +78,6 @@ nsString::nsString(const nsString& aString) {
StrAssign(*this,aString,0,aString.mLength);
}
-/**
- * construct from subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
-nsString::nsString(const nsSubsumeStr& aSubsumeStr) {
- Initialize(*this,eTwoByte);
-
- nsSubsumeStr temp(aSubsumeStr); // a temp is needed for the AIX and VAC++ compilers
- Subsume(*this,temp);
-#else
-nsString::nsString(nsSubsumeStr& aSubsumeStr) {
- Initialize(*this,eTwoByte);
-
- Subsume(*this,aSubsumeStr);
-#endif /* AIX || XP_OS2_VACPP */
-}
-
/**
* Destructor
* Make sure we call nsStr::Destroy.
@@ -1870,21 +1829,6 @@ nsAutoString::nsAutoString(PRUnichar aChar) : nsString(){
Append(aChar);
}
-/**
- * construct from a subsumeable string
- * @update gess 1/4/99
- * @param reference to a subsumeString
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
-nsAutoString::nsAutoString(const nsSubsumeStr& aSubsumeStr) :nsString() {
- nsSubsumeStr temp(aSubsumeStr); // a temp is needed for the AIX and VAC++ compilers
- Subsume(*this,temp);
-#else
-nsAutoString::nsAutoString( nsSubsumeStr& aSubsumeStr) :nsString() {
- Subsume(*this,aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-}
-
/**
* deconstruct the autstring
* @param
@@ -1898,32 +1842,3 @@ void nsAutoString::SizeOf(nsISizeOfHandler* aHandler, PRUint32* aResult) const {
}
}
-nsSubsumeStr::nsSubsumeStr() : nsString() {
-}
-
-nsSubsumeStr::nsSubsumeStr(nsStr& aString) : nsString() {
- ::Subsume(*this,aString);
-}
-
-nsSubsumeStr::nsSubsumeStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength) : nsString() {
- mUStr=aString;
- mCharSize=eTwoByte;
- mCapacity=mLength=(-1==aLength) ? nsCRT::strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-nsSubsumeStr::nsSubsumeStr(char* aString,PRBool assumeOwnership,PRInt32 aLength) : nsString() {
- mStr=aString;
- mCharSize=eOneByte;
- mCapacity=mLength=(-1==aLength) ? strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
-}
-
-int nsSubsumeStr::Subsume(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength) {
- mUStr=aString;
- mCharSize=eTwoByte;
- mCapacity=mLength=(-1==aLength) ? nsCRT::strlen(aString) : aLength;
- mOwnsBuffer=assumeOwnership;
- return 0;
-}
-
diff --git a/mozilla/xpcom/string/obsolete/nsString2.h b/mozilla/xpcom/string/obsolete/nsString2.h
index 67c16e35372..2443f0d3ef3 100644
--- a/mozilla/xpcom/string/obsolete/nsString2.h
+++ b/mozilla/xpcom/string/obsolete/nsString2.h
@@ -67,8 +67,6 @@ class nsISizeOfHandler;
#define nsString2 nsString
#define nsAutoString2 nsAutoString
-class NS_COM nsSubsumeStr;
-
class NS_COM nsString :
public nsAFlatString,
public nsStr {
@@ -99,16 +97,6 @@ public:
nsString(const PRUnichar*, PRInt32);
- /**
- * This constructor takes a subsumestr
- * @param reference to subsumestr
- */
-#if defined(AIX) || defined(XP_OS2_VACPP)
- explicit nsString(const nsSubsumeStr& aSubsumeStr); // AIX and VAC++ require a const here
-#else
- explicit nsString(nsSubsumeStr& aSubsumeStr);
-#endif
-
/**
* Destructor
*
@@ -568,13 +556,6 @@ public:
explicit nsAutoString(PRUnichar aChar);
explicit nsAutoString(const CBufDescriptor& aBuffer);
-#if defined(AIX) || defined(XP_OS2_VACPP)
- explicit nsAutoString(const nsSubsumeStr& aSubsumeStr); // AIX and VAC++ requires a const
-#else
- explicit nsAutoString(nsSubsumeStr& aSubsumeStr);
-#endif // AIX || XP_OS2_VACPP
-
-
nsAutoString& operator=( const nsAutoString& aString ) { Assign(aString); return *this; }
private:
void operator=( char ); // NOT TO BE IMPLEMENTED
@@ -646,37 +627,6 @@ class NS_COM NS_ConvertUTF8toUCS2
NS_ConvertUTF8toUCS2( PRUnichar );
};
-/***************************************************************
- The subsumestr class is very unusual.
- It differs from a normal string in that it doesn't use normal
- copy semantics when another string is assign to this.
- Instead, it "steals" the contents of the source string.
-
- This is very handy for returning nsString classes as part of
- an operator+(...) for example, in that it cuts down the number
- of copy operations that must occur.
-
- You should probably not use this class unless you really know
- what you're doing.
- ***************************************************************/
-class NS_COM nsSubsumeStr : public nsString {
-public:
- nsSubsumeStr();
- explicit nsSubsumeStr(nsStr& aString);
- nsSubsumeStr(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
- nsSubsumeStr(char* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
- int Subsume(PRUnichar* aString,PRBool assumeOwnership,PRInt32 aLength=-1);
-
- nsSubsumeStr& operator=( const nsSubsumeStr& aReadable ) { Assign(aReadable); return *this; }
- nsSubsumeStr& operator=( const nsAString& aReadable ) { Assign(aReadable); return *this; }
-//nsSubsumeStr& operator=( const nsPromiseReadable& aReadable ) { Assign(aReadable); return *this; }
- nsSubsumeStr& operator=( const PRUnichar* aPtr ) { Assign(aPtr); return *this; }
- nsSubsumeStr& operator=( PRUnichar aChar ) { Assign(aChar); return *this; }
-private:
- void operator=( char ); // NOT TO BE IMPLEMENTED
-};
-
-
#endif
diff --git a/mozilla/xpcom/tests/windows/nsStringTest.h b/mozilla/xpcom/tests/windows/nsStringTest.h
index 94b1fbae3f7..f600a4fb1f4 100644
--- a/mozilla/xpcom/tests/windows/nsStringTest.h
+++ b/mozilla/xpcom/tests/windows/nsStringTest.h
@@ -1485,13 +1485,6 @@ int CStringTester::TestSubsumables(){
int result=0;
char* buf="hello rick";
-/* NOT WORKING YET...
- nsSubsumeStr s1(buf,PR_FALSE);
- nsString ns1(s1);
-
-// nsSubsumeCStr s2(ns1);
-// nsCString c1(s2);
-*/
return result;
}