From 2dd2265b495208e69cb04e3fb3700aa5b154405f Mon Sep 17 00:00:00 2001 From: "rickg%netscape.com" Date: Tue, 20 Apr 1999 07:20:21 +0000 Subject: [PATCH] sync with nsString2 API git-svn-id: svn://10.0.0.236/trunk@28234 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/chrome/src/nsChromeRegistry.cpp | 4 ++-- mozilla/editor/base/nsTextEditRules.cpp | 2 +- mozilla/editor/libeditor/text/nsTextEditRules.cpp | 2 +- mozilla/layout/generic/nsFrame.cpp | 2 +- mozilla/layout/html/base/src/nsFrame.cpp | 2 +- mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp | 4 ++-- mozilla/mailnews/compose/src/msgCompGlue.cpp | 2 +- mozilla/mailnews/local/src/nsLocalMailFolder.cpp | 3 ++- mozilla/rdf/base/src/rdfutil.cpp | 4 ++-- mozilla/rdf/chrome/src/nsChromeRegistry.cpp | 4 ++-- mozilla/rdf/content/src/nsRDFXULBuilder.cpp | 4 ++-- mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp | 4 ++-- mozilla/webshell/tests/viewer/nsWebCrawler.cpp | 2 +- 13 files changed, 20 insertions(+), 19 deletions(-) diff --git a/mozilla/chrome/src/nsChromeRegistry.cpp b/mozilla/chrome/src/nsChromeRegistry.cpp index c3e5d6fe13e..aa1f5dbb644 100644 --- a/mozilla/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/chrome/src/nsChromeRegistry.cpp @@ -276,7 +276,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL) PRInt32 length = chromeBase.Length(); if (length > 0) { - PRUnichar c = chromeBase[length-1]; + PRUnichar c = chromeBase.CharAt(length-1); if (c != '/') chromeBase += "/"; // Ensure that a slash is present. } @@ -289,7 +289,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL) PRInt32 length = restOfURL.Length(); if (length > 0) { - PRUnichar c = restOfURL[length-1]; + PRUnichar c = restOfURL.CharAt(length-1); if (c != '/') restOfURL += "/"; // Ensure that a slash is present. } diff --git a/mozilla/editor/base/nsTextEditRules.cpp b/mozilla/editor/base/nsTextEditRules.cpp index f048b5e699d..3ba14a19847 100644 --- a/mozilla/editor/base/nsTextEditRules.cpp +++ b/mozilla/editor/base/nsTextEditRules.cpp @@ -84,7 +84,7 @@ PRBool nsTextEditRules::IsEditable(nsIDOMNode *aNode) if (0==data.Length()) { return PR_FALSE; } - if ('\n'==data[0]) { + if ('\n'==data.CharAt(0)) { return PR_FALSE; } else { diff --git a/mozilla/editor/libeditor/text/nsTextEditRules.cpp b/mozilla/editor/libeditor/text/nsTextEditRules.cpp index f048b5e699d..3ba14a19847 100644 --- a/mozilla/editor/libeditor/text/nsTextEditRules.cpp +++ b/mozilla/editor/libeditor/text/nsTextEditRules.cpp @@ -84,7 +84,7 @@ PRBool nsTextEditRules::IsEditable(nsIDOMNode *aNode) if (0==data.Length()) { return PR_FALSE; } - if ('\n'==data[0]) { + if ('\n'==data.CharAt(0)) { return PR_FALSE; } else { diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index e6df6f6ca41..86574915ff7 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -1449,7 +1449,7 @@ nsFrame::XMLQuote(nsString& aString) { PRInt32 i, len = aString.Length(); for (i = 0; i < len; i++) { - PRUnichar ch = aString[i]; + PRUnichar ch = aString.CharAt(i); if (ch == '<') { nsAutoString tmp("<"); aString.Cut(i, 1); diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index e6df6f6ca41..86574915ff7 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -1449,7 +1449,7 @@ nsFrame::XMLQuote(nsString& aString) { PRInt32 i, len = aString.Length(); for (i = 0; i < len; i++) { - PRUnichar ch = aString[i]; + PRUnichar ch = aString.CharAt(i); if (ch == '<') { nsAutoString tmp("<"); aString.Cut(i, 1); diff --git a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp index de23907942b..ef70bb77fd0 100644 --- a/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp +++ b/mozilla/layout/xul/base/src/nsTitledButtonFrame.cpp @@ -514,7 +514,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext& aPresContext, nsIRen int i = 0; for (i = 0; i < length; i++) { - PRUnichar ch = mTitle[i]; + PRUnichar ch = mTitle.CharAt(i); aRenderingContext.GetWidth(ch,cwidth); if (twidth + cwidth > aWidth) break; @@ -541,7 +541,7 @@ nsTitledButtonFrame::CalculateTitleForWidth(nsIPresContext& aPresContext, nsIRen int i = length-1; for (i=length-1; i >= 0; i--) { - PRUnichar ch = mTitle[i]; + PRUnichar ch = mTitle.CharAt(i); aRenderingContext.GetWidth(ch,cwidth); if (twidth + cwidth > aWidth) break; diff --git a/mozilla/mailnews/compose/src/msgCompGlue.cpp b/mozilla/mailnews/compose/src/msgCompGlue.cpp index e615504c1e8..4094eb6eadc 100644 --- a/mozilla/mailnews/compose/src/msgCompGlue.cpp +++ b/mozilla/mailnews/compose/src/msgCompGlue.cpp @@ -271,7 +271,7 @@ PRBool INTL_7bit_data_part(const char *charset, const char *inString, const PRUi PR_Free(aCString); if (NS_SUCCEEDED(res)) { for (PRInt32 i = 0; i < outString.Length(); i++) { - if (outString[i] > 127) { + if (outString.CharAt(i) > 127) { return PR_FALSE; } } diff --git a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp index df238c1de49..968b86c0729 100644 --- a/mozilla/mailnews/local/src/nsLocalMailFolder.cpp +++ b/mozilla/mailnews/local/src/nsLocalMailFolder.cpp @@ -122,7 +122,8 @@ NS_IMETHODIMP nsMsgLocalMailFolder::QueryInterface(REFNSIID aIID, void** aInstan static PRBool nsShouldIgnoreFile(nsString& name) { - if (name[0] == '.' || name[0] == '#' || name[name.Length() - 1] == '~') + PRUnichar firstChar=name.CharAt(0); + if (firstChar == '.' || firstChar == '#' || name.CharAt(name.Length() - 1) == '~') return PR_TRUE; if (name.EqualsIgnoreCase("rules.dat")) diff --git a/mozilla/rdf/base/src/rdfutil.cpp b/mozilla/rdf/base/src/rdfutil.cpp index a843795d164..b9905034611 100644 --- a/mozilla/rdf/base/src/rdfutil.cpp +++ b/mozilla/rdf/base/src/rdfutil.cpp @@ -303,11 +303,11 @@ rdf_IsAnonymousResource(const nsString& aContextURI, nsIRDFResource* aResource) uri.Cut(0, aContextURI.Length()); // Anonymous resources look like the regexp "\$[0-9]+" - if (uri[0] != '#' || uri[1] != '$') + if (uri.CharAt(0) != '#' || uri.CharAt(1) != '$') return PR_FALSE; for (PRInt32 i = uri.Length() - 1; i >= 1; --i) { - if (uri[i] < '0' || uri[i] > '9') + if (uri.CharAt(i) < '0' || uri.CharAt(i) > '9') return PR_FALSE; } diff --git a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp index c3e5d6fe13e..aa1f5dbb644 100644 --- a/mozilla/rdf/chrome/src/nsChromeRegistry.cpp +++ b/mozilla/rdf/chrome/src/nsChromeRegistry.cpp @@ -276,7 +276,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL) PRInt32 length = chromeBase.Length(); if (length > 0) { - PRUnichar c = chromeBase[length-1]; + PRUnichar c = chromeBase.CharAt(length-1); if (c != '/') chromeBase += "/"; // Ensure that a slash is present. } @@ -289,7 +289,7 @@ nsChromeRegistry::ConvertChromeURL(nsIURL* aChromeURL) PRInt32 length = restOfURL.Length(); if (length > 0) { - PRUnichar c = restOfURL[length-1]; + PRUnichar c = restOfURL.CharAt(length-1); if (c != '/') restOfURL += "/"; // Ensure that a slash is present. } diff --git a/mozilla/rdf/content/src/nsRDFXULBuilder.cpp b/mozilla/rdf/content/src/nsRDFXULBuilder.cpp index 58c1134bfba..87465c8f0e6 100644 --- a/mozilla/rdf/content/src/nsRDFXULBuilder.cpp +++ b/mozilla/rdf/content/src/nsRDFXULBuilder.cpp @@ -2247,14 +2247,14 @@ RDFXULBuilderImpl::CreateBuilder(const nsCID& aBuilderCID, nsIContent* aElement, PRInt32 first = 0; while(1) { - while (first < aDataSources.Length() && nsString::IsSpace(aDataSources[first])) + while (first < aDataSources.Length() && nsString::IsSpace(aDataSources.CharAt(first))) ++first; if (first >= aDataSources.Length()) break; PRInt32 last = first; - while (last < aDataSources.Length() && !nsString::IsSpace(aDataSources[last])) + while (last < aDataSources.Length() && !nsString::IsSpace(aDataSources.CharAt(last))) ++last; nsAutoString uri; diff --git a/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp b/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp index 8c350b49fa8..d2a3f120970 100644 --- a/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp +++ b/mozilla/rdf/datasource/src/nsBookmarkDataSource.cpp @@ -250,9 +250,9 @@ BookmarkParser::Parse(nsIRDFResource* aContainer) rv = ParseBookmark(line, aContainer); } else if ((offset = line.Find(kOpenHeading)) >= 0 && - nsString::IsDigit(line[offset + 2])) { + nsString::IsDigit(line.CharAt(offset + 2))) { // XXX Ignore

so that bookmarks root _is_

- if (line[offset + 2] != PRUnichar('1')) + if (line.CharAt(offset + 2) != PRUnichar('1')) rv = ParseBookmarkHeader(line, aContainer); } else if ((offset = line.Find(kSeparator)) >= 0) { diff --git a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp index ec062235129..8b42336b1ea 100644 --- a/mozilla/webshell/tests/viewer/nsWebCrawler.cpp +++ b/mozilla/webshell/tests/viewer/nsWebCrawler.cpp @@ -355,7 +355,7 @@ nsWebCrawler::GetOutputFile(nsIURL *aURL, nsString& aOutputName) char *c = inputFileName; for (PRInt32 i=fileNameOffset+1; i