diff --git a/mozilla/content/shared/src/nsHTMLUtils.cpp b/mozilla/content/shared/src/nsHTMLUtils.cpp
index 3f29cb000e9..140b89bb308 100644
--- a/mozilla/content/shared/src/nsHTMLUtils.cpp
+++ b/mozilla/content/shared/src/nsHTMLUtils.cpp
@@ -149,7 +149,8 @@ NS_MakeAbsoluteURIWithCharset(char* *aResult,
spec.Append(buf);
}
else {
- spec.AppendWithConversion(*uch);
+ // it's ascii, so we're safe
+ spec.Append(char(*uch));
}
}
}
diff --git a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp
index 731c5cbb321..e430917c1eb 100644
--- a/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp
+++ b/mozilla/content/xbl/src/nsXBLPrototypeBinding.cpp
@@ -585,8 +585,8 @@ nsXBLPrototypeBinding::AttributeChanged(nsIAtom* aAttribute, PRInt32 aNameSpaceI
// children of the real element and get the text nodes' values.
if (aAttribute == nsXBLAtoms::xbltext) {
nsXBLBinding::GetTextData(aChangedElement, value);
- value.StripChar('\n');
- value.StripChar('\r');
+ value.StripChar(PRUnichar('\n'));
+ value.StripChar(PRUnichar('\r'));
nsAutoString stripVal(value);
stripVal.StripWhitespace();
if (stripVal.IsEmpty())
@@ -1070,8 +1070,8 @@ PRBool PR_CALLBACK SetAttrs(nsHashKey* aKey, void* aData, void* aClosure)
PRBool attrPresent = PR_TRUE;
if (src == nsXBLAtoms::xbltext) {
nsXBLBinding::GetTextData(changeData->mBoundElement, value);
- value.StripChar('\n');
- value.StripChar('\r');
+ value.StripChar(PRUnichar('\n'));
+ value.StripChar(PRUnichar('\r'));
nsAutoString stripVal(value);
stripVal.StripWhitespace();
diff --git a/mozilla/content/xbl/src/nsXBLService.cpp b/mozilla/content/xbl/src/nsXBLService.cpp
index 9e506845293..9991a8b9770 100644
--- a/mozilla/content/xbl/src/nsXBLService.cpp
+++ b/mozilla/content/xbl/src/nsXBLService.cpp
@@ -647,7 +647,7 @@ nsXBLService::LoadBindings(nsIContent* aContent, const nsAReadableString& aURL,
// See if the URIs match.
nsCAutoString uri;
styleBinding->GetBindingURI(uri);
- if (uri.EqualsWithConversion((const PRUnichar *) PromiseFlatString(aURL).get()))
+ if (uri.EqualsWithConversion(NS_ConvertUCS2toUTF8(aURL).get()))
return NS_OK;
else {
FlushStyleBindings(aContent);
diff --git a/mozilla/content/xml/document/src/nsFIXptr.cpp b/mozilla/content/xml/document/src/nsFIXptr.cpp
index 0c47ca4f95d..2e14ac4a0df 100644
--- a/mozilla/content/xml/document/src/nsFIXptr.cpp
+++ b/mozilla/content/xml/document/src/nsFIXptr.cpp
@@ -188,7 +188,7 @@ static nsresult GetRange(
{
nsresult rv = NS_OK;
nsCOMPtr node;
- if (nsString::IsAlpha(aExpression.First())) {
+ if (nsCRT::IsAsciiAlpha(aExpression.First())) {
// name
nsAutoString id;
const nsAutoString expression(aExpression);
diff --git a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
index ebff6db0a44..571d470edfe 100644
--- a/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/mozilla/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -2364,7 +2364,7 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename)
{
const PRInt32 kMaxFileNameLength = 20;
// Unescape the file name (GetFileName escapes it)
- nsString fileName;
+ nsAutoString fileName;
PRInt32 length = 0;
char *p = nsUnescape(nameFromURL);
for (;*p && *p != ';' && *p != '?' && *p != '#' && *p != '.' &&
@@ -2378,7 +2378,7 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename)
#endif
)
{
- fileName.AppendWithConversion(*p);
+ fileName.Append(PRUnichar(*p));
}
}
aFilename = fileName;
diff --git a/mozilla/extensions/cookie/nsUtils.cpp b/mozilla/extensions/cookie/nsUtils.cpp
index dd06423708e..8cb349d1968 100644
--- a/mozilla/extensions/cookie/nsUtils.cpp
+++ b/mozilla/extensions/cookie/nsUtils.cpp
@@ -93,7 +93,7 @@ CKutil_GetLine(nsInputFileStream& strm, nsString& aLine) {
}
if (c != '\r') {
- aLine.AppendWithConversion(c);
+ aLine.Append(PRUnichar(c));
}
}
return 0;
diff --git a/mozilla/extensions/transformiix/source/base/MozillaString.cpp b/mozilla/extensions/transformiix/source/base/MozillaString.cpp
index 7f6ce6c11a8..3e36b688312 100644
--- a/mozilla/extensions/transformiix/source/base/MozillaString.cpp
+++ b/mozilla/extensions/transformiix/source/base/MozillaString.cpp
@@ -187,7 +187,7 @@ void String::append(UNICODE_CHAR source)
//
void String::append(char source)
{
- ptrNSString->AppendWithConversion(source);
+ ptrNSString->Append(PRUnichar(source));
}
//
@@ -538,7 +538,7 @@ MBool String::isEqual(const String& data) const
return MB_FALSE;
else
{
- if (ptrNSString->EqualsWithConversion(data.getConstNSString()) == PR_TRUE)
+ if (ptrNSString->Equals(data.getConstNSString()) == PR_TRUE)
return MB_TRUE;
else
return MB_FALSE;
diff --git a/mozilla/extensions/wallet/src/wallet.cpp b/mozilla/extensions/wallet/src/wallet.cpp
index 72200363696..97b4d9b4444 100644
--- a/mozilla/extensions/wallet/src/wallet.cpp
+++ b/mozilla/extensions/wallet/src/wallet.cpp
@@ -2742,7 +2742,7 @@ wallet_ReleasePrefillElementList(nsVoidArray * wallet_PrefillElement_list) {
}
}
-#define BREAK '\001'
+#define BREAK PRUnichar('\001')
nsVoidArray * wallet_list;
nsAutoString wallet_url;
@@ -2756,15 +2756,15 @@ WLLT_GetPrefillListForViewer(nsString& aPrefillList)
PRInt32 count = LIST_COUNT(wallet_list);
for (PRInt32 i=0; iElementAt(i));
- buffer.AppendWithConversion(BREAK);
+ buffer.Append(BREAK);
buffer.AppendInt(prefillElementPtr->count,10);
- buffer.AppendWithConversion(BREAK);
+ buffer.Append(BREAK);
buffer.Append(NS_ConvertUTF8toUCS2(prefillElementPtr->schema));
- buffer.AppendWithConversion(BREAK);
+ buffer.Append(BREAK);
buffer.Append(prefillElementPtr->value);
}
- buffer.AppendWithConversion(BREAK);
+ buffer.Append(BREAK);
buffer += wallet_url.get();
aPrefillList = buffer;
}
@@ -3016,8 +3016,6 @@ wallet_Capture(nsIDocument* doc, const nsString& field, const nsString& value, n
/* The following are the interface routines seen by other dlls */
/***************************************************************/
-#define BREAK '\001'
-
PUBLIC void
WLLT_GetNopreviewListForViewer(nsString& aNopreviewList)
{
@@ -3030,7 +3028,7 @@ WLLT_GetNopreviewListForViewer(nsString& aNopreviewList)
for (PRInt32 i=0; iElementAt(i));
if (NO_PREVIEW(url->item2) == 'y') {
- buffer.AppendWithConversion(BREAK);
+ buffer.Append(BREAK);
buffer += NS_ConvertUTF8toUCS2(url->item1);
}
}
@@ -3048,7 +3046,7 @@ WLLT_GetNocaptureListForViewer(nsString& aNocaptureList)
for (PRInt32 i=0; iElementAt(i));
if (NO_CAPTURE(url->item2) == 'y') {
- buffer.AppendWithConversion(BREAK);
+ buffer.Append(BREAK);
buffer += NS_ConvertUTF8toUCS2(url->item1);
}
}
@@ -3113,27 +3111,27 @@ PUBLIC void
WLLT_PreEdit(nsString& walletList)
{
wallet_Initialize();
- walletList.AssignWithConversion(BREAK);
+ walletList.Assign(BREAK);
wallet_MapElement * mapElementPtr;
PRInt32 count = LIST_COUNT(wallet_SchemaToValue_list);
for (PRInt32 i=0; iElementAt(i));
walletList += NS_ConvertUTF8toUCS2(mapElementPtr->item1);
- walletList.AppendWithConversion(BREAK);
+ walletList.Append(BREAK);
if (!WALLET_NULL(mapElementPtr->item2)) {
walletList += NS_ConvertUTF8toUCS2(mapElementPtr->item2);
- walletList.AppendWithConversion(BREAK);
+ walletList.Append(BREAK);
} else {
wallet_Sublist * sublistPtr;
PRInt32 count2 = LIST_COUNT(mapElementPtr->itemList);
for (PRInt32 i2=0; i2itemList->ElementAt(i2));
walletList += NS_ConvertUTF8toUCS2(sublistPtr->item);
- walletList.AppendWithConversion(BREAK);
+ walletList.Append(BREAK);
}
}
- walletList.AppendWithConversion(BREAK);
+ walletList.Append(BREAK);
}
}
@@ -3545,7 +3543,7 @@ WLLT_PrefillOneElement
value,
selectIndex,
index))) {
- compositeValue.AppendWithConversion(BREAK);
+ compositeValue.Append(BREAK);
compositeValue.Append(value);
}
}
diff --git a/mozilla/extensions/xmlextras/pointers/src/nsFIXptr.cpp b/mozilla/extensions/xmlextras/pointers/src/nsFIXptr.cpp
index 0c47ca4f95d..2e14ac4a0df 100644
--- a/mozilla/extensions/xmlextras/pointers/src/nsFIXptr.cpp
+++ b/mozilla/extensions/xmlextras/pointers/src/nsFIXptr.cpp
@@ -188,7 +188,7 @@ static nsresult GetRange(
{
nsresult rv = NS_OK;
nsCOMPtr node;
- if (nsString::IsAlpha(aExpression.First())) {
+ if (nsCRT::IsAsciiAlpha(aExpression.First())) {
// name
nsAutoString id;
const nsAutoString expression(aExpression);
diff --git a/mozilla/htmlparser/src/nsDTDUtils.cpp b/mozilla/htmlparser/src/nsDTDUtils.cpp
index b6befa40917..49cd54e39c4 100644
--- a/mozilla/htmlparser/src/nsDTDUtils.cpp
+++ b/mozilla/htmlparser/src/nsDTDUtils.cpp
@@ -597,7 +597,7 @@ public:
while(expn--) {
ndex = ((root<=aValue) && (root)) ? (aValue/root): 0;
aValue%=root;
- aString.AppendWithConversion(aCharSet[ndex+((root>1)*offset)]);
+ aString.Append(PRUnichar(aCharSet[ndex+((root>1)*offset)]));
root/=base;
}
}
@@ -712,8 +712,14 @@ public:
* @param aString -- will hold result
*/
static void RomanString(PRInt32 aValue,nsString& aString) {
- static char digitsA[] = "ixcm";
- static char digitsB[] = "vld?";
+ static PRUnichar digitsA[] = { PRUnichar('i'),
+ PRUnichar('x'),
+ PRUnichar('c'),
+ PRUnichar('m') };
+ static PRUnichar digitsB[] = { PRUnichar('v'),
+ PRUnichar('l'),
+ PRUnichar('d'),
+ PRUnichar('?') };
aString.Truncate();
if(aValue<0)
@@ -732,20 +738,20 @@ public:
romanPos--;
switch(decStr[digitPos]) {
case '0': break;
- case '3': aString.AppendWithConversion(digitsA[romanPos]);
- case '2': aString.AppendWithConversion(digitsA[romanPos]);
- case '1': aString.AppendWithConversion(digitsA[romanPos]);
+ case '3': aString.Append(digitsA[romanPos]);
+ case '2': aString.Append(digitsA[romanPos]);
+ case '1': aString.Append(digitsA[romanPos]);
break;
- case '4': aString.AppendWithConversion(digitsA[romanPos]);
+ case '4': aString.Append(digitsA[romanPos]);
case '5': case '6':
case '7': case '8':
- aString.AppendWithConversion(digitsB[romanPos]);
+ aString.Append(digitsB[romanPos]);
for(n=0;n<(decStr[digitPos]-'5');n++)
- aString.AppendWithConversion(digitsA[romanPos]);
+ aString.Append(digitsA[romanPos]);
break;
case '9':
- aString.AppendWithConversion(digitsA[romanPos]);
- aString.AppendWithConversion(digitsA[romanPos]);
+ aString.Append(digitsA[romanPos]);
+ aString.Append(digitsA[romanPos]);
break;
}
}
@@ -789,7 +795,7 @@ public:
modChar=aValue-(repCount*seriesLen);
for(count=0;count<=repCount;count++) {
- aString.AppendWithConversion(kFootnoteSet[modChar]);
+ aString.Append(PRUnichar(kFootnoteSet[modChar]));
}
}
diff --git a/mozilla/htmlparser/tests/outsinks/Convert.cpp b/mozilla/htmlparser/tests/outsinks/Convert.cpp
index bd9dd973d7b..75443b23d09 100644
--- a/mozilla/htmlparser/tests/outsinks/Convert.cpp
+++ b/mozilla/htmlparser/tests/outsinks/Convert.cpp
@@ -60,7 +60,7 @@ Compare(nsString& str, nsString& aFileName)
int different = 0;
while ((c = getc(file)) != EOF)
{
- inString.AppendWithConversion((char)c);
+ inString.Append(PRUnichar(c));
// CVS isn't doing newline comparisons on these files for some reason.
// So compensate for possible newline problems in the CVS file:
if (c == '\n' && str[index] == '\r')
@@ -301,7 +301,7 @@ Usage: %s [-i intype] [-o outtype] [-f flags] [-w wrapcol] [-c comparison_file]
nsString inString;
int c;
while ((c = getc(file)) != EOF)
- inString.AppendWithConversion((char)c);
+ inString.Append(PRUnichar(c));
if (file != stdin)
fclose(file);
diff --git a/mozilla/layout/forms/nsFormControlHelper.cpp b/mozilla/layout/forms/nsFormControlHelper.cpp
index bf76f40ec56..104d0ba9826 100644
--- a/mozilla/layout/forms/nsFormControlHelper.cpp
+++ b/mozilla/layout/forms/nsFormControlHelper.cpp
@@ -401,10 +401,10 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
GetRepChars(aPresContext, char1, char2);
int i;
for (i = 0; i < aNumChars; i+=2) {
- val.AppendWithConversion(char1);
+ val.Append(PRUnichar(char1));
}
for (i = 1; i < aNumChars; i+=2) {
- val.AppendWithConversion(char2);
+ val.Append(PRUnichar(char2));
}
return GetTextSize(aPresContext, aFrame, val, aSize, aRendContext);
}
diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp
index da6a368b4d6..135e2afd85b 100644
--- a/mozilla/layout/generic/nsBulletFrame.cpp
+++ b/mozilla/layout/generic/nsBulletFrame.cpp
@@ -454,23 +454,23 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
romanPos--;
addOn.SetLength(0);
switch(*dp) {
- case '3': addOn.AppendWithConversion(achars[romanPos]);
- case '2': addOn.AppendWithConversion(achars[romanPos]);
- case '1': addOn.AppendWithConversion(achars[romanPos]);
+ case '3': addOn.Append(PRUnichar(achars[romanPos]));
+ case '2': addOn.Append(PRUnichar(achars[romanPos]));
+ case '1': addOn.Append(PRUnichar(achars[romanPos]));
break;
case '4':
- addOn.AppendWithConversion(achars[romanPos]);
+ addOn.Append(PRUnichar(achars[romanPos]));
// FALLTHROUGH
case '5': case '6':
case '7': case '8':
- addOn.AppendWithConversion(bchars[romanPos]);
+ addOn.Append(PRUnichar(bchars[romanPos]));
for(n=0;n<(*dp-'5');n++) {
- addOn.AppendWithConversion(achars[romanPos]);
+ addOn.Append(PRUnichar(achars[romanPos]));
}
break;
case '9':
- addOn.AppendWithConversion(achars[romanPos]);
- addOn.AppendWithConversion(achars[romanPos+1]);
+ addOn.Append(PRUnichar(achars[romanPos]));
+ addOn.Append(PRUnichar(achars[romanPos+1]));
break;
default:
break;
diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp
index da6a368b4d6..135e2afd85b 100644
--- a/mozilla/layout/html/base/src/nsBulletFrame.cpp
+++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp
@@ -454,23 +454,23 @@ static void RomanToText(PRInt32 ordinal, nsString& result, const char* achars, c
romanPos--;
addOn.SetLength(0);
switch(*dp) {
- case '3': addOn.AppendWithConversion(achars[romanPos]);
- case '2': addOn.AppendWithConversion(achars[romanPos]);
- case '1': addOn.AppendWithConversion(achars[romanPos]);
+ case '3': addOn.Append(PRUnichar(achars[romanPos]));
+ case '2': addOn.Append(PRUnichar(achars[romanPos]));
+ case '1': addOn.Append(PRUnichar(achars[romanPos]));
break;
case '4':
- addOn.AppendWithConversion(achars[romanPos]);
+ addOn.Append(PRUnichar(achars[romanPos]));
// FALLTHROUGH
case '5': case '6':
case '7': case '8':
- addOn.AppendWithConversion(bchars[romanPos]);
+ addOn.Append(PRUnichar(bchars[romanPos]));
for(n=0;n<(*dp-'5');n++) {
- addOn.AppendWithConversion(achars[romanPos]);
+ addOn.Append(PRUnichar(achars[romanPos]));
}
break;
case '9':
- addOn.AppendWithConversion(achars[romanPos]);
- addOn.AppendWithConversion(achars[romanPos+1]);
+ addOn.Append(PRUnichar(achars[romanPos]));
+ addOn.Append(PRUnichar(achars[romanPos+1]));
break;
default:
break;
diff --git a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp
index bf76f40ec56..104d0ba9826 100644
--- a/mozilla/layout/html/forms/src/nsFormControlHelper.cpp
+++ b/mozilla/layout/html/forms/src/nsFormControlHelper.cpp
@@ -401,10 +401,10 @@ nsFormControlHelper::GetTextSize(nsIPresContext* aPresContext, nsIFormControlFra
GetRepChars(aPresContext, char1, char2);
int i;
for (i = 0; i < aNumChars; i+=2) {
- val.AppendWithConversion(char1);
+ val.Append(PRUnichar(char1));
}
for (i = 1; i < aNumChars; i+=2) {
- val.AppendWithConversion(char2);
+ val.Append(PRUnichar(char2));
}
return GetTextSize(aPresContext, aFrame, val, aSize, aRendContext);
}
diff --git a/mozilla/mailnews/absync/src/nsAbSync.cpp b/mozilla/mailnews/absync/src/nsAbSync.cpp
index 1fd81a1e5f2..78aebb53c4a 100644
--- a/mozilla/mailnews/absync/src/nsAbSync.cpp
+++ b/mozilla/mailnews/absync/src/nsAbSync.cpp
@@ -795,7 +795,10 @@ nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &pro
if (NS_SUCCEEDED(aCard->GetCardValue(mSchemaMappingList[i].abField, &aName)) && (aName) && (*aName))
{
// These are unknown tags we are omitting...
- if (!nsCRT::strncasecmp(mSchemaMappingList[i].serverField, "OMIT:", 5))
+ const nsAString& prefix =
+ Substring(mSchemaMappingList[i].serverField, 0, 5);
+ if (NS_LITERAL_STRING("OMIT:").Equals(prefix,
+ nsCaseInsensitiveStringComparator()))
continue;
// Reset this flag...
@@ -875,7 +878,7 @@ nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &pro
}
tProtLine.Append(NS_LITERAL_STRING("&") +
- NS_ConvertASCIItoUCS2(mSchemaMappingList[i].serverField) +
+ mSchemaMappingList[i].serverField +
NS_LITERAL_STRING("="));
if (utfString)
{
@@ -916,7 +919,7 @@ nsAbSync::GenerateProtocolForCard(nsIAbCard *aCard, PRBool aAddId, nsString &pro
}
tProtLine.Append(NS_LITERAL_STRING("&") +
- NS_ConvertASCIItoUCS2(kServerPlainTextColumn) +
+ kServerPlainTextColumn +
NS_LITERAL_STRING("="));
if (utfString)
{
@@ -2939,15 +2942,15 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag
// Ok, we need to figure out what the tag name from the server maps to and assign
// this value the new nsIAbCard
//
- if (!aTagName->CompareWithConversion(kServerFirstNameColumn))
+ if (aTagName->Equals(kServerFirstNameColumn))
aCard->SetFirstName(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerLastNameColumn))
+ else if (aTagName->Equals(kServerLastNameColumn))
aCard->SetLastName(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerDisplayNameColumn))
+ else if (aTagName->Equals(kServerDisplayNameColumn))
aCard->SetDisplayName(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerNicknameColumn))
+ else if (aTagName->Equals(kServerNicknameColumn))
aCard->SetNickName(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerPriEmailColumn))
+ else if (aTagName->Equals(kServerPriEmailColumn))
{
#ifdef DEBUG_rhp
char *t = ToNewCString(*aTagValue);
@@ -2956,53 +2959,53 @@ nsAbSync::AddValueToNewCard(nsIAbCard *aCard, nsString *aTagName, nsString *aTag
#endif
aCard->SetPrimaryEmail(aTagValue->get());
}
- else if (!aTagName->CompareWithConversion(kServer2ndEmailColumn))
+ else if (aTagName->Equals(kServer2ndEmailColumn))
aCard->SetSecondEmail(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerHomeAddressColumn))
+ else if (aTagName->Equals(kServerHomeAddressColumn))
aCard->SetHomeAddress(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerHomeAddress2Column))
+ else if (aTagName->Equals(kServerHomeAddress2Column))
aCard->SetHomeAddress2(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerHomeCityColumn))
+ else if (aTagName->Equals(kServerHomeCityColumn))
aCard->SetHomeCity(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerHomeStateColumn))
+ else if (aTagName->Equals(kServerHomeStateColumn))
aCard->SetHomeState(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerHomeZipCodeColumn))
+ else if (aTagName->Equals(kServerHomeZipCodeColumn))
aCard->SetHomeZipCode(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerHomeCountryColumn))
+ else if (aTagName->Equals(kServerHomeCountryColumn))
aCard->SetHomeCountry(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWorkAddressColumn))
+ else if (aTagName->Equals(kServerWorkAddressColumn))
aCard->SetWorkAddress(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWorkAddress2Column))
+ else if (aTagName->Equals(kServerWorkAddress2Column))
aCard->SetWorkAddress2(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWorkCityColumn))
+ else if (aTagName->Equals(kServerWorkCityColumn))
aCard->SetWorkCity(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWorkStateColumn))
+ else if (aTagName->Equals(kServerWorkStateColumn))
aCard->SetWorkState(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWorkZipCodeColumn))
+ else if (aTagName->Equals(kServerWorkZipCodeColumn))
aCard->SetWorkZipCode(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWorkCountryColumn))
+ else if (aTagName->Equals(kServerWorkCountryColumn))
aCard->SetWorkCountry(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerJobTitleColumn))
+ else if (aTagName->Equals(kServerJobTitleColumn))
aCard->SetJobTitle(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerNotesColumn))
+ else if (aTagName->Equals(kServerNotesColumn))
aCard->SetNotes(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWebPage1Column))
+ else if (aTagName->Equals(kServerWebPage1Column))
aCard->SetWebPage1(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerDepartmentColumn))
+ else if (aTagName->Equals(kServerDepartmentColumn))
aCard->SetDepartment(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerCompanyColumn))
+ else if (aTagName->Equals(kServerCompanyColumn))
aCard->SetCompany(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerWebPage2Column))
+ else if (aTagName->Equals(kServerWebPage2Column))
aCard->SetWebPage2(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerCustom1Column))
+ else if (aTagName->Equals(kServerCustom1Column))
aCard->SetCustom1(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerCustom2Column))
+ else if (aTagName->Equals(kServerCustom2Column))
aCard->SetCustom2(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerCustom3Column))
+ else if (aTagName->Equals(kServerCustom3Column))
aCard->SetCustom3(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerCustom4Column))
+ else if (aTagName->Equals(kServerCustom4Column))
aCard->SetCustom4(aTagValue->get());
- else if (!aTagName->CompareWithConversion(kServerPlainTextColumn))
+ else if (aTagName->Equals(kServerPlainTextColumn))
{
// This is plain text pref...have to add a little logic.
if (aTagValue->Equals(NS_LITERAL_STRING("1")))
diff --git a/mozilla/mailnews/absync/src/nsAbSync.h b/mozilla/mailnews/absync/src/nsAbSync.h
index 9ea44974746..9789036427c 100644
--- a/mozilla/mailnews/absync/src/nsAbSync.h
+++ b/mozilla/mailnews/absync/src/nsAbSync.h
@@ -144,7 +144,7 @@ typedef struct {
typedef struct {
const char *abField;
- const char *serverField;
+ nsString serverField;
} schemaStruct;
class nsAbSync : public nsIAbSync, public nsIAbSyncPostListener
diff --git a/mozilla/mailnews/absync/src/nsSyncDecoderRing.cpp b/mozilla/mailnews/absync/src/nsSyncDecoderRing.cpp
index a5361be63cf..4e393a049a3 100644
--- a/mozilla/mailnews/absync/src/nsSyncDecoderRing.cpp
+++ b/mozilla/mailnews/absync/src/nsSyncDecoderRing.cpp
@@ -42,45 +42,6 @@
#include "nsEscape.h"
#include "nsSyncDecoderRing.h"
-// Server record fields!
-const char kServerFirstNameColumn[] = "fname";
-const char kServerLastNameColumn[] = "lname";
-const char kServerDisplayNameColumn[] = "Display_name";
-const char kServerNicknameColumn[] = "nick_name";
-const char kServerPriEmailColumn[] = "email1";
-const char kServer2ndEmailColumn[] = "email2";
-const char kServerPlainTextColumn[] = "Pref_rich_email";
-const char kServerWorkPhoneColumn[] = "work_phone";
-const char kServerHomePhoneColumn[] = "home_phone";
-const char kServerFaxColumn[] = "fax";
-const char kServerPagerColumn[] = "pager";
-const char kServerCellularColumn[] = "cell_phone";
-const char kServerHomeAddressColumn[] = "home_add1";
-const char kServerHomeAddress2Column[] = "home_add2";
-const char kServerHomeCityColumn[] = "home_city";
-const char kServerHomeStateColumn[] = "home_state";
-const char kServerHomeZipCodeColumn[] = "home_zip";
-const char kServerHomeCountryColumn[] = "home_country";
-const char kServerWorkAddressColumn[] = "work_add1";
-const char kServerWorkAddress2Column[] = "work_add2";
-const char kServerWorkCityColumn[] = "work_city";
-const char kServerWorkStateColumn[] = "work_state";
-const char kServerWorkZipCodeColumn[] = "work_zip";
-const char kServerWorkCountryColumn[] = "work_country";
-const char kServerJobTitleColumn[] = "job_title";
-const char kServerDepartmentColumn[] = "department";
-const char kServerCompanyColumn[] = "company";
-const char kServerWebPage1Column[] = "Work_web_page";
-const char kServerWebPage2Column[] = "web_page";
-const char kServerBirthYearColumn[] = "OMIT:BirthYear";
-const char kServerBirthMonthColumn[] = "OMIT:BirthMonth";
-const char kServerBirthDayColumn[] = "OMIT:BirthDay";
-const char kServerCustom1Column[] = "Custom_1";
-const char kServerCustom2Column[] = "Custom_2";
-const char kServerCustom3Column[] = "Custom_3";
-const char kServerCustom4Column[] = "Custom_4";
-const char kServerNotesColumn[] = "addl_info";
-const char kServerLastModifiedDateColumn[] = "OMIT:LastModifiedDate";
nsSyncDecoderRing::nsSyncDecoderRing()
{
diff --git a/mozilla/mailnews/absync/src/nsSyncDecoderRing.h b/mozilla/mailnews/absync/src/nsSyncDecoderRing.h
index bacacbafdcc..f39bf457866 100644
--- a/mozilla/mailnews/absync/src/nsSyncDecoderRing.h
+++ b/mozilla/mailnews/absync/src/nsSyncDecoderRing.h
@@ -48,44 +48,44 @@
// Server record fields!
-extern const char kServerFirstNameColumn[];
-extern const char kServerLastNameColumn[];
-extern const char kServerDisplayNameColumn[];
-extern const char kServerNicknameColumn[];
-extern const char kServerPriEmailColumn[];
-extern const char kServer2ndEmailColumn[];
-extern const char kServerPlainTextColumn[];
-extern const char kServerWorkPhoneColumn[];
-extern const char kServerHomePhoneColumn[];
-extern const char kServerFaxColumn[];
-extern const char kServerPagerColumn[];
-extern const char kServerCellularColumn[];
-extern const char kServerHomeAddressColumn[];
-extern const char kServerHomeAddress2Column[];
-extern const char kServerHomeCityColumn[];
-extern const char kServerHomeStateColumn[];
-extern const char kServerHomeZipCodeColumn[];
-extern const char kServerHomeCountryColumn[];
-extern const char kServerWorkAddressColumn[];
-extern const char kServerWorkAddress2Column[];
-extern const char kServerWorkCityColumn[];
-extern const char kServerWorkStateColumn[];
-extern const char kServerWorkZipCodeColumn[];
-extern const char kServerWorkCountryColumn[];
-extern const char kServerJobTitleColumn[];
-extern const char kServerDepartmentColumn[];
-extern const char kServerCompanyColumn[];
-extern const char kServerWebPage1Column[];
-extern const char kServerWebPage2Column[];
-extern const char kServerBirthYearColumn[];
-extern const char kServerBirthMonthColumn[];
-extern const char kServerBirthDayColumn[];
-extern const char kServerCustom1Column[];
-extern const char kServerCustom2Column[];
-extern const char kServerCustom3Column[];
-extern const char kServerCustom4Column[];
-extern const char kServerNotesColumn[];
-extern const char kServerLastModifiedDateColumn[];
+#define kServerFirstNameColumn NS_LITERAL_STRING("fname")
+#define kServerLastNameColumn NS_LITERAL_STRING("lname")
+#define kServerDisplayNameColumn NS_LITERAL_STRING("Display_name")
+#define kServerNicknameColumn NS_LITERAL_STRING("nick_name")
+#define kServerPriEmailColumn NS_LITERAL_STRING("email1")
+#define kServer2ndEmailColumn NS_LITERAL_STRING("email2")
+#define kServerPlainTextColumn NS_LITERAL_STRING("Pref_rich_email")
+#define kServerWorkPhoneColumn NS_LITERAL_STRING("work_phone")
+#define kServerHomePhoneColumn NS_LITERAL_STRING("home_phone")
+#define kServerFaxColumn NS_LITERAL_STRING("fax")
+#define kServerPagerColumn NS_LITERAL_STRING("pager")
+#define kServerCellularColumn NS_LITERAL_STRING("cell_phone")
+#define kServerHomeAddressColumn NS_LITERAL_STRING("home_add1")
+#define kServerHomeAddress2Column NS_LITERAL_STRING("home_add2")
+#define kServerHomeCityColumn NS_LITERAL_STRING("home_city")
+#define kServerHomeStateColumn NS_LITERAL_STRING("home_state")
+#define kServerHomeZipCodeColumn NS_LITERAL_STRING("home_zip")
+#define kServerHomeCountryColumn NS_LITERAL_STRING("home_country")
+#define kServerWorkAddressColumn NS_LITERAL_STRING("work_add1")
+#define kServerWorkAddress2Column NS_LITERAL_STRING("work_add2")
+#define kServerWorkCityColumn NS_LITERAL_STRING("work_city")
+#define kServerWorkStateColumn NS_LITERAL_STRING("work_state")
+#define kServerWorkZipCodeColumn NS_LITERAL_STRING("work_zip")
+#define kServerWorkCountryColumn NS_LITERAL_STRING("work_country")
+#define kServerJobTitleColumn NS_LITERAL_STRING("job_title")
+#define kServerDepartmentColumn NS_LITERAL_STRING("department")
+#define kServerCompanyColumn NS_LITERAL_STRING("company")
+#define kServerWebPage1Column NS_LITERAL_STRING("Work_web_page")
+#define kServerWebPage2Column NS_LITERAL_STRING("web_page")
+#define kServerBirthYearColumn NS_LITERAL_STRING("OMIT:BirthYear")
+#define kServerBirthMonthColumn NS_LITERAL_STRING("OMIT:BirthMonth")
+#define kServerBirthDayColumn NS_LITERAL_STRING("OMIT:BirthDay")
+#define kServerCustom1Column NS_LITERAL_STRING("Custom_1")
+#define kServerCustom2Column NS_LITERAL_STRING("Custom_2")
+#define kServerCustom3Column NS_LITERAL_STRING("Custom_3")
+#define kServerCustom4Column NS_LITERAL_STRING("Custom_4")
+#define kServerNotesColumn NS_LITERAL_STRING("addl_info")
+#define kServerLastModifiedDateColumn NS_LITERAL_STRING("OMIT:LastModifiedDate")
class nsSyncDecoderRing
{
diff --git a/mozilla/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp b/mozilla/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
index 1d9994aa1e1..71f117be4e4 100644
--- a/mozilla/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
+++ b/mozilla/mailnews/addrbook/src/nsAddbookProtocolHandler.cpp
@@ -226,8 +226,8 @@ nsAddbookProtocolHandler::GeneratePrintOutput(nsIAddbookUrl *addbookUrl,
if (pos == kNotFound)
return NS_ERROR_UNEXPECTED;
- uri.InsertWithConversion(PRUnichar('/'), pos);
- uri.InsertWithConversion(PRUnichar(':'), pos);
+ uri.Insert('/', pos);
+ uri.Insert(':', pos);
nsCOMPtr resource;
rv = rdfService->GetResource(uri.get(), getter_AddRefs(resource));
diff --git a/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp b/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp
index a06bd97b366..19de7aeec7a 100644
--- a/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp
+++ b/mozilla/mailnews/base/util/nsMsgMailNewsUrl.cpp
@@ -622,7 +622,7 @@ NS_IMETHODIMP nsMsgMailNewsUrl::GetFileExtension(char * *aFileExtension)
if (!mAttachmentFileName.IsEmpty())
{
nsCAutoString extension;
- PRInt32 pos = mAttachmentFileName.RFindCharInSet(".");
+ PRInt32 pos = mAttachmentFileName.RFindChar(PRUnichar('.'));
if (pos > 0)
mAttachmentFileName.Right(extension,
mAttachmentFileName.Length() -
diff --git a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp
index 416a73b4c99..272512f9f78 100644
--- a/mozilla/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mozilla/mailnews/imap/src/nsImapMailFolder.cpp
@@ -831,7 +831,7 @@ NS_IMETHODIMP nsImapMailFolder::CreateClientSubfolderInfo(const char *folderName
{
nsCAutoString onlineName(m_onlineFolderName);
if (onlineName.Length() > 0)
- onlineName.AppendWithConversion(hierarchyDelimiter);
+ onlineName.Append(char(hierarchyDelimiter));
onlineName.AppendWithConversion(folderNameStr);
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);
imapFolder->SetOnlineName(onlineName.get());
@@ -1770,7 +1770,7 @@ nsImapMailFolder::GetDBFolderInfoAndDB(nsIDBFolderInfo **folderInfo, nsIMsgDatab
rv = nsImapURI2FullName(kImapRootURI, hostname, uri, getter_Copies(name));
nsCAutoString onlineCName(name);
if (m_hierarchyDelimiter != '/')
- onlineCName.ReplaceChar('/', m_hierarchyDelimiter);
+ onlineCName.ReplaceChar('/', char(m_hierarchyDelimiter));
m_onlineFolderName.Assign(onlineCName);
autoOnlineName.AssignWithConversion(onlineCName.get());
}
@@ -6695,7 +6695,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameClient(nsIMsgWindow *msgWindow, nsIMsgFold
{
nsCAutoString onlineName(m_onlineFolderName);
if (onlineName.Length() > 0)
- onlineName.AppendWithConversion(hierarchyDelimiter);
+ onlineName.Append(char(hierarchyDelimiter));
onlineName.AppendWithConversion(folderNameStr);
imapFolder->SetVerifiedAsOnlineFolder(PR_TRUE);
imapFolder->SetOnlineName(onlineName.get());
@@ -6811,7 +6811,7 @@ NS_IMETHODIMP nsImapMailFolder::RenameSubFolders(nsIMsgWindow *msgWindow, nsIMsg
nsXPIDLCString onlineName;
GetOnlineName(getter_Copies(onlineName));
nsCAutoString onlineCName(onlineName);
- onlineCName.AppendWithConversion(hierarchyDelimiter);
+ onlineCName.Append(char(hierarchyDelimiter));
onlineCName.AppendWithConversion(utf7LeafName);
if (imapFolder)
{
diff --git a/mozilla/mailnews/imap/src/nsImapService.cpp b/mozilla/mailnews/imap/src/nsImapService.cpp
index e0f61f3b931..3928eeb4b7d 100644
--- a/mozilla/mailnews/imap/src/nsImapService.cpp
+++ b/mozilla/mailnews/imap/src/nsImapService.cpp
@@ -417,7 +417,7 @@ nsImapService::SelectFolder(nsIEventQueue * aClientEventQueue,
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
urlSpec.Append("/select>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
urlSpec.Append((const char *) folderName);
rv = mailNewsUrl->SetSpec(urlSpec.get());
if (NS_SUCCEEDED(rv))
@@ -464,7 +464,7 @@ nsImapService::LiteSelectFolder(nsIEventQueue * aClientEventQueue,
nsCOMPtr uri = do_QueryInterface(imapUrl);
urlSpec.Append("/liteselect>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
@@ -517,7 +517,7 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL
urlSpec.Append("fetch>");
urlSpec.Append(uidString);
urlSpec.Append(">");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(folder, getter_Copies(folderName));
@@ -793,7 +793,7 @@ nsresult nsImapService::FetchMimePart(nsIImapUrl * aImapUrl,
urlSpec.Append("fetch>");
urlSpec.Append(uidString);
urlSpec.Append(">");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
@@ -1017,7 +1017,7 @@ NS_IMETHODIMP nsImapService::Search(nsIMsgSearchSession *aSearchSession, nsIMsgW
nsCOMPtr mailNewsUrl = do_QueryInterface(imapUrl);
urlSpec.Append("/search>UID>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
urlSpec.Append((const char *) folderName);
urlSpec.Append('>');
// escape aSearchUri so that IMAP special characters (i.e. '\')
@@ -1194,7 +1194,7 @@ nsImapService::FetchMessage(nsIImapUrl * aImapUrl,
urlSpec.Append("fetch>");
urlSpec.Append(messageIdsAreUID ? uidString : sequenceString);
urlSpec.Append(">");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
@@ -1390,7 +1390,7 @@ nsImapService::GetHeaders(nsIEventQueue * aClientEventQueue,
urlSpec.Append("/header>");
urlSpec.Append(messageIdsAreUID ? uidString : sequenceString);
urlSpec.Append(">");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
@@ -1439,7 +1439,7 @@ nsImapService::Noop(nsIEventQueue * aClientEventQueue,
if (NS_SUCCEEDED(rv))
{
urlSpec.Append("/selectnoop>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
@@ -1485,7 +1485,7 @@ nsImapService::Expunge(nsIEventQueue * aClientEventQueue,
{
urlSpec.Append("/Expunge>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
@@ -1533,7 +1533,7 @@ nsImapService::Biff(nsIEventQueue * aClientEventQueue,
if (NS_SUCCEEDED(rv))
{
urlSpec.Append("/Biff>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
@@ -1574,7 +1574,7 @@ nsImapService::DeleteFolder(nsIEventQueue* eventQueue,
nsCOMPtr uri = do_QueryInterface(imapUrl);
urlSpec.Append("/delete>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
rv = GetFolderName(folder, getter_Copies(folderName));
@@ -1629,7 +1629,7 @@ nsImapService::DeleteMessages(nsIEventQueue * aClientEventQueue,
urlSpec.Append("/deletemsg>");
urlSpec.Append(messageIdsAreUID ? uidString : sequenceString);
urlSpec.Append(">");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
@@ -1677,7 +1677,7 @@ nsImapService::DeleteAllMessages(nsIEventQueue * aClientEventQueue,
nsCOMPtr uri = do_QueryInterface(imapUrl);
urlSpec.Append("/deleteallmsgs>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
urlSpec.Append((const char *) folderName);
@@ -1772,7 +1772,7 @@ nsresult nsImapService::DiddleFlags(nsIEventQueue * aClientEventQueue,
urlSpec.Append('>');
urlSpec.Append(messageIdsAreUID ? uidString : sequenceString);
urlSpec.Append(">");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
urlSpec.Append((const char *) folderName);
@@ -1949,7 +1949,7 @@ nsImapService::DiscoverChildren(nsIEventQueue* aClientEventQueue,
nsCOMPtr uri = do_QueryInterface(aImapUrl);
urlSpec.Append("/discoverchildren>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
urlSpec.Append(folderPath);
// mscott - this cast to a char * is okay...there's a bug in the XPIDL
// compiler that is preventing in string parameters from showing up as
@@ -2009,7 +2009,7 @@ nsImapService::DiscoverLevelChildren(nsIEventQueue* aClientEventQueue,
nsCOMPtr uri = do_QueryInterface(aImapUrl);
urlSpec.Append("/discoverlevelchildren>");
urlSpec.AppendInt(level);
- urlSpec.AppendWithConversion(hierarchySeparator); // hierarchySeparator "/"
+ urlSpec.Append(char(hierarchySeparator)); // hierarchySeparator "/"
urlSpec.Append(folderPath);
rv = uri->SetSpec(urlSpec.get());
@@ -2090,7 +2090,7 @@ nsImapService::OnlineMessageCopy(nsIEventQueue* aClientEventQueue,
else
urlSpec.Append(sequenceString);
urlSpec.Append('>');
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aSrcFolder, getter_Copies(folderName));
@@ -2098,7 +2098,7 @@ nsImapService::OnlineMessageCopy(nsIEventQueue* aClientEventQueue,
urlSpec.Append('>');
urlSpec.Append(messageIds);
urlSpec.Append('>');
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
folderName.Adopt(nsCRT::strdup(""));
GetFolderName(aDstFolder, getter_Copies(folderName));
urlSpec.Append((const char *) folderName);
@@ -2265,7 +2265,7 @@ nsImapService::AppendMessageFromFile(nsIEventQueue* aClientEventQueue,
else
urlSpec.Append("/appendmsgfromfile>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
nsXPIDLCString folderName;
GetFolderName(aDstFolder, getter_Copies(folderName));
@@ -2419,10 +2419,10 @@ nsImapService::RenameLeaf(nsIEventQueue* eventQueue, nsIMsgFolder* srcFolder,
nsXPIDLCString folderName;
GetFolderName(srcFolder, getter_Copies(folderName));
urlSpec.Append("/rename>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
urlSpec.Append((const char *) folderName);
urlSpec.Append('>');
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
char *utfNewName = CreateUtf7ConvertedStringFromUnicode( newLeafName);
@@ -2482,14 +2482,14 @@ nsImapService::CreateFolder(nsIEventQueue* eventQueue, nsIMsgFolder* parent,
nsXPIDLCString folderName;
GetFolderName(parent, getter_Copies(folderName));
urlSpec.Append("/create>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
if ((const char *) folderName && strlen(folderName) > 0)
{
nsXPIDLCString canonicalName;
nsImapUrl::ConvertToCanonicalFormat(folderName, (char) hierarchySeparator, getter_Copies(canonicalName));
urlSpec.Append((const char *) canonicalName);
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
}
char *utfNewName = CreateUtf7ConvertedStringFromUnicode( newFolderName);
char *escapedFolderName = nsEscape(utfNewName, url_Path);
@@ -2533,11 +2533,11 @@ nsImapService::EnsureFolderExists(nsIEventQueue* eventQueue, nsIMsgFolder* paren
nsXPIDLCString folderName;
GetFolderName(parent, getter_Copies(folderName));
urlSpec.Append("/ensureExists>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
if ((const char *) folderName && strlen(folderName) > 0)
{
urlSpec.Append((const char *) folderName);
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
}
char *utfNewName = CreateUtf7ConvertedStringFromUnicode( newFolderName);
char *escapedFolderName = nsEscape(utfNewName, url_Path);
@@ -2583,7 +2583,7 @@ nsImapService::ListFolder(nsIEventQueue* aClientEventQueue,
nsXPIDLCString folderName;
GetFolderName(aImapMailFolder, getter_Copies(folderName));
urlSpec.Append("/listfolder>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
if ((const char *) folderName && strlen(folderName) > 0)
{
urlSpec.Append((const char *) folderName);
@@ -3606,7 +3606,7 @@ nsImapService::SubscribeFolder(nsIEventQueue* eventQueue,
{
nsCOMPtr uri = do_QueryInterface(imapUrl);
urlSpec.Append("/subscribe>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
char *utfFolderName =
CreateUtf7ConvertedStringFromUnicode(folderName);
char *escapedFolderName = nsEscape(utfFolderName, url_Path);
@@ -3645,7 +3645,7 @@ nsImapService::UnsubscribeFolder(nsIEventQueue* eventQueue,
{
nsCOMPtr uri = do_QueryInterface(imapUrl);
urlSpec.Append("/unsubscribe>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
char *utfFolderName =
CreateUtf7ConvertedStringFromUnicode(folderName);
char *escapedFolderName = nsEscape(utfFolderName, url_Path);
@@ -3693,7 +3693,7 @@ nsImapService::GetFolderAdminUrl(nsIEventQueue *aClientEventQueue,
nsXPIDLCString folderName;
GetFolderName(anImapFolder, getter_Copies(folderName));
urlSpec.Append("/refreshfolderurls>");
- urlSpec.AppendWithConversion(hierarchySeparator);
+ urlSpec.Append(char(hierarchySeparator));
urlSpec.Append((const char *) folderName);
rv = mailNewsUrl->SetSpec(urlSpec.get());
if (NS_SUCCEEDED(rv))
diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp
index 95992c984da..e250eb9cc87 100644
--- a/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp
+++ b/mozilla/mailnews/import/eudora/src/nsEudoraAddress.cpp
@@ -572,7 +572,7 @@ CAliasEntry *nsEudoraAddress::ResolveAlias( nsCString& name)
CAliasEntry *pEntry;
for (PRInt32 i = 0; i < max; i++) {
pEntry = (CAliasEntry *) m_alias.ElementAt( i);
- if (!name.CompareWithConversion( pEntry->m_name.get(), PR_TRUE))
+ if (name.Equals( pEntry->m_name, nsCaseInsensitiveCStringComparator()))
return( pEntry);
}
@@ -592,7 +592,9 @@ void nsEudoraAddress::ResolveEntries( nsCString& name, nsVoidArray& list, nsVoid
for (i = 0; i < max; i++) {
pData = (CAliasData *)list.ElementAt( i);
// resolve the email to an existing alias!
- if (name.CompareWithConversion( pData->m_email.get(), PR_TRUE) && ((pEntry = ResolveAlias( pData->m_email)) != nsnull)) {
+ if (!name.Equals( pData->m_email,
+ nsCaseInsensitiveCStringComparator()) &&
+ ((pEntry = ResolveAlias( pData->m_email)) != nsnull)) {
// This new entry has all of the entries for this puppie.
// Resolve all of it's entries!
ResolveEntries( pEntry->m_name, pEntry->m_list, result);
diff --git a/mozilla/mailnews/import/eudora/src/nsEudoraImport.cpp b/mozilla/mailnews/import/eudora/src/nsEudoraImport.cpp
index 2fbd8c8ce74..e9dd647eba5 100644
--- a/mozilla/mailnews/import/eudora/src/nsEudoraImport.cpp
+++ b/mozilla/mailnews/import/eudora/src/nsEudoraImport.cpp
@@ -412,7 +412,7 @@ NS_IMETHODIMP ImportEudoraMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISupport
void ImportEudoraMailImpl::AddLinebreak( nsString *pStream)
{
if (pStream)
- pStream->AppendWithConversion( char(nsCRT::LF));
+ pStream->Append( PRUnichar(nsCRT::LF));
}
void ImportEudoraMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream)
diff --git a/mozilla/mailnews/import/oexpress/nsOEImport.cpp b/mozilla/mailnews/import/oexpress/nsOEImport.cpp
index e0eebe87b56..e54040a4e7a 100644
--- a/mozilla/mailnews/import/oexpress/nsOEImport.cpp
+++ b/mozilla/mailnews/import/oexpress/nsOEImport.cpp
@@ -386,7 +386,7 @@ NS_IMETHODIMP ImportOEMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISupportsArr
void ImportOEMailImpl::AddLinebreak( nsString *pStream)
{
if (pStream)
- pStream->AppendWithConversion( char(nsCRT::LF));
+ pStream->Append( PRUnichar(nsCRT::LF));
}
void ImportOEMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream)
diff --git a/mozilla/mailnews/import/outlook/src/nsOutlookImport.cpp b/mozilla/mailnews/import/outlook/src/nsOutlookImport.cpp
index becb37f5602..1dd012b41ee 100644
--- a/mozilla/mailnews/import/outlook/src/nsOutlookImport.cpp
+++ b/mozilla/mailnews/import/outlook/src/nsOutlookImport.cpp
@@ -392,7 +392,7 @@ NS_IMETHODIMP ImportOutlookMailImpl::FindMailboxes( nsIFileSpec *pLoc, nsISuppor
void ImportOutlookMailImpl::AddLinebreak( nsString *pStream)
{
if (pStream)
- pStream->AppendWithConversion( char(nsCRT::LF));
+ pStream->Append( PRUnichar(nsCRT::LF));
}
void ImportOutlookMailImpl::ReportSuccess( nsString& name, PRInt32 count, nsString *pStream)
diff --git a/mozilla/mailnews/import/text/src/nsTextImport.cpp b/mozilla/mailnews/import/text/src/nsTextImport.cpp
index 01020dba2fc..b91efe25a2d 100644
--- a/mozilla/mailnews/import/text/src/nsTextImport.cpp
+++ b/mozilla/mailnews/import/text/src/nsTextImport.cpp
@@ -408,7 +408,7 @@ void ImportAddressImpl::ReportSuccess( nsString& name, nsString *pStream)
pStream->Append( pText);
nsTextFormatter::smprintf_free( pText);
nsTextStringBundle::FreeString( pFmt);
- pStream->AppendWithConversion( char(nsCRT::LF));
+ pStream->Append( PRUnichar(nsCRT::LF));
NS_IF_RELEASE( pBundle);
}
@@ -423,7 +423,7 @@ void ImportAddressImpl::ReportError( PRInt32 errorNum, nsString& name, nsString
pStream->Append( pText);
nsTextFormatter::smprintf_free( pText);
nsTextStringBundle::FreeString( pFmt);
- pStream->AppendWithConversion( char(nsCRT::LF));
+ pStream->Append( PRUnichar(nsCRT::LF));
NS_IF_RELEASE( pBundle);
}
diff --git a/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp b/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp
index 0516a176d45..5ae0f380fc6 100644
--- a/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp
+++ b/mozilla/netwerk/mime/src/nsMIMEInfoImpl.cpp
@@ -266,7 +266,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions )
nsCString extList( aExtensions );
PRInt32 breakLocation = -1;
- while ( (breakLocation= extList.FindCharInSet( ",",0 ) )!= -1)
+ while ( (breakLocation= extList.FindChar(',') )!= -1)
{
nsCString ext( extList.get(), breakLocation );
mExtensions.AppendCString( ext );
diff --git a/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp b/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
index 3f1f21384a6..77dfa420305 100644
--- a/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
+++ b/mozilla/netwerk/streamconv/converters/mozTXTToHTMLConv.cpp
@@ -198,7 +198,7 @@ mozTXTToHTMLConv::FindURLStart(const PRUnichar * aInString, PRInt32 aInLength,
case RFC2396E:
{
nsString temp(aInString, aInLength);
- PRInt32 i = pos <= 0 ? kNotFound : temp.RFindCharInSet("<>\"", pos - 1);
+ PRInt32 i = pos <= 0 ? kNotFound : temp.RFindCharInSet(NS_LITERAL_STRING("<>\"").get(), pos - 1);
if (i != kNotFound && (temp[PRUint32(i)] == '<' ||
temp[PRUint32(i)] == '"'))
{
@@ -272,7 +272,7 @@ mozTXTToHTMLConv::FindURLEnd(const PRUnichar * aInString, PRInt32 aInStringLengt
{
nsString temp(aInString, aInStringLength);
- PRInt32 i = temp.FindCharInSet("<>\"", pos + 1);
+ PRInt32 i = temp.FindCharInSet(NS_LITERAL_STRING("<>\"").get(), pos + 1);
if (i != kNotFound && temp[PRUint32(i--)] ==
(check == RFC1738 || temp[start - 1] == '<' ? '>' : '"'))
{
diff --git a/mozilla/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp b/mozilla/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp
index d2269d1d818..5fbcf71866f 100644
--- a/mozilla/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp
+++ b/mozilla/netwerk/streamconv/converters/nsTXTToHTMLConv.cpp
@@ -39,7 +39,7 @@
#include "nsNetUtil.h"
#include "nsIStringStream.h"
-#define TOKEN_DELIMITERS "\t\r\n "
+#define TOKEN_DELIMITERS NS_LITERAL_STRING("\t\r\n ").get()
// nsISupports methods
NS_IMPL_THREADSAFE_ISUPPORTS4(nsTXTToHTMLConv,
diff --git a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
index b6befa40917..49cd54e39c4 100644
--- a/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
+++ b/mozilla/parser/htmlparser/src/nsDTDUtils.cpp
@@ -597,7 +597,7 @@ public:
while(expn--) {
ndex = ((root<=aValue) && (root)) ? (aValue/root): 0;
aValue%=root;
- aString.AppendWithConversion(aCharSet[ndex+((root>1)*offset)]);
+ aString.Append(PRUnichar(aCharSet[ndex+((root>1)*offset)]));
root/=base;
}
}
@@ -712,8 +712,14 @@ public:
* @param aString -- will hold result
*/
static void RomanString(PRInt32 aValue,nsString& aString) {
- static char digitsA[] = "ixcm";
- static char digitsB[] = "vld?";
+ static PRUnichar digitsA[] = { PRUnichar('i'),
+ PRUnichar('x'),
+ PRUnichar('c'),
+ PRUnichar('m') };
+ static PRUnichar digitsB[] = { PRUnichar('v'),
+ PRUnichar('l'),
+ PRUnichar('d'),
+ PRUnichar('?') };
aString.Truncate();
if(aValue<0)
@@ -732,20 +738,20 @@ public:
romanPos--;
switch(decStr[digitPos]) {
case '0': break;
- case '3': aString.AppendWithConversion(digitsA[romanPos]);
- case '2': aString.AppendWithConversion(digitsA[romanPos]);
- case '1': aString.AppendWithConversion(digitsA[romanPos]);
+ case '3': aString.Append(digitsA[romanPos]);
+ case '2': aString.Append(digitsA[romanPos]);
+ case '1': aString.Append(digitsA[romanPos]);
break;
- case '4': aString.AppendWithConversion(digitsA[romanPos]);
+ case '4': aString.Append(digitsA[romanPos]);
case '5': case '6':
case '7': case '8':
- aString.AppendWithConversion(digitsB[romanPos]);
+ aString.Append(digitsB[romanPos]);
for(n=0;n<(decStr[digitPos]-'5');n++)
- aString.AppendWithConversion(digitsA[romanPos]);
+ aString.Append(digitsA[romanPos]);
break;
case '9':
- aString.AppendWithConversion(digitsA[romanPos]);
- aString.AppendWithConversion(digitsA[romanPos]);
+ aString.Append(digitsA[romanPos]);
+ aString.Append(digitsA[romanPos]);
break;
}
}
@@ -789,7 +795,7 @@ public:
modChar=aValue-(repCount*seriesLen);
for(count=0;count<=repCount;count++) {
- aString.AppendWithConversion(kFootnoteSet[modChar]);
+ aString.Append(PRUnichar(kFootnoteSet[modChar]));
}
}
diff --git a/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp b/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp
index bd9dd973d7b..75443b23d09 100644
--- a/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp
+++ b/mozilla/parser/htmlparser/tests/outsinks/Convert.cpp
@@ -60,7 +60,7 @@ Compare(nsString& str, nsString& aFileName)
int different = 0;
while ((c = getc(file)) != EOF)
{
- inString.AppendWithConversion((char)c);
+ inString.Append(PRUnichar(c));
// CVS isn't doing newline comparisons on these files for some reason.
// So compensate for possible newline problems in the CVS file:
if (c == '\n' && str[index] == '\r')
@@ -301,7 +301,7 @@ Usage: %s [-i intype] [-o outtype] [-f flags] [-w wrapcol] [-c comparison_file]
nsString inString;
int c;
while ((c = getc(file)) != EOF)
- inString.AppendWithConversion((char)c);
+ inString.Append(PRUnichar(c));
if (file != stdin)
fclose(file);
diff --git a/mozilla/string/obsolete/nsStr.cpp b/mozilla/string/obsolete/nsStr.cpp
index 21bcc6521fc..c2fb371a4be 100644
--- a/mozilla/string/obsolete/nsStr.cpp
+++ b/mozilla/string/obsolete/nsStr.cpp
@@ -330,45 +330,6 @@ void nsStrPrivate::StrInsert1into2( nsStr& aDest,PRUint32 aDestOffset,const nsSt
}
}
-void nsStrPrivate::StrInsert2into1( nsStr& aDest,PRUint32 aDestOffset,const nsStr& aSource,PRUint32 aSrcOffset,PRInt32 aCount){
- NS_ASSERTION(aSource.GetCharSize() == eTwoByte, "Must be 2 byte");
- NS_ASSERTION(aDest.GetCharSize() == eOneByte, "Must be 1 byte");
- //there are a few cases for insert:
- // 1. You're inserting chars into an empty string (assign)
- // 2. You're inserting onto the end of a string (append)
- // 3. You're inserting onto the 1..n-1 pos of a string (the hard case).
- if(0 aDest.GetCapacity())
- AppendForInsert(aDest, aDestOffset, aSource, aSrcOffset, theLength);
- else {
- //shift the chars right by theDelta...
- ShiftCharsRight(aDest.mStr, aDest.mLength, aDestOffset, theLength);
-
- //now insert new chars, starting at offset
- CopyChars2To1(aDest.mStr,aDestOffset,aSource.mStr,aSrcOffset,theLength);
- }
-
- //finally, make sure to update the string length...
- aDest.mLength+=theLength;
- AddNullTerminator(aDest);
- NSSTR_SEEN(aDest);
- }//if
- //else nothing to do!
- }
- else StrAppend(aDest,aSource,0,aCount);
- }
- else StrAppend(aDest,aSource,0,aCount);
- }
-}
-
void nsStrPrivate::StrInsert2into2( nsStr& aDest,PRUint32 aDestOffset,const nsStr& aSource,PRUint32 aSrcOffset,PRInt32 aCount){
NS_ASSERTION(aSource.GetCharSize() == eTwoByte, "Must be 1 byte");
NS_ASSERTION(aDest.GetCharSize() == eTwoByte, "Must be 2 byte");
@@ -646,45 +607,6 @@ PRInt32 nsStrPrivate::FindSubstr1in1(const nsStr& aDest,const nsStr& aTarget, PR
return kNotFound;
}
-PRInt32 nsStrPrivate::FindSubstr2in1(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) {
-
- NS_ASSERTION(aDest.GetCharSize() == eOneByte, "Must be 1 byte");
- NS_ASSERTION(aTarget.GetCharSize() == eTwoByte, "Must be 2 byte");
-
- PRInt32 theMaxPos = aDest.mLength-aTarget.mLength; //this is the last pos that is feasible for starting the search, with given lengths...
-
- if (theMaxPos<0) return kNotFound;
-
- if(anOffset<0)
- anOffset=0;
-
- if((aDest.mLength<=0) || (anOffset>theMaxPos) || (aTarget.mLength==0))
- return kNotFound;
-
- if(aCount<0)
- aCount = MaxInt(theMaxPos,1);
-
- if (aCount <= 0)
- return kNotFound;
-
- const char* root = aDest.mStr;
- const char* left = root+anOffset;
- const char* last = left+aCount;
- const char* max = root+theMaxPos;
- const char* right = (last=aDest.mLength) || (aTarget.mLength==0))
- return kNotFound;
-
- if (aCount<=0)
- return kNotFound;
-
- const char* root = aDest.mStr;
- const char* destLast = root+aDest.mLength; //pts to last char in aDest (likely null)
-
- const char* rightmost = root+anOffset;
- const char* min = rightmost-aCount+1;
-
- const char* leftmost = (min2)) {
@@ -405,11 +406,11 @@ nsCString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminate
}
}
- nsStrPrivate::Trim(*this,aTrimSet,aEliminateLeading,aEliminateTrailing);
+ nsStrPrivate::Trim(*this, aTrimSet, aEliminateLeading, aEliminateTrailing);
if(aIgnoreQuotes && theQuotesAreNeeded) {
- InsertWithConversion(theFirstChar,0);
- AppendWithConversion(theLastChar);
+ Insert(theFirstChar, 0);
+ Append(theLastChar);
}
}
@@ -425,11 +426,13 @@ nsCString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminate
* @param aEliminateTrailing controls stripping of trailing ws
* @return this
*/
-void
-nsCString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading,PRBool aEliminateTrailing){
+static void
+CompressSet(nsCString& aStr, const char* aSet, char aChar,
+ PRBool aEliminateLeading, PRBool aEliminateTrailing){
if(aSet){
- ReplaceChar(aSet,aChar);
- nsStrPrivate::CompressSet1(*this,aSet,aEliminateLeading,aEliminateTrailing);
+ aStr.ReplaceChar(aSet, aChar);
+ nsStrPrivate::CompressSet1(aStr, aSet,
+ aEliminateLeading, aEliminateTrailing);
}
}
@@ -445,7 +448,7 @@ nsCString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeadin
*/
void
nsCString::CompressWhitespace( PRBool aEliminateLeading,PRBool aEliminateTrailing){
- CompressSet(kWhitespace,' ',aEliminateLeading,aEliminateTrailing);
+ CompressSet(*this, kWhitespace,' ',aEliminateLeading,aEliminateTrailing);
}
/**********************************************************************
@@ -678,35 +681,6 @@ void nsCString::AppendWithConversion( const nsAString& aString ) {
}
}
-/**
- * assign given unichar to this string
- * @update gess 01/04/99
- * @param aChar: char to be assignd to this
- * @return this
- */
-void nsCString::AssignWithConversion(PRUnichar aChar) {
- nsStrPrivate::StrTruncate(*this,0);
- AppendWithConversion(aChar);
-}
-
-
-/**
- * append given char to this string
- * @update gess 01/04/99
- * @param aChar: char to be appended to this
- * @return this
- */
-void nsCString::AppendWithConversion(PRUnichar aChar) {
- PRUnichar buf[2]={0,0};
- buf[0]=aChar;
-
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mUStr=buf;
- temp.mLength=1;
- nsStrPrivate::StrAppend(*this,temp,0,1);
-}
-
void nsCString::AppendWithConversion( const PRUnichar* aBuffer, PRInt32 aLength )
{
nsStr temp;
@@ -792,26 +766,6 @@ void nsCString::AppendWithConversion(const nsString& aString,PRInt32 aCount) {
nsStrPrivate::StrAppend(*this,aString,0,aCount);
}
-
-/**
- * Insert a single unichar into this string at a specified offset.
- *
- * @update gess4/22/98
- * @param aChar unichar to be inserted into this string
- * @param anOffset is insert pos in str
- * @return this
- */
-void nsCString::InsertWithConversion(PRUnichar aChar,PRUint32 anOffset){
- PRUnichar theBuffer[2]={0,0};
- theBuffer[0]=aChar;
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mUStr=theBuffer;
- temp.mLength=1;
- nsStrPrivate::StrInsert2into1(*this,anOffset,temp,0,1);
-}
-
-
void nsCString::Adopt(char* aPtr, PRInt32 aLength) {
NS_ASSERTION(aPtr, "Can't adopt |0|");
nsStrPrivate::Destroy(*this);
@@ -849,29 +803,6 @@ PRInt32 nsCString::Find(const char* aCString,PRBool aIgnoreCase,PRInt32 anOffset
return result;
}
-/**
- * Search for given buffer within this string
- *
- * @update gess 3/25/98
- * @param aString - substr to be found
- * @param aIgnoreCase tells us whether or not to do caseless compare
- * @param anOffset tells us where in this string to start searching
- * @param aCount tells us how many iterations to make starting at the given offset
- * @return offset in string, or -1 (kNotFound)
- */
-PRInt32 nsCString::Find(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- NS_ASSERTION(0!=aString,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aString) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength = nsCRT::strlen(aString);
- temp.mUStr=(PRUnichar*)aString;
- result=nsStrPrivate::FindSubstr2in1(*this,temp,aIgnoreCase,anOffset,aCount);
- }
- return result;
-}
/**
* Search for given string within this string
@@ -888,12 +819,6 @@ PRInt32 nsCString::Find(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOf
return result;
}
-PRInt32 nsCString::Find(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::FindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
-
/**
* This searches this string for a given character
*
@@ -932,48 +857,11 @@ PRInt32 nsCString::FindCharInSet(const char* aCStringSet,PRInt32 anOffset) const
return result;
}
-/**
- * This method finds the offset of the first char in this string that is
- * a member of the given charset, starting the search at anOffset
- *
- * @update gess 3/25/98
- * @param aStringSet
- * @param anOffset -- where in this string to start searching
- * @return
- */
-PRInt32 nsCString::FindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) const{
- NS_ASSERTION(0!=aStringSet,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aStringSet) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength=nsCRT::strlen(aStringSet);
- temp.mStr=(char*)aStringSet;
- result=nsStrPrivate::FindCharInSet2(*this,temp,anOffset);
- }
- return result;
-}
-
-/**
- * This method finds the offset of the first char in this string that is
- * a member of the given charset, starting the search at anOffset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset -- where in this string to start searching
- * @return
- */
PRInt32 nsCString::FindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::FindCharInSet1(*this,aSet,PR_FALSE,anOffset);
return result;
}
-PRInt32 nsCString::FindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::FindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
/**
* Reverse search for given string within this string
*
@@ -989,11 +877,6 @@ PRInt32 nsCString::RFind(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anO
return result;
}
-PRInt32 nsCString::RFind(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::RFindSubstr2in1(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
/**
* Reverse search for given string within this string
@@ -1056,83 +939,24 @@ PRInt32 nsCString::RFindCharInSet(const char* aCStringSet,PRInt32 anOffset) cons
return result;
}
-/**
- * Reverse search for char in this string that is also a member of given charset
- *
- * @update gess 3/25/98
- * @param aStringSet
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
-PRInt32 nsCString::RFindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) const{
- NS_ASSERTION(0!=aStringSet,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aStringSet) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength=nsCRT::strlen(aStringSet);
- temp.mUStr=(PRUnichar*)aStringSet;
- result=nsStrPrivate::RFindCharInSet2(*this,temp,anOffset);
- }
- return result;
-}
-
-
-/**
- * Reverse search for char in this string that is also a member of given charset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
PRInt32 nsCString::RFindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::RFindCharInSet1(*this,aSet,PR_FALSE,anOffset);
return result;
}
-PRInt32 nsCString::RFindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::RFindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
-
/**************************************************************
COMPARISON METHODS...
**************************************************************/
-
/**
- * Compares given unistring to this string.
- * @update gess 01/04/99
- * @param aString pts to a uni-string
- * @param aIgnoreCase tells us how to treat case
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return -1,0,1
- */
-PRInt32 nsCString::CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- NS_ASSERTION(0!=aString,kNullPointerError);
-
- if(aString) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength=nsCRT::strlen(aString);
- temp.mUStr=(PRUnichar*)aString;
- return nsStrPrivate::StrCompare1To2(*this,temp,aCount,aIgnoreCase);
- }
- return 0;
-}
-
-/**
- * Compares given cstring to this string.
+ * Compares given cstring to this string.
* @update gess 01/04/99
* @param aCString points to a cstring
* @param aIgnoreCase tells us how to treat case
* @param aCount tells us how many chars to test; -1 implies full length
* @return -1,0,1
*/
-PRInt32 nsCString::CompareWithConversion(const char *aCString,PRBool aIgnoreCase,PRInt32 aCount) const {
+PRInt32 nsCString::Compare(const char *aCString,PRBool aIgnoreCase,PRInt32 aCount) const {
NS_ASSERTION(0!=aCString,kNullPointerError);
if(aCString) {
@@ -1149,12 +973,6 @@ PRBool nsCString::EqualsIgnoreCase(const char* aString,PRInt32 aLength) const {
return EqualsWithConversion(aString,PR_TRUE,aLength);
}
-PRBool nsCString::EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aLength) const {
- return EqualsWithConversion(aString,PR_TRUE,aLength);
-}
-
-
-
/**
* Compare this to given string; note that we compare full strings here.
*
@@ -1165,19 +983,7 @@ PRBool nsCString::EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aLength) con
* @return TRUE if equal
*/
PRBool nsCString::EqualsWithConversion(const char* aCString,PRBool aIgnoreCase,PRInt32 aCount) const{
- PRInt32 theAnswer=CompareWithConversion(aCString,aIgnoreCase,aCount);
- PRBool result=PRBool(0==theAnswer);
- return result;
-}
-
-PRBool nsCString::EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=CompareWithConversion(aString,aIgnoreCase,aCount);
- PRBool result=PRBool(0==theAnswer);
- return result;
-}
-
- PRBool nsCString::EqualsWithConversion(const nsString& aString, PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=CompareWithConversion(aString.get(),aIgnoreCase,aCount);
+ PRInt32 theAnswer=Compare(aCString,aIgnoreCase,aCount);
PRBool result=PRBool(0==theAnswer);
return result;
}
diff --git a/mozilla/string/obsolete/nsString.h b/mozilla/string/obsolete/nsString.h
index 2f3b512ca59..b390e46350c 100644
--- a/mozilla/string/obsolete/nsString.h
+++ b/mozilla/string/obsolete/nsString.h
@@ -159,8 +159,7 @@ public:
* @return *this
*/
void StripChars(const char* aSet);
- void StripChar(PRUnichar aChar,PRInt32 anOffset=0);
- void StripChar(char aChar,PRInt32 anOffset=0) { StripChar((PRUnichar) (unsigned char)aChar,anOffset); }
+ void StripChar(char aChar,PRInt32 anOffset=0);
/**
* This method strips whitespace throughout the string
@@ -174,8 +173,8 @@ public:
*
* @return this
*/
- void ReplaceChar(PRUnichar aOldChar,PRUnichar aNewChar);
- void ReplaceChar(const char* aSet,PRUnichar aNewChar);
+ void ReplaceChar(char aOldChar,char aNewChar);
+ void ReplaceChar(const char* aSet,char aNewChar);
void ReplaceSubstring(const nsCString& aTarget,const nsCString& aNewValue);
void ReplaceSubstring(const char* aTarget,const char* aNewValue);
@@ -193,17 +192,6 @@ public:
*/
void Trim(const char* aSet,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE,PRBool aIgnoreQuotes=PR_FALSE);
- /**
- * This method strips whitespace from string.
- * You can control whether whitespace is yanked from
- * start and end of string as well.
- *
- * @param aEliminateLeading controls stripping of leading ws
- * @param aEliminateTrailing controls stripping of trailing ws
- * @return this
- */
- void CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE);
-
/**
* This method strips whitespace from string.
* You can control whether whitespace is yanked from
@@ -258,7 +246,6 @@ public:
void AssignWithConversion(const PRUnichar*,PRInt32=-1);
void AssignWithConversion( const nsString& aString );
void AssignWithConversion( const nsAString& aString );
- void AssignWithConversion(PRUnichar);
/*
* Appends n characters from given string to this,
@@ -271,7 +258,6 @@ public:
*/
void AppendWithConversion(const nsString&, PRInt32=-1);
- void AppendWithConversion(PRUnichar aChar);
void AppendWithConversion( const nsAString& aString );
void AppendWithConversion(const PRUnichar*, PRInt32=-1);
// Why no |AppendWithConversion(const PRUnichar*, PRInt32)|? --- now I know, because implicit construction hid the need for this routine
@@ -279,9 +265,6 @@ public:
void AppendFloat( double aFloat );
- void InsertWithConversion(PRUnichar aChar,PRUint32 anOffset);
- // Why no |InsertWithConversion(PRUnichar*)|?
-
#if 0
virtual void do_AppendFromReadable( const nsACString& );
virtual void do_InsertFromReadable( const nsACString&, PRUint32 );
@@ -306,10 +289,7 @@ public:
* @return offset in string, or -1 (kNotFound)
*/
PRInt32 Find(const nsCString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
- PRInt32 Find(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
PRInt32 Find(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
- PRInt32 Find(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
-
/**
* Search for given char within this string
*
@@ -329,9 +309,7 @@ public:
* @return -1 if not found, else the offset in this
*/
PRInt32 FindCharInSet(const char* aString,PRInt32 anOffset=0) const;
- PRInt32 FindCharInSet(const PRUnichar* aString,PRInt32 anOffset=0) const;
PRInt32 FindCharInSet(const nsCString& aString,PRInt32 anOffset=0) const;
- PRInt32 FindCharInSet(const nsString& aString,PRInt32 anOffset=0) const;
/**
@@ -343,9 +321,6 @@ public:
*/
PRInt32 RFind(const char* aCString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
PRInt32 RFind(const nsCString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
- PRInt32 RFind(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
- PRInt32 RFind(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
-
/**
* Search for given char within this string
@@ -365,9 +340,7 @@ public:
* @return -1 if not found, else the offset in this
*/
PRInt32 RFindCharInSet(const char* aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const PRUnichar* aString,PRInt32 anOffset=-1) const;
PRInt32 RFindCharInSet(const nsCString& aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const nsString& aString,PRInt32 anOffset=-1) const;
@@ -383,22 +356,11 @@ public:
* @param aCount tells us how many chars to compare
* @return -1,0,1
*/
- PRInt32 CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRInt32 CompareWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
+ PRInt32 Compare(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRBool EqualsWithConversion(const nsString &aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
PRBool EqualsWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRBool EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- /* a hack to make sure things that used to compile continue to compile
- even on compilers that don't have proper |explicit| support */
- inline PRBool
- EqualsWithConversion(const nsXPIDLString &aString, PRBool aIgnoreCase=PR_FALSE, PRInt32 aCount=-1) const
- {
- return EqualsWithConversion(aString.get(), aIgnoreCase, aCount);
- }
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
- PRBool EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aCount=-1) const;
@@ -414,9 +376,7 @@ private:
// NOT TO BE IMPLEMENTED
// these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion
void operator=( PRUnichar );
- void AssignWithConversion( char );
void AssignWithConversion( const char*, PRInt32=-1 );
- void AppendWithConversion( char );
void InsertWithConversion( char, PRUint32 );
};
diff --git a/mozilla/string/obsolete/nsString2.cpp b/mozilla/string/obsolete/nsString2.cpp
index cf8bd01d9a2..d279ca7b338 100644
--- a/mozilla/string/obsolete/nsString2.cpp
+++ b/mozilla/string/obsolete/nsString2.cpp
@@ -472,20 +472,15 @@ nsString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminateT
}
/**
- * This method strips chars in given set from string.
- * You can control whether chars are yanked from
- * start and end of string as well.
- *
- * @update gess 3/31/98
- * @param aEliminateLeading controls stripping of leading ws
- * @param aEliminateTrailing controls stripping of trailing ws
- * @return this
+ * This method strips chars in given set from string.
*/
-void
-nsString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading,PRBool aEliminateTrailing){
- if(aSet){
- ReplaceChar(aSet,aChar);
- nsStrPrivate::CompressSet2(*this,aSet,aEliminateLeading,aEliminateTrailing);
+static void
+CompressSet(nsString& aStr, const char* aSet, PRUnichar aChar,
+ PRBool aEliminateLeading, PRBool aEliminateTrailing) {
+ if (aSet) {
+ aStr.ReplaceChar(aSet, aChar);
+ nsStrPrivate::CompressSet2(aStr, aSet,
+ aEliminateLeading, aEliminateTrailing);
}
}
@@ -501,7 +496,7 @@ nsString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading
*/
void
nsString::CompressWhitespace( PRBool aEliminateLeading,PRBool aEliminateTrailing){
- CompressSet(kWhitespace,' ',aEliminateLeading,aEliminateTrailing);
+ CompressSet(*this, kWhitespace,' ', aEliminateLeading, aEliminateTrailing);
}
/**********************************************************************
@@ -695,18 +690,6 @@ void nsString::AssignWithConversion(const char* aCString) {
}
-/**
- * assign given char to this string
- * @update gess 01/04/99
- * @param aChar: char to be assignd to this
- * @return this
- */
-void nsString::AssignWithConversion(char aChar) {
- nsStrPrivate::StrTruncate(*this,0);
- AppendWithConversion(aChar);
-}
-
-
/**
* append given c-string to this string
* @update gess 01/04/99
@@ -743,23 +726,6 @@ void nsString::AppendWithConversion(const char* aCString,PRInt32 aCount) {
}
}
-/**
- * append given char to this string
- * @update gess 01/04/99
- * @param aChar: char to be appended
- * @return this
- */
-void nsString::AppendWithConversion(char aChar) {
- char buf[2]={0,0};
- buf[0]=aChar;
-
- nsStr temp;
- nsStrPrivate::Initialize(temp,eOneByte);
- temp.mStr=buf;
- temp.mLength=1;
- nsStrPrivate::StrAppend(*this,temp,0,1);
-}
-
/**
* Append the given integer to this string
* @update gess 01/04/99
@@ -916,21 +882,6 @@ PRInt32 nsString::Find(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 anOff
return result;
}
-/**
- * Search for given string within this string
- *
- * @update gess 3/25/98
- * @param aString - substr to be found
- * @param aIgnoreCase tells us whether or not to do caseless compare
- * @param anOffset tells us where in this string to start searching
- * @param aCount tells us how many iterations to make starting at the given offset
- * @return offset in string, or -1 (kNotFound)
- */
-PRInt32 nsString::Find(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::FindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
/**
* search for given string within this string
*
@@ -992,41 +943,6 @@ PRInt32 nsString::FindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) co
return result;
}
-/**
- * This method finds the offset of the first char in this string that is
- * a member of the given charset, starting the search at anOffset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset -- where in this string to start searching
- * @return
- */
-PRInt32 nsString::FindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::FindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
-PRInt32 nsString::FindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::FindCharInSet1(*this,aSet,PR_FALSE,anOffset);
- return result;
-}
-
-
-/**
- * Reverse search for given string within this string
- *
- * @update gess 3/25/98
- * @param aString - substr to be found
- * @param aIgnoreCase tells us whether or not to do caseless compare
- * @param anOffset tells us where in this string to start searching
- * @param aCount tells us how many iterations to make starting at the given offset
- * @return offset in string, or -1 (kNotFound)
- */
-PRInt32 nsString::RFind(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::RFindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
/**
* Reverse search for given string within this string
*
@@ -1042,6 +958,19 @@ PRInt32 nsString::RFind(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOff
return result;
}
+PRInt32 nsString::RFind(const PRUnichar* aString, PRBool aIgnoreCase, PRInt32 anOffset, PRInt32 aCount) const
+{
+ PRInt32 result=kNotFound;
+ if (aString) {
+ nsStr temp;
+ nsStrPrivate::Initialize(temp, eTwoByte);
+ temp.mLength = nsCRT::strlen(aString);
+ temp.mUStr = NS_CONST_CAST(PRUnichar*, aString);
+ result=nsStrPrivate::RFindSubstr2in2(*this,temp,aIgnoreCase,anOffset,aCount);
+ }
+ return result;
+}
+
/**
* Reverse search for given string within this string
*
@@ -1080,48 +1009,6 @@ PRInt32 nsString::RFindChar(PRUnichar aChar,PRInt32 anOffset,PRInt32 aCount) con
return result;
}
-/**
- * Reverse search for char in this string that is also a member of given charset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
-PRInt32 nsString::RFindCharInSet(const char* aCStringSet,PRInt32 anOffset) const{
- NS_ASSERTION(0!=aCStringSet,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aCStringSet) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eOneByte);
- temp.mLength=strlen(aCStringSet);
- temp.mStr=(char*)aCStringSet;
- result=nsStrPrivate::RFindCharInSet1(*this,temp,PR_FALSE,anOffset);
- }
- return result;
-}
-
-/**
- * Reverse search for a first char in this string that is a
- * member of the given char set
- *
- * @update gess 3/25/98
- * @param aSet
- * @param aIgnoreCase
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
-PRInt32 nsString::RFindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::RFindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
-PRInt32 nsString::RFindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::RFindCharInSet1(*this,aSet,PR_FALSE,anOffset);
- return result;
-}
-
/**
* Reverse search for a first char in this string that is a
* member of the given char set
@@ -1176,20 +1063,7 @@ PRInt32 nsString::CompareWithConversion(const char *aCString,PRBool aIgnoreCase,
}
/**
- * Compares given cstring to this string.
- * @update gess 01/04/99
- * @param aCString pts to a cstring
- * @param aIgnoreCase tells us how to treat case
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return -1,0,1
- */
-PRInt32 nsString::CompareWithConversion(const nsString& aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 result=nsStrPrivate::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
- return result;
-}
-
-/**
- * Compares given unistring to this string.
+ * Compares given unistring to this string.
* @update gess 01/04/99
* @param aString pts to a uni-string
* @param aIgnoreCase tells us how to treat case
@@ -1210,31 +1084,14 @@ PRInt32 nsString::CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreC
return 0;
}
-
-
PRBool nsString::EqualsIgnoreCase(const nsString& aString) const {
- return EqualsWithConversion(aString,PR_TRUE);
+ return CompareWithConversion(aString.get(), PR_TRUE) == 0;
}
PRBool nsString::EqualsIgnoreCase(const char* aString,PRInt32 aLength) const {
return EqualsWithConversion(aString,PR_TRUE,aLength);
}
-/**
- * Compare this to given string; note that we compare full strings here.
- *
- * @update gess 01/04/99
- * @param aString is the other nsString to be compared to
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return TRUE if equal
- */
-PRBool nsString::EqualsWithConversion(const nsString& aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=nsStrPrivate::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
- PRBool result=PRBool(0==theAnswer);
- return result;
-
-}
-
/**
* Compare this to given c-string; note that we compare full strings here.
*
@@ -1249,20 +1106,6 @@ PRBool nsString::EqualsWithConversion(const char* aString,PRBool aIgnoreCase,PRI
return result;
}
-/**
- * Compare this to given unicode string; note that we compare full strings here.
- *
- * @param aString is the U-String to be compared
- * @param aIgnorecase tells us whether to be case sensitive
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return TRUE if equal
- */
-PRBool nsString::EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=CompareWithConversion(aString,aIgnoreCase,aCount);
- PRBool result=PRBool(0==theAnswer);
- return result;
-}
-
PRInt32 Compare2To2(const PRUnichar* aStr1,const PRUnichar* aStr2,PRUint32 aCount,PRBool aIgnoreCase);
/**
* Compare this to given atom; note that we compare full strings here.
@@ -1290,26 +1133,6 @@ PRBool nsString::EqualsAtom(/*FIX: const */nsIAtom* aAtom,PRBool aIgnoreCase) co
return result;
}
-PRBool nsString::EqualsIgnoreCase(/*FIX: const */nsIAtom *aAtom) const {
- return EqualsAtom(aAtom,PR_TRUE);
-}
-
-
-/**
- * Determine if given char in valid alpha range
- *
- * @update gess 3/31/98
- * @param aChar is character to be tested
- * @return TRUE if in alpha range
- */
-PRBool nsString::IsAlpha(PRUnichar aChar) {
- // XXX i18n
- if (((aChar >= 'A') && (aChar <= 'Z')) || ((aChar >= 'a') && (aChar <= 'z'))) {
- return PR_TRUE;
- }
- return PR_FALSE;
-}
-
/**
* Determine if given char is a valid space character
*
@@ -1359,19 +1182,6 @@ PRBool nsString::IsASCII(const PRUnichar* aBuffer) {
}
-/**
- * Determine if given char is valid digit
- *
- * @update gess 3/31/98
- * @param aChar is character to be tested
- * @return TRUE if char is a valid digit
- */
-PRBool nsString::IsDigit(PRUnichar aChar) {
- // XXX i18n
- return PRBool((aChar >= '0') && (aChar <= '9'));
-}
-
-
/***********************************************************************
IMPLEMENTATION NOTES: AUTOSTRING...
***********************************************************************/
diff --git a/mozilla/string/obsolete/nsString2.h b/mozilla/string/obsolete/nsString2.h
index b9375fa918a..2a287bcd891 100644
--- a/mozilla/string/obsolete/nsString2.h
+++ b/mozilla/string/obsolete/nsString2.h
@@ -180,9 +180,6 @@ public:
*/
void StripChars( const char* aSet );
void StripChar( PRUnichar aChar, PRInt32 anOffset=0 );
- void StripChar( char aChar, PRInt32 anOffset=0 ) { StripChar((PRUnichar) (unsigned char)aChar,anOffset); }
- void StripChar( PRInt32 anInt, PRInt32 anOffset=0 ) { StripChar((PRUnichar)anInt,anOffset); }
-
/**
* This method strips whitespace throughout the string
*
@@ -214,17 +211,6 @@ public:
*/
void Trim(const char* aSet,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE,PRBool aIgnoreQuotes=PR_FALSE);
- /**
- * This method strips whitespace from string.
- * You can control whether whitespace is yanked from
- * start and end of string as well.
- *
- * @param aEliminateLeading controls stripping of leading ws
- * @param aEliminateTrailing controls stripping of trailing ws
- * @return this
- */
- void CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE);
-
/**
* This method strips whitespace from string.
* You can control whether whitespace is yanked from
@@ -284,7 +270,6 @@ public:
nsString& operator=( const PRUnichar* aPtr ) { Assign(aPtr); return *this; }
nsString& operator=( PRUnichar aChar ) { Assign(aChar); return *this; }
- void AssignWithConversion(char);
void AssignWithConversion(const char*);
void AssignWithConversion(const char*, PRInt32);
@@ -300,7 +285,6 @@ public:
void AppendInt(PRInt32, PRInt32=10); //radix=8,10 or 16
void AppendFloat(double);
void AppendWithConversion(const char*, PRInt32=-1);
- void AppendWithConversion(char);
virtual void do_AppendFromElement( PRUnichar );
@@ -352,7 +336,6 @@ public:
*/
PRInt32 RFind(const char* aCString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
PRInt32 RFind(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
- PRInt32 RFind(const nsCString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
PRInt32 RFind(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
@@ -375,10 +358,7 @@ public:
* @param anOffset tells us where in this strig to start searching (counting from left)
* @return -1 if not found, else the offset in this
*/
- PRInt32 RFindCharInSet(const char* aString,PRInt32 anOffset=-1) const;
PRInt32 RFindCharInSet(const PRUnichar* aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const nsString& aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const nsCString& aString,PRInt32 anOffset=-1) const;
/**********************************************************************
@@ -394,8 +374,7 @@ public:
* @return -1,0,1
*/
- PRInt32 CompareWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRInt32 CompareWithConversion(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
+ PRInt32 CompareWithConversion(const char* aString, PRBool aIgnoreCase=PR_FALSE, PRInt32 aCount=-1) const;
PRInt32 CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
/* a hack to make sure things that used to compile continue to compile
even on compilers that don't have proper |explicit| support */
@@ -405,24 +384,12 @@ public:
return CompareWithConversion(aString.get(), aIgnoreCase, aCount);
}
- PRBool EqualsWithConversion(const nsString &aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
PRBool EqualsWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRBool EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- /* a hack to make sure things that used to compile continue to compile
- even on compilers that don't have proper |explicit| support */
- inline PRBool
- EqualsWithConversion(const nsXPIDLString &aString, PRBool aIgnoreCase=PR_FALSE, PRInt32 aCount=-1) const
- {
- return EqualsWithConversion(aString.get(), aIgnoreCase, aCount);
- }
-
PRBool EqualsAtom(/*FIX: const */nsIAtom* anAtom,PRBool aIgnoreCase) const;
PRBool EqualsIgnoreCase(const nsString& aString) const;
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
- PRBool EqualsIgnoreCase(/*FIX: const */nsIAtom *aAtom) const;
-
/**
* Determine if given buffer is plain ascii
@@ -440,22 +407,6 @@ public:
*/
static PRBool IsSpace(PRUnichar ch);
- /**
- * Determine if given char in valid alpha range
- *
- * @param aChar is character to be tested
- * @return TRUE if in alpha range
- */
- static PRBool IsAlpha(PRUnichar ch);
-
- /**
- * Determine if given char is valid digit
- *
- * @param aChar is character to be tested
- * @return TRUE if char is a valid digit
- */
- static PRBool IsDigit(PRUnichar ch);
-
#ifdef DEBUG
/**
* Retrieve the size of this string
@@ -468,9 +419,7 @@ private:
// NOT TO BE IMPLEMENTED
// these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion
void operator=( char );
- void AssignWithConversion( PRUnichar );
void AssignWithConversion( const PRUnichar*, PRInt32=-1 );
- void AppendWithConversion( PRUnichar );
void AppendWithConversion( const PRUnichar*, PRInt32=-1 );
void InsertWithConversion( const PRUnichar*, PRUint32, PRInt32=-1 );
};
diff --git a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp
index 0516a176d45..5ae0f380fc6 100644
--- a/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp
+++ b/mozilla/uriloader/exthandler/nsMIMEInfoImpl.cpp
@@ -266,7 +266,7 @@ NS_IMETHODIMP nsMIMEInfoImpl::SetFileExtensions( const char* aExtensions )
nsCString extList( aExtensions );
PRInt32 breakLocation = -1;
- while ( (breakLocation= extList.FindCharInSet( ",",0 ) )!= -1)
+ while ( (breakLocation= extList.FindChar(',') )!= -1)
{
nsCString ext( extList.get(), breakLocation );
mExtensions.AppendCString( ext );
diff --git a/mozilla/xpcom/string/obsolete/nsStr.cpp b/mozilla/xpcom/string/obsolete/nsStr.cpp
index 21bcc6521fc..c2fb371a4be 100644
--- a/mozilla/xpcom/string/obsolete/nsStr.cpp
+++ b/mozilla/xpcom/string/obsolete/nsStr.cpp
@@ -330,45 +330,6 @@ void nsStrPrivate::StrInsert1into2( nsStr& aDest,PRUint32 aDestOffset,const nsSt
}
}
-void nsStrPrivate::StrInsert2into1( nsStr& aDest,PRUint32 aDestOffset,const nsStr& aSource,PRUint32 aSrcOffset,PRInt32 aCount){
- NS_ASSERTION(aSource.GetCharSize() == eTwoByte, "Must be 2 byte");
- NS_ASSERTION(aDest.GetCharSize() == eOneByte, "Must be 1 byte");
- //there are a few cases for insert:
- // 1. You're inserting chars into an empty string (assign)
- // 2. You're inserting onto the end of a string (append)
- // 3. You're inserting onto the 1..n-1 pos of a string (the hard case).
- if(0 aDest.GetCapacity())
- AppendForInsert(aDest, aDestOffset, aSource, aSrcOffset, theLength);
- else {
- //shift the chars right by theDelta...
- ShiftCharsRight(aDest.mStr, aDest.mLength, aDestOffset, theLength);
-
- //now insert new chars, starting at offset
- CopyChars2To1(aDest.mStr,aDestOffset,aSource.mStr,aSrcOffset,theLength);
- }
-
- //finally, make sure to update the string length...
- aDest.mLength+=theLength;
- AddNullTerminator(aDest);
- NSSTR_SEEN(aDest);
- }//if
- //else nothing to do!
- }
- else StrAppend(aDest,aSource,0,aCount);
- }
- else StrAppend(aDest,aSource,0,aCount);
- }
-}
-
void nsStrPrivate::StrInsert2into2( nsStr& aDest,PRUint32 aDestOffset,const nsStr& aSource,PRUint32 aSrcOffset,PRInt32 aCount){
NS_ASSERTION(aSource.GetCharSize() == eTwoByte, "Must be 1 byte");
NS_ASSERTION(aDest.GetCharSize() == eTwoByte, "Must be 2 byte");
@@ -646,45 +607,6 @@ PRInt32 nsStrPrivate::FindSubstr1in1(const nsStr& aDest,const nsStr& aTarget, PR
return kNotFound;
}
-PRInt32 nsStrPrivate::FindSubstr2in1(const nsStr& aDest,const nsStr& aTarget, PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) {
-
- NS_ASSERTION(aDest.GetCharSize() == eOneByte, "Must be 1 byte");
- NS_ASSERTION(aTarget.GetCharSize() == eTwoByte, "Must be 2 byte");
-
- PRInt32 theMaxPos = aDest.mLength-aTarget.mLength; //this is the last pos that is feasible for starting the search, with given lengths...
-
- if (theMaxPos<0) return kNotFound;
-
- if(anOffset<0)
- anOffset=0;
-
- if((aDest.mLength<=0) || (anOffset>theMaxPos) || (aTarget.mLength==0))
- return kNotFound;
-
- if(aCount<0)
- aCount = MaxInt(theMaxPos,1);
-
- if (aCount <= 0)
- return kNotFound;
-
- const char* root = aDest.mStr;
- const char* left = root+anOffset;
- const char* last = left+aCount;
- const char* max = root+theMaxPos;
- const char* right = (last=aDest.mLength) || (aTarget.mLength==0))
- return kNotFound;
-
- if (aCount<=0)
- return kNotFound;
-
- const char* root = aDest.mStr;
- const char* destLast = root+aDest.mLength; //pts to last char in aDest (likely null)
-
- const char* rightmost = root+anOffset;
- const char* min = rightmost-aCount+1;
-
- const char* leftmost = (min2)) {
@@ -405,11 +406,11 @@ nsCString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminate
}
}
- nsStrPrivate::Trim(*this,aTrimSet,aEliminateLeading,aEliminateTrailing);
+ nsStrPrivate::Trim(*this, aTrimSet, aEliminateLeading, aEliminateTrailing);
if(aIgnoreQuotes && theQuotesAreNeeded) {
- InsertWithConversion(theFirstChar,0);
- AppendWithConversion(theLastChar);
+ Insert(theFirstChar, 0);
+ Append(theLastChar);
}
}
@@ -425,11 +426,13 @@ nsCString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminate
* @param aEliminateTrailing controls stripping of trailing ws
* @return this
*/
-void
-nsCString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading,PRBool aEliminateTrailing){
+static void
+CompressSet(nsCString& aStr, const char* aSet, char aChar,
+ PRBool aEliminateLeading, PRBool aEliminateTrailing){
if(aSet){
- ReplaceChar(aSet,aChar);
- nsStrPrivate::CompressSet1(*this,aSet,aEliminateLeading,aEliminateTrailing);
+ aStr.ReplaceChar(aSet, aChar);
+ nsStrPrivate::CompressSet1(aStr, aSet,
+ aEliminateLeading, aEliminateTrailing);
}
}
@@ -445,7 +448,7 @@ nsCString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeadin
*/
void
nsCString::CompressWhitespace( PRBool aEliminateLeading,PRBool aEliminateTrailing){
- CompressSet(kWhitespace,' ',aEliminateLeading,aEliminateTrailing);
+ CompressSet(*this, kWhitespace,' ',aEliminateLeading,aEliminateTrailing);
}
/**********************************************************************
@@ -678,35 +681,6 @@ void nsCString::AppendWithConversion( const nsAString& aString ) {
}
}
-/**
- * assign given unichar to this string
- * @update gess 01/04/99
- * @param aChar: char to be assignd to this
- * @return this
- */
-void nsCString::AssignWithConversion(PRUnichar aChar) {
- nsStrPrivate::StrTruncate(*this,0);
- AppendWithConversion(aChar);
-}
-
-
-/**
- * append given char to this string
- * @update gess 01/04/99
- * @param aChar: char to be appended to this
- * @return this
- */
-void nsCString::AppendWithConversion(PRUnichar aChar) {
- PRUnichar buf[2]={0,0};
- buf[0]=aChar;
-
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mUStr=buf;
- temp.mLength=1;
- nsStrPrivate::StrAppend(*this,temp,0,1);
-}
-
void nsCString::AppendWithConversion( const PRUnichar* aBuffer, PRInt32 aLength )
{
nsStr temp;
@@ -792,26 +766,6 @@ void nsCString::AppendWithConversion(const nsString& aString,PRInt32 aCount) {
nsStrPrivate::StrAppend(*this,aString,0,aCount);
}
-
-/**
- * Insert a single unichar into this string at a specified offset.
- *
- * @update gess4/22/98
- * @param aChar unichar to be inserted into this string
- * @param anOffset is insert pos in str
- * @return this
- */
-void nsCString::InsertWithConversion(PRUnichar aChar,PRUint32 anOffset){
- PRUnichar theBuffer[2]={0,0};
- theBuffer[0]=aChar;
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mUStr=theBuffer;
- temp.mLength=1;
- nsStrPrivate::StrInsert2into1(*this,anOffset,temp,0,1);
-}
-
-
void nsCString::Adopt(char* aPtr, PRInt32 aLength) {
NS_ASSERTION(aPtr, "Can't adopt |0|");
nsStrPrivate::Destroy(*this);
@@ -849,29 +803,6 @@ PRInt32 nsCString::Find(const char* aCString,PRBool aIgnoreCase,PRInt32 anOffset
return result;
}
-/**
- * Search for given buffer within this string
- *
- * @update gess 3/25/98
- * @param aString - substr to be found
- * @param aIgnoreCase tells us whether or not to do caseless compare
- * @param anOffset tells us where in this string to start searching
- * @param aCount tells us how many iterations to make starting at the given offset
- * @return offset in string, or -1 (kNotFound)
- */
-PRInt32 nsCString::Find(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- NS_ASSERTION(0!=aString,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aString) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength = nsCRT::strlen(aString);
- temp.mUStr=(PRUnichar*)aString;
- result=nsStrPrivate::FindSubstr2in1(*this,temp,aIgnoreCase,anOffset,aCount);
- }
- return result;
-}
/**
* Search for given string within this string
@@ -888,12 +819,6 @@ PRInt32 nsCString::Find(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOf
return result;
}
-PRInt32 nsCString::Find(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::FindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
-
/**
* This searches this string for a given character
*
@@ -932,48 +857,11 @@ PRInt32 nsCString::FindCharInSet(const char* aCStringSet,PRInt32 anOffset) const
return result;
}
-/**
- * This method finds the offset of the first char in this string that is
- * a member of the given charset, starting the search at anOffset
- *
- * @update gess 3/25/98
- * @param aStringSet
- * @param anOffset -- where in this string to start searching
- * @return
- */
-PRInt32 nsCString::FindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) const{
- NS_ASSERTION(0!=aStringSet,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aStringSet) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength=nsCRT::strlen(aStringSet);
- temp.mStr=(char*)aStringSet;
- result=nsStrPrivate::FindCharInSet2(*this,temp,anOffset);
- }
- return result;
-}
-
-/**
- * This method finds the offset of the first char in this string that is
- * a member of the given charset, starting the search at anOffset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset -- where in this string to start searching
- * @return
- */
PRInt32 nsCString::FindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::FindCharInSet1(*this,aSet,PR_FALSE,anOffset);
return result;
}
-PRInt32 nsCString::FindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::FindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
/**
* Reverse search for given string within this string
*
@@ -989,11 +877,6 @@ PRInt32 nsCString::RFind(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anO
return result;
}
-PRInt32 nsCString::RFind(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::RFindSubstr2in1(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
/**
* Reverse search for given string within this string
@@ -1056,83 +939,24 @@ PRInt32 nsCString::RFindCharInSet(const char* aCStringSet,PRInt32 anOffset) cons
return result;
}
-/**
- * Reverse search for char in this string that is also a member of given charset
- *
- * @update gess 3/25/98
- * @param aStringSet
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
-PRInt32 nsCString::RFindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) const{
- NS_ASSERTION(0!=aStringSet,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aStringSet) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength=nsCRT::strlen(aStringSet);
- temp.mUStr=(PRUnichar*)aStringSet;
- result=nsStrPrivate::RFindCharInSet2(*this,temp,anOffset);
- }
- return result;
-}
-
-
-/**
- * Reverse search for char in this string that is also a member of given charset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
PRInt32 nsCString::RFindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
PRInt32 result=nsStrPrivate::RFindCharInSet1(*this,aSet,PR_FALSE,anOffset);
return result;
}
-PRInt32 nsCString::RFindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::RFindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
-
/**************************************************************
COMPARISON METHODS...
**************************************************************/
-
/**
- * Compares given unistring to this string.
- * @update gess 01/04/99
- * @param aString pts to a uni-string
- * @param aIgnoreCase tells us how to treat case
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return -1,0,1
- */
-PRInt32 nsCString::CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- NS_ASSERTION(0!=aString,kNullPointerError);
-
- if(aString) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eTwoByte);
- temp.mLength=nsCRT::strlen(aString);
- temp.mUStr=(PRUnichar*)aString;
- return nsStrPrivate::StrCompare1To2(*this,temp,aCount,aIgnoreCase);
- }
- return 0;
-}
-
-/**
- * Compares given cstring to this string.
+ * Compares given cstring to this string.
* @update gess 01/04/99
* @param aCString points to a cstring
* @param aIgnoreCase tells us how to treat case
* @param aCount tells us how many chars to test; -1 implies full length
* @return -1,0,1
*/
-PRInt32 nsCString::CompareWithConversion(const char *aCString,PRBool aIgnoreCase,PRInt32 aCount) const {
+PRInt32 nsCString::Compare(const char *aCString,PRBool aIgnoreCase,PRInt32 aCount) const {
NS_ASSERTION(0!=aCString,kNullPointerError);
if(aCString) {
@@ -1149,12 +973,6 @@ PRBool nsCString::EqualsIgnoreCase(const char* aString,PRInt32 aLength) const {
return EqualsWithConversion(aString,PR_TRUE,aLength);
}
-PRBool nsCString::EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aLength) const {
- return EqualsWithConversion(aString,PR_TRUE,aLength);
-}
-
-
-
/**
* Compare this to given string; note that we compare full strings here.
*
@@ -1165,19 +983,7 @@ PRBool nsCString::EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aLength) con
* @return TRUE if equal
*/
PRBool nsCString::EqualsWithConversion(const char* aCString,PRBool aIgnoreCase,PRInt32 aCount) const{
- PRInt32 theAnswer=CompareWithConversion(aCString,aIgnoreCase,aCount);
- PRBool result=PRBool(0==theAnswer);
- return result;
-}
-
-PRBool nsCString::EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=CompareWithConversion(aString,aIgnoreCase,aCount);
- PRBool result=PRBool(0==theAnswer);
- return result;
-}
-
- PRBool nsCString::EqualsWithConversion(const nsString& aString, PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=CompareWithConversion(aString.get(),aIgnoreCase,aCount);
+ PRInt32 theAnswer=Compare(aCString,aIgnoreCase,aCount);
PRBool result=PRBool(0==theAnswer);
return result;
}
diff --git a/mozilla/xpcom/string/obsolete/nsString.h b/mozilla/xpcom/string/obsolete/nsString.h
index 2f3b512ca59..b390e46350c 100644
--- a/mozilla/xpcom/string/obsolete/nsString.h
+++ b/mozilla/xpcom/string/obsolete/nsString.h
@@ -159,8 +159,7 @@ public:
* @return *this
*/
void StripChars(const char* aSet);
- void StripChar(PRUnichar aChar,PRInt32 anOffset=0);
- void StripChar(char aChar,PRInt32 anOffset=0) { StripChar((PRUnichar) (unsigned char)aChar,anOffset); }
+ void StripChar(char aChar,PRInt32 anOffset=0);
/**
* This method strips whitespace throughout the string
@@ -174,8 +173,8 @@ public:
*
* @return this
*/
- void ReplaceChar(PRUnichar aOldChar,PRUnichar aNewChar);
- void ReplaceChar(const char* aSet,PRUnichar aNewChar);
+ void ReplaceChar(char aOldChar,char aNewChar);
+ void ReplaceChar(const char* aSet,char aNewChar);
void ReplaceSubstring(const nsCString& aTarget,const nsCString& aNewValue);
void ReplaceSubstring(const char* aTarget,const char* aNewValue);
@@ -193,17 +192,6 @@ public:
*/
void Trim(const char* aSet,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE,PRBool aIgnoreQuotes=PR_FALSE);
- /**
- * This method strips whitespace from string.
- * You can control whether whitespace is yanked from
- * start and end of string as well.
- *
- * @param aEliminateLeading controls stripping of leading ws
- * @param aEliminateTrailing controls stripping of trailing ws
- * @return this
- */
- void CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE);
-
/**
* This method strips whitespace from string.
* You can control whether whitespace is yanked from
@@ -258,7 +246,6 @@ public:
void AssignWithConversion(const PRUnichar*,PRInt32=-1);
void AssignWithConversion( const nsString& aString );
void AssignWithConversion( const nsAString& aString );
- void AssignWithConversion(PRUnichar);
/*
* Appends n characters from given string to this,
@@ -271,7 +258,6 @@ public:
*/
void AppendWithConversion(const nsString&, PRInt32=-1);
- void AppendWithConversion(PRUnichar aChar);
void AppendWithConversion( const nsAString& aString );
void AppendWithConversion(const PRUnichar*, PRInt32=-1);
// Why no |AppendWithConversion(const PRUnichar*, PRInt32)|? --- now I know, because implicit construction hid the need for this routine
@@ -279,9 +265,6 @@ public:
void AppendFloat( double aFloat );
- void InsertWithConversion(PRUnichar aChar,PRUint32 anOffset);
- // Why no |InsertWithConversion(PRUnichar*)|?
-
#if 0
virtual void do_AppendFromReadable( const nsACString& );
virtual void do_InsertFromReadable( const nsACString&, PRUint32 );
@@ -306,10 +289,7 @@ public:
* @return offset in string, or -1 (kNotFound)
*/
PRInt32 Find(const nsCString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
- PRInt32 Find(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
PRInt32 Find(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
- PRInt32 Find(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=0,PRInt32 aCount=-1) const;
-
/**
* Search for given char within this string
*
@@ -329,9 +309,7 @@ public:
* @return -1 if not found, else the offset in this
*/
PRInt32 FindCharInSet(const char* aString,PRInt32 anOffset=0) const;
- PRInt32 FindCharInSet(const PRUnichar* aString,PRInt32 anOffset=0) const;
PRInt32 FindCharInSet(const nsCString& aString,PRInt32 anOffset=0) const;
- PRInt32 FindCharInSet(const nsString& aString,PRInt32 anOffset=0) const;
/**
@@ -343,9 +321,6 @@ public:
*/
PRInt32 RFind(const char* aCString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
PRInt32 RFind(const nsCString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
- PRInt32 RFind(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
- PRInt32 RFind(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
-
/**
* Search for given char within this string
@@ -365,9 +340,7 @@ public:
* @return -1 if not found, else the offset in this
*/
PRInt32 RFindCharInSet(const char* aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const PRUnichar* aString,PRInt32 anOffset=-1) const;
PRInt32 RFindCharInSet(const nsCString& aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const nsString& aString,PRInt32 anOffset=-1) const;
@@ -383,22 +356,11 @@ public:
* @param aCount tells us how many chars to compare
* @return -1,0,1
*/
- PRInt32 CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRInt32 CompareWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
+ PRInt32 Compare(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRBool EqualsWithConversion(const nsString &aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
PRBool EqualsWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRBool EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- /* a hack to make sure things that used to compile continue to compile
- even on compilers that don't have proper |explicit| support */
- inline PRBool
- EqualsWithConversion(const nsXPIDLString &aString, PRBool aIgnoreCase=PR_FALSE, PRInt32 aCount=-1) const
- {
- return EqualsWithConversion(aString.get(), aIgnoreCase, aCount);
- }
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
- PRBool EqualsIgnoreCase(const PRUnichar* aString,PRInt32 aCount=-1) const;
@@ -414,9 +376,7 @@ private:
// NOT TO BE IMPLEMENTED
// these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion
void operator=( PRUnichar );
- void AssignWithConversion( char );
void AssignWithConversion( const char*, PRInt32=-1 );
- void AppendWithConversion( char );
void InsertWithConversion( char, PRUint32 );
};
diff --git a/mozilla/xpcom/string/obsolete/nsString2.cpp b/mozilla/xpcom/string/obsolete/nsString2.cpp
index cf8bd01d9a2..d279ca7b338 100644
--- a/mozilla/xpcom/string/obsolete/nsString2.cpp
+++ b/mozilla/xpcom/string/obsolete/nsString2.cpp
@@ -472,20 +472,15 @@ nsString::Trim(const char* aTrimSet, PRBool aEliminateLeading,PRBool aEliminateT
}
/**
- * This method strips chars in given set from string.
- * You can control whether chars are yanked from
- * start and end of string as well.
- *
- * @update gess 3/31/98
- * @param aEliminateLeading controls stripping of leading ws
- * @param aEliminateTrailing controls stripping of trailing ws
- * @return this
+ * This method strips chars in given set from string.
*/
-void
-nsString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading,PRBool aEliminateTrailing){
- if(aSet){
- ReplaceChar(aSet,aChar);
- nsStrPrivate::CompressSet2(*this,aSet,aEliminateLeading,aEliminateTrailing);
+static void
+CompressSet(nsString& aStr, const char* aSet, PRUnichar aChar,
+ PRBool aEliminateLeading, PRBool aEliminateTrailing) {
+ if (aSet) {
+ aStr.ReplaceChar(aSet, aChar);
+ nsStrPrivate::CompressSet2(aStr, aSet,
+ aEliminateLeading, aEliminateTrailing);
}
}
@@ -501,7 +496,7 @@ nsString::CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading
*/
void
nsString::CompressWhitespace( PRBool aEliminateLeading,PRBool aEliminateTrailing){
- CompressSet(kWhitespace,' ',aEliminateLeading,aEliminateTrailing);
+ CompressSet(*this, kWhitespace,' ', aEliminateLeading, aEliminateTrailing);
}
/**********************************************************************
@@ -695,18 +690,6 @@ void nsString::AssignWithConversion(const char* aCString) {
}
-/**
- * assign given char to this string
- * @update gess 01/04/99
- * @param aChar: char to be assignd to this
- * @return this
- */
-void nsString::AssignWithConversion(char aChar) {
- nsStrPrivate::StrTruncate(*this,0);
- AppendWithConversion(aChar);
-}
-
-
/**
* append given c-string to this string
* @update gess 01/04/99
@@ -743,23 +726,6 @@ void nsString::AppendWithConversion(const char* aCString,PRInt32 aCount) {
}
}
-/**
- * append given char to this string
- * @update gess 01/04/99
- * @param aChar: char to be appended
- * @return this
- */
-void nsString::AppendWithConversion(char aChar) {
- char buf[2]={0,0};
- buf[0]=aChar;
-
- nsStr temp;
- nsStrPrivate::Initialize(temp,eOneByte);
- temp.mStr=buf;
- temp.mLength=1;
- nsStrPrivate::StrAppend(*this,temp,0,1);
-}
-
/**
* Append the given integer to this string
* @update gess 01/04/99
@@ -916,21 +882,6 @@ PRInt32 nsString::Find(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 anOff
return result;
}
-/**
- * Search for given string within this string
- *
- * @update gess 3/25/98
- * @param aString - substr to be found
- * @param aIgnoreCase tells us whether or not to do caseless compare
- * @param anOffset tells us where in this string to start searching
- * @param aCount tells us how many iterations to make starting at the given offset
- * @return offset in string, or -1 (kNotFound)
- */
-PRInt32 nsString::Find(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::FindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
/**
* search for given string within this string
*
@@ -992,41 +943,6 @@ PRInt32 nsString::FindCharInSet(const PRUnichar* aStringSet,PRInt32 anOffset) co
return result;
}
-/**
- * This method finds the offset of the first char in this string that is
- * a member of the given charset, starting the search at anOffset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset -- where in this string to start searching
- * @return
- */
-PRInt32 nsString::FindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::FindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
-PRInt32 nsString::FindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::FindCharInSet1(*this,aSet,PR_FALSE,anOffset);
- return result;
-}
-
-
-/**
- * Reverse search for given string within this string
- *
- * @update gess 3/25/98
- * @param aString - substr to be found
- * @param aIgnoreCase tells us whether or not to do caseless compare
- * @param anOffset tells us where in this string to start searching
- * @param aCount tells us how many iterations to make starting at the given offset
- * @return offset in string, or -1 (kNotFound)
- */
-PRInt32 nsString::RFind(const nsCString& aString,PRBool aIgnoreCase,PRInt32 anOffset,PRInt32 aCount) const{
- PRInt32 result=nsStrPrivate::RFindSubstr1in2(*this,aString,aIgnoreCase,anOffset,aCount);
- return result;
-}
-
/**
* Reverse search for given string within this string
*
@@ -1042,6 +958,19 @@ PRInt32 nsString::RFind(const nsString& aString,PRBool aIgnoreCase,PRInt32 anOff
return result;
}
+PRInt32 nsString::RFind(const PRUnichar* aString, PRBool aIgnoreCase, PRInt32 anOffset, PRInt32 aCount) const
+{
+ PRInt32 result=kNotFound;
+ if (aString) {
+ nsStr temp;
+ nsStrPrivate::Initialize(temp, eTwoByte);
+ temp.mLength = nsCRT::strlen(aString);
+ temp.mUStr = NS_CONST_CAST(PRUnichar*, aString);
+ result=nsStrPrivate::RFindSubstr2in2(*this,temp,aIgnoreCase,anOffset,aCount);
+ }
+ return result;
+}
+
/**
* Reverse search for given string within this string
*
@@ -1080,48 +1009,6 @@ PRInt32 nsString::RFindChar(PRUnichar aChar,PRInt32 anOffset,PRInt32 aCount) con
return result;
}
-/**
- * Reverse search for char in this string that is also a member of given charset
- *
- * @update gess 3/25/98
- * @param aCStringSet
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
-PRInt32 nsString::RFindCharInSet(const char* aCStringSet,PRInt32 anOffset) const{
- NS_ASSERTION(0!=aCStringSet,kNullPointerError);
-
- PRInt32 result=kNotFound;
- if(aCStringSet) {
- nsStr temp;
- nsStrPrivate::Initialize(temp,eOneByte);
- temp.mLength=strlen(aCStringSet);
- temp.mStr=(char*)aCStringSet;
- result=nsStrPrivate::RFindCharInSet1(*this,temp,PR_FALSE,anOffset);
- }
- return result;
-}
-
-/**
- * Reverse search for a first char in this string that is a
- * member of the given char set
- *
- * @update gess 3/25/98
- * @param aSet
- * @param aIgnoreCase
- * @param anOffset
- * @return offset of found char, or -1 (kNotFound)
- */
-PRInt32 nsString::RFindCharInSet(const nsString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::RFindCharInSet2(*this,aSet,anOffset);
- return result;
-}
-
-PRInt32 nsString::RFindCharInSet(const nsCString& aSet,PRInt32 anOffset) const{
- PRInt32 result=nsStrPrivate::RFindCharInSet1(*this,aSet,PR_FALSE,anOffset);
- return result;
-}
-
/**
* Reverse search for a first char in this string that is a
* member of the given char set
@@ -1176,20 +1063,7 @@ PRInt32 nsString::CompareWithConversion(const char *aCString,PRBool aIgnoreCase,
}
/**
- * Compares given cstring to this string.
- * @update gess 01/04/99
- * @param aCString pts to a cstring
- * @param aIgnoreCase tells us how to treat case
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return -1,0,1
- */
-PRInt32 nsString::CompareWithConversion(const nsString& aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 result=nsStrPrivate::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
- return result;
-}
-
-/**
- * Compares given unistring to this string.
+ * Compares given unistring to this string.
* @update gess 01/04/99
* @param aString pts to a uni-string
* @param aIgnoreCase tells us how to treat case
@@ -1210,31 +1084,14 @@ PRInt32 nsString::CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreC
return 0;
}
-
-
PRBool nsString::EqualsIgnoreCase(const nsString& aString) const {
- return EqualsWithConversion(aString,PR_TRUE);
+ return CompareWithConversion(aString.get(), PR_TRUE) == 0;
}
PRBool nsString::EqualsIgnoreCase(const char* aString,PRInt32 aLength) const {
return EqualsWithConversion(aString,PR_TRUE,aLength);
}
-/**
- * Compare this to given string; note that we compare full strings here.
- *
- * @update gess 01/04/99
- * @param aString is the other nsString to be compared to
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return TRUE if equal
- */
-PRBool nsString::EqualsWithConversion(const nsString& aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=nsStrPrivate::StrCompare2To2(*this,aString,aCount,aIgnoreCase);
- PRBool result=PRBool(0==theAnswer);
- return result;
-
-}
-
/**
* Compare this to given c-string; note that we compare full strings here.
*
@@ -1249,20 +1106,6 @@ PRBool nsString::EqualsWithConversion(const char* aString,PRBool aIgnoreCase,PRI
return result;
}
-/**
- * Compare this to given unicode string; note that we compare full strings here.
- *
- * @param aString is the U-String to be compared
- * @param aIgnorecase tells us whether to be case sensitive
- * @param aCount tells us how many chars to test; -1 implies full length
- * @return TRUE if equal
- */
-PRBool nsString::EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase,PRInt32 aCount) const {
- PRInt32 theAnswer=CompareWithConversion(aString,aIgnoreCase,aCount);
- PRBool result=PRBool(0==theAnswer);
- return result;
-}
-
PRInt32 Compare2To2(const PRUnichar* aStr1,const PRUnichar* aStr2,PRUint32 aCount,PRBool aIgnoreCase);
/**
* Compare this to given atom; note that we compare full strings here.
@@ -1290,26 +1133,6 @@ PRBool nsString::EqualsAtom(/*FIX: const */nsIAtom* aAtom,PRBool aIgnoreCase) co
return result;
}
-PRBool nsString::EqualsIgnoreCase(/*FIX: const */nsIAtom *aAtom) const {
- return EqualsAtom(aAtom,PR_TRUE);
-}
-
-
-/**
- * Determine if given char in valid alpha range
- *
- * @update gess 3/31/98
- * @param aChar is character to be tested
- * @return TRUE if in alpha range
- */
-PRBool nsString::IsAlpha(PRUnichar aChar) {
- // XXX i18n
- if (((aChar >= 'A') && (aChar <= 'Z')) || ((aChar >= 'a') && (aChar <= 'z'))) {
- return PR_TRUE;
- }
- return PR_FALSE;
-}
-
/**
* Determine if given char is a valid space character
*
@@ -1359,19 +1182,6 @@ PRBool nsString::IsASCII(const PRUnichar* aBuffer) {
}
-/**
- * Determine if given char is valid digit
- *
- * @update gess 3/31/98
- * @param aChar is character to be tested
- * @return TRUE if char is a valid digit
- */
-PRBool nsString::IsDigit(PRUnichar aChar) {
- // XXX i18n
- return PRBool((aChar >= '0') && (aChar <= '9'));
-}
-
-
/***********************************************************************
IMPLEMENTATION NOTES: AUTOSTRING...
***********************************************************************/
diff --git a/mozilla/xpcom/string/obsolete/nsString2.h b/mozilla/xpcom/string/obsolete/nsString2.h
index b9375fa918a..2a287bcd891 100644
--- a/mozilla/xpcom/string/obsolete/nsString2.h
+++ b/mozilla/xpcom/string/obsolete/nsString2.h
@@ -180,9 +180,6 @@ public:
*/
void StripChars( const char* aSet );
void StripChar( PRUnichar aChar, PRInt32 anOffset=0 );
- void StripChar( char aChar, PRInt32 anOffset=0 ) { StripChar((PRUnichar) (unsigned char)aChar,anOffset); }
- void StripChar( PRInt32 anInt, PRInt32 anOffset=0 ) { StripChar((PRUnichar)anInt,anOffset); }
-
/**
* This method strips whitespace throughout the string
*
@@ -214,17 +211,6 @@ public:
*/
void Trim(const char* aSet,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE,PRBool aIgnoreQuotes=PR_FALSE);
- /**
- * This method strips whitespace from string.
- * You can control whether whitespace is yanked from
- * start and end of string as well.
- *
- * @param aEliminateLeading controls stripping of leading ws
- * @param aEliminateTrailing controls stripping of trailing ws
- * @return this
- */
- void CompressSet(const char* aSet, PRUnichar aChar,PRBool aEliminateLeading=PR_TRUE,PRBool aEliminateTrailing=PR_TRUE);
-
/**
* This method strips whitespace from string.
* You can control whether whitespace is yanked from
@@ -284,7 +270,6 @@ public:
nsString& operator=( const PRUnichar* aPtr ) { Assign(aPtr); return *this; }
nsString& operator=( PRUnichar aChar ) { Assign(aChar); return *this; }
- void AssignWithConversion(char);
void AssignWithConversion(const char*);
void AssignWithConversion(const char*, PRInt32);
@@ -300,7 +285,6 @@ public:
void AppendInt(PRInt32, PRInt32=10); //radix=8,10 or 16
void AppendFloat(double);
void AppendWithConversion(const char*, PRInt32=-1);
- void AppendWithConversion(char);
virtual void do_AppendFromElement( PRUnichar );
@@ -352,7 +336,6 @@ public:
*/
PRInt32 RFind(const char* aCString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
PRInt32 RFind(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
- PRInt32 RFind(const nsCString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
PRInt32 RFind(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 anOffset=-1,PRInt32 aCount=-1) const;
@@ -375,10 +358,7 @@ public:
* @param anOffset tells us where in this strig to start searching (counting from left)
* @return -1 if not found, else the offset in this
*/
- PRInt32 RFindCharInSet(const char* aString,PRInt32 anOffset=-1) const;
PRInt32 RFindCharInSet(const PRUnichar* aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const nsString& aString,PRInt32 anOffset=-1) const;
- PRInt32 RFindCharInSet(const nsCString& aString,PRInt32 anOffset=-1) const;
/**********************************************************************
@@ -394,8 +374,7 @@ public:
* @return -1,0,1
*/
- PRInt32 CompareWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRInt32 CompareWithConversion(const nsString& aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
+ PRInt32 CompareWithConversion(const char* aString, PRBool aIgnoreCase=PR_FALSE, PRInt32 aCount=-1) const;
PRInt32 CompareWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
/* a hack to make sure things that used to compile continue to compile
even on compilers that don't have proper |explicit| support */
@@ -405,24 +384,12 @@ public:
return CompareWithConversion(aString.get(), aIgnoreCase, aCount);
}
- PRBool EqualsWithConversion(const nsString &aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
PRBool EqualsWithConversion(const char* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- PRBool EqualsWithConversion(const PRUnichar* aString,PRBool aIgnoreCase=PR_FALSE,PRInt32 aCount=-1) const;
- /* a hack to make sure things that used to compile continue to compile
- even on compilers that don't have proper |explicit| support */
- inline PRBool
- EqualsWithConversion(const nsXPIDLString &aString, PRBool aIgnoreCase=PR_FALSE, PRInt32 aCount=-1) const
- {
- return EqualsWithConversion(aString.get(), aIgnoreCase, aCount);
- }
-
PRBool EqualsAtom(/*FIX: const */nsIAtom* anAtom,PRBool aIgnoreCase) const;
PRBool EqualsIgnoreCase(const nsString& aString) const;
PRBool EqualsIgnoreCase(const char* aString,PRInt32 aCount=-1) const;
- PRBool EqualsIgnoreCase(/*FIX: const */nsIAtom *aAtom) const;
-
/**
* Determine if given buffer is plain ascii
@@ -440,22 +407,6 @@ public:
*/
static PRBool IsSpace(PRUnichar ch);
- /**
- * Determine if given char in valid alpha range
- *
- * @param aChar is character to be tested
- * @return TRUE if in alpha range
- */
- static PRBool IsAlpha(PRUnichar ch);
-
- /**
- * Determine if given char is valid digit
- *
- * @param aChar is character to be tested
- * @return TRUE if char is a valid digit
- */
- static PRBool IsDigit(PRUnichar ch);
-
#ifdef DEBUG
/**
* Retrieve the size of this string
@@ -468,9 +419,7 @@ private:
// NOT TO BE IMPLEMENTED
// these signatures help clients not accidentally call the wrong thing helped by C++ automatic integral promotion
void operator=( char );
- void AssignWithConversion( PRUnichar );
void AssignWithConversion( const PRUnichar*, PRInt32=-1 );
- void AppendWithConversion( PRUnichar );
void AppendWithConversion( const PRUnichar*, PRInt32=-1 );
void InsertWithConversion( const PRUnichar*, PRUint32, PRInt32=-1 );
};
diff --git a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp
index b0a946c8c7c..6a87c34e801 100644
--- a/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp
+++ b/mozilla/xpfe/components/bookmarks/src/nsBookmarksService.cpp
@@ -2182,15 +2182,15 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
nsCOMPtr httpChannel = do_QueryInterface(channel);
if (httpChannel)
{
- nsCAutoString eTagValue, lastModValue, contentLengthValue;
+ nsAutoString eTagValue, lastModValue, contentLengthValue;
nsXPIDLCString val;
if (NS_SUCCEEDED(httpChannel->GetResponseHeader("ETag", getter_Copies(val))))
- eTagValue = val;
+ CopyASCIItoUCS2(val, eTagValue);
if (NS_SUCCEEDED(httpChannel->GetResponseHeader("Last-Modified", getter_Copies(val))))
- lastModValue = val;
+ CopyASCIItoUCS2(val, lastModValue);
if (NS_SUCCEEDED(httpChannel->GetResponseHeader("Content-Length", getter_Copies(val))))
- contentLengthValue = val;
+ CopyASCIItoUCS2(val, contentLengthValue);
val.Adopt(0);
PRBool changedFlag = PR_FALSE;
@@ -2203,7 +2203,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
if (eTagValue.Length() > 0)
{
#ifdef DEBUG_BOOKMARK_PING_OUTPUT
- printf("eTag: '%s'\n", eTagValue.get());
+ printf("eTag: '%s'\n", NS_LossyConvertASCIItoUCS2(eTagValue).get());
#endif
nsAutoString eTagStr;
nsCOMPtr currentETagNode;
@@ -2213,13 +2213,15 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
nsCOMPtr currentETagLit = do_QueryInterface(currentETagNode);
if (currentETagLit)
{
- const PRUnichar *currentETagStr = nsnull;
+ const PRUnichar* currentETagStr = nsnull;
currentETagLit->GetValueConst(¤tETagStr);
- if ((currentETagStr) && (!eTagValue.EqualsIgnoreCase(currentETagStr)))
+ if ((currentETagStr) &&
+ !eTagValue.Equals(nsDependentString(currentETagStr),
+ nsCaseInsensitiveStringComparator()))
{
changedFlag = PR_TRUE;
}
- eTagStr.AssignWithConversion(eTagValue.get());
+ eTagStr.Assign(eTagValue);
nsCOMPtr newETagLiteral;
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(eTagStr.get(),
getter_AddRefs(newETagLiteral))))
@@ -2231,7 +2233,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
}
else
{
- eTagStr.AssignWithConversion(eTagValue.get());
+ eTagStr.Assign(eTagValue);
nsCOMPtr newETagLiteral;
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(eTagStr.get(),
getter_AddRefs(newETagLiteral))))
@@ -2257,13 +2259,15 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
nsCOMPtr currentLastModLit = do_QueryInterface(currentLastModNode);
if (currentLastModLit)
{
- const PRUnichar *currentLastModStr = nsnull;
+ const PRUnichar* currentLastModStr = nsnull;
currentLastModLit->GetValueConst(¤tLastModStr);
- if ((currentLastModStr) && (!lastModValue.EqualsIgnoreCase(currentLastModStr)))
+ if ((currentLastModStr) &&
+ !lastModValue.Equals(nsDependentString(currentLastModStr),
+ nsCaseInsensitiveStringComparator()))
{
changedFlag = PR_TRUE;
}
- lastModStr.AssignWithConversion(lastModValue.get());
+ lastModStr.Assign(lastModValue);
nsCOMPtr newLastModLiteral;
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(lastModStr.get(),
getter_AddRefs(newLastModLiteral))))
@@ -2275,7 +2279,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
}
else
{
- lastModStr.AssignWithConversion(lastModValue.get());
+ lastModStr.Assign(lastModValue);
nsCOMPtr newLastModLiteral;
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(lastModStr.get(),
getter_AddRefs(newLastModLiteral))))
@@ -2301,11 +2305,13 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
{
const PRUnichar *currentContentLengthStr = nsnull;
currentContentLengthLit->GetValueConst(¤tContentLengthStr);
- if ((currentContentLengthStr) && (!contentLengthValue.EqualsIgnoreCase(currentContentLengthStr)))
+ if ((currentContentLengthStr) &&
+ !contentLengthValue.Equals(nsDependentString(currentContentLengthStr),
+ nsCaseInsensitiveStringComparator()))
{
changedFlag = PR_TRUE;
}
- contentLenStr.AssignWithConversion(contentLengthValue.get());
+ contentLenStr.Assign(contentLengthValue);
nsCOMPtr newContentLengthLiteral;
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(contentLenStr.get(),
getter_AddRefs(newContentLengthLiteral))))
@@ -2317,7 +2323,7 @@ nsBookmarksService::OnStopRequest(nsIRequest* request, nsISupports *ctxt,
}
else
{
- contentLenStr.AssignWithConversion(contentLengthValue.get());
+ contentLenStr.Assign(contentLengthValue);
nsCOMPtr newContentLengthLiteral;
if (NS_SUCCEEDED(rv = gRDF->GetLiteral(contentLenStr.get(),
getter_AddRefs(newContentLengthLiteral))))
diff --git a/mozilla/xpinstall/src/nsInstallFolder.cpp b/mozilla/xpinstall/src/nsInstallFolder.cpp
index b196c2d7007..bc2256cf248 100644
--- a/mozilla/xpinstall/src/nsInstallFolder.cpp
+++ b/mozilla/xpinstall/src/nsInstallFolder.cpp
@@ -638,7 +638,7 @@ nsInstallFolder::ToString(nsAutoString* outString)
if (!flagIsFile)
{
// assume directory, thus end with slash.
- outString->AppendWithConversion(FILESEP);
+ outString->Append(PRUnichar(FILESEP));
}
return rv;