diff --git a/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp b/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp index d662c907728..edc274b039d 100644 --- a/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp +++ b/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp @@ -31,15 +31,15 @@ void CommandLineUtils::getOptions String arg; String flag; for (int i = 0; i < argc; i++) { - arg.clear(); - arg.append(argv[i]); + arg.Truncate(); + arg.getNSString().AppendWithConversion(argv[i]); - if (!arg.isEmpty() && (arg.charAt(0) == '-')) { + if (!arg.IsEmpty() && (arg.CharAt(0) == '-')) { // clean up previous flag - if (!flag.isEmpty()) { + if (!flag.IsEmpty()) { options.put(flag, new String(arg)); - flag.clear(); + flag.Truncate(); } // get next flag arg.subString(1,flag); @@ -49,17 +49,17 @@ void CommandLineUtils::getOptions if (!flags.contains(flag)) { PRUint32 idx = 1; String tmpFlag; - while(idx <= flag.length()) { + while(idx <= flag.Length()) { flag.subString(0,idx, tmpFlag); if (flags.contains(tmpFlag)) { - if (idx < flag.length()) { + if (idx < flag.Length()) { String* value = new String(); flag.subString(idx, *value); options.put(tmpFlag,value); break; } } - else if (idx == flag.length()) { + else if (idx == flag.Length()) { cout << "invalid option: -" << flag << endl; } ++idx; @@ -68,13 +68,13 @@ void CommandLineUtils::getOptions }// if flag char '-' else { // Store both flag key and number key - if (!flag.isEmpty()) + if (!flag.IsEmpty()) options.put(flag, new String(arg)); - flag.clear(); + flag.Truncate(); } }// end for - if (!flag.isEmpty()) - options.put(flag, new String("no value")); + if (!flag.IsEmpty()) + options.put(flag, new String(NS_LITERAL_STRING("no value"))); } //-- getOptions diff --git a/mozilla/extensions/transformiix/source/base/Double.cpp b/mozilla/extensions/transformiix/source/base/Double.cpp index 23e02006ed4..1e6eddee317 100644 --- a/mozilla/extensions/transformiix/source/base/Double.cpp +++ b/mozilla/extensions/transformiix/source/base/Double.cpp @@ -132,35 +132,35 @@ MBool Double::isNeg(double aDbl) double Double::toDouble(const String& aSrc) { PRUint32 idx = 0; - PRUint32 len = aSrc.length(); + PRUint32 len = aSrc.Length(); MBool digitFound = MB_FALSE; // leading whitespace while (idx < len && - XMLUtils::isWhitespace(aSrc.charAt(idx))) { + XMLUtils::isWhitespace(aSrc.CharAt(idx))) { ++idx; } // sign char - if (idx < len && aSrc.charAt(idx) == '-') + if (idx < len && aSrc.CharAt(idx) == '-') ++idx; // integer chars while (idx < len && - aSrc.charAt(idx) >= '0' && - aSrc.charAt(idx) <= '9') { + aSrc.CharAt(idx) >= '0' && + aSrc.CharAt(idx) <= '9') { ++idx; digitFound = MB_TRUE; } // decimal separator - if (idx < len && aSrc.charAt(idx) == '.') { + if (idx < len && aSrc.CharAt(idx) == '.') { ++idx; // fraction chars while (idx < len && - aSrc.charAt(idx) >= '0' && - aSrc.charAt(idx) <= '9') { + aSrc.CharAt(idx) >= '0' && + aSrc.CharAt(idx) <= '9') { ++idx; digitFound = MB_TRUE; } @@ -168,7 +168,7 @@ double Double::toDouble(const String& aSrc) // ending whitespace while (idx < len && - XMLUtils::isWhitespace(aSrc.charAt(idx))) { + XMLUtils::isWhitespace(aSrc.CharAt(idx))) { ++idx; } @@ -193,13 +193,13 @@ String& Double::toString(double aValue, String& aDest) // check for special cases if (isNaN(aValue)) { - aDest.append("NaN"); + aDest.Append(NS_LITERAL_STRING("NaN")); return aDest; } if (isInfinite(aValue)) { if (aValue < 0) - aDest.append('-'); - aDest.append("Infinity"); + aDest.Append(PRUnichar('-')); + aDest.Append(NS_LITERAL_STRING("Infinity")); return aDest; } @@ -222,17 +222,17 @@ String& Double::toString(double aValue, String& aDest) PR_dtoa(aValue, 0, 0, &intDigits, &sign, &endp, buf, bufsize-1); if (sign) - aDest.append('-'); + aDest.Append(PRUnichar('-')); int i; for (i = 0; i < endp - buf; i++) { if (i == intDigits) - aDest.append('.'); - aDest.append(buf[i]); + aDest.Append(PRUnichar('.')); + aDest.Append(PRUnichar(buf[i])); } for (; i < intDigits; i++) - aDest.append('0'); + aDest.Append(PRUnichar('0')); #else @@ -252,14 +252,14 @@ String& Double::toString(double aValue, String& aDest) } else { if (printDeci) { - aDest.append('.'); + aDest.Append(PRUnichar('.')); printDeci = MB_FALSE; } for ( ;zeros ;zeros--) - aDest.append('0'); + aDest.Append(PRUnichar('0')); - aDest.append(buf[i]); + aDest.Append(PRUnichar(buf[i])); } } diff --git a/mozilla/extensions/transformiix/source/base/NamedMap.cpp b/mozilla/extensions/transformiix/source/base/NamedMap.cpp index 890af5aebe0..35a8cca85d9 100644 --- a/mozilla/extensions/transformiix/source/base/NamedMap.cpp +++ b/mozilla/extensions/transformiix/source/base/NamedMap.cpp @@ -208,7 +208,7 @@ void NamedMap::put(const String& key, TxObject* obj) { //-- advance to next spot while ( bktItem ) { //-- if current key equals desired key, break - if ( bktItem->key.isEqual(key) ) { + if ( bktItem->key.Equals(key) ) { break; } prevItem = bktItem; @@ -243,7 +243,7 @@ TxObject* NamedMap::remove(const String& key) { BucketItem* bktItem = elements[idx]; - while ( bktItem && !(key.isEqual(bktItem->key))) { + while ( bktItem && !(key.Equals(bktItem->key))) { bktItem = bktItem->next; } @@ -306,7 +306,7 @@ NamedMap::BucketItem* NamedMap::getBucketItem(const String& key) { BucketItem* bktItem = elements[idx]; while ( bktItem ) { - if ( bktItem->key.isEqual(key) ) return bktItem; + if ( bktItem->key.Equals(key) ) return bktItem; bktItem = bktItem->next; } @@ -318,11 +318,11 @@ NamedMap::BucketItem* NamedMap::getBucketItem(const String& key) { **/ unsigned long NamedMap::hashKey(const String& key) { - PRUint32 len = key.length(); + PRUint32 len = key.Length(); unsigned long hashCode = 0; for (PRUint32 i = 0; i < len; ++i) { - hashCode += ((PRInt32)key.charAt(i)) << 3; + hashCode += ((PRInt32)key.CharAt(i)) << 3; } return hashCode; } //-- hashKey diff --git a/mozilla/extensions/transformiix/source/base/StringList.cpp b/mozilla/extensions/transformiix/source/base/StringList.cpp index 7b739bd1dd2..6965bcd08d1 100644 --- a/mozilla/extensions/transformiix/source/base/StringList.cpp +++ b/mozilla/extensions/transformiix/source/base/StringList.cpp @@ -72,7 +72,7 @@ void StringList::add(String* strptr) { MBool StringList::contains(String& search) { StringListItem* sItem = firstItem; while ( sItem ) { - if ( search.isEqual(*sItem->strptr)) return MB_TRUE; + if ( search.Equals(*sItem->strptr)) return MB_TRUE; sItem = sItem->nextItem; } return MB_FALSE; @@ -191,7 +191,7 @@ StringList::StringListItem* StringList::remove(StringList::StringListItem* sItem void StringList::remove(String& search) { StringListItem* sItem = firstItem; while (sItem) { - if (sItem->strptr->isEqual(search)) { + if (sItem->strptr->Equals(search)) { delete sItem->strptr; StringListItem* temp = remove(sItem); sItem = sItem->nextItem; diff --git a/mozilla/extensions/transformiix/source/base/Tokenizer.cpp b/mozilla/extensions/transformiix/source/base/Tokenizer.cpp index 959013c67d3..82d633e37f0 100644 --- a/mozilla/extensions/transformiix/source/base/Tokenizer.cpp +++ b/mozilla/extensions/transformiix/source/base/Tokenizer.cpp @@ -64,12 +64,12 @@ txTokenizer::txTokenizer(const String& aSource) { mCurrentPos = 0; mSource = aSource; - mSize = mSource.length(); + mSize = mSource.Length(); // Advance to start pos while (mCurrentPos < mSize) { // If character is not a whitespace, we are at start of first token - if (!XMLUtils::isWhitespace(mSource.charAt(mCurrentPos))) + if (!XMLUtils::isWhitespace(mSource.CharAt(mCurrentPos))) break; ++mCurrentPos; } @@ -82,19 +82,19 @@ MBool txTokenizer::hasMoreTokens() void txTokenizer::nextToken(String& aBuffer) { - aBuffer.clear(); + aBuffer.Truncate(); while (mCurrentPos < mSize) { - UNICODE_CHAR ch = mSource.charAt(mCurrentPos++); + PRUnichar ch = mSource.CharAt(mCurrentPos++); // If character is not a delimiter we append it if (XMLUtils::isWhitespace(ch)) break; - aBuffer.append(ch); + aBuffer.Append(ch); } // Advance to next start pos while (mCurrentPos < mSize) { // If character is not a whitespace, we are at start of next token - if (!XMLUtils::isWhitespace(mSource.charAt(mCurrentPos))) + if (!XMLUtils::isWhitespace(mSource.CharAt(mCurrentPos))) break; ++mCurrentPos; } diff --git a/mozilla/extensions/transformiix/source/base/TxString.cpp b/mozilla/extensions/transformiix/source/base/TxString.cpp index 4ce035d0c79..9e0b6f4bbd2 100644 --- a/mozilla/extensions/transformiix/source/base/TxString.cpp +++ b/mozilla/extensions/transformiix/source/base/TxString.cpp @@ -30,7 +30,7 @@ #include #include -String::String(const UNICODE_CHAR* aSource, PRUint32 aLength) +String::String(const PRUnichar* aSource, PRUint32 aLength) { if (aLength) { mString = Substring(aSource, aSource + aLength); @@ -45,7 +45,7 @@ txCaseInsensitiveStringComparator::operator()(const char_type* lhs, const char_type* rhs, PRUint32 aLength ) const { - UNICODE_CHAR thisChar, otherChar; + PRUnichar thisChar, otherChar; PRUint32 compLoop = 0; while (compLoop < aLength) { thisChar = lhs[compLoop]; diff --git a/mozilla/extensions/transformiix/source/base/TxString.h b/mozilla/extensions/transformiix/source/base/TxString.h index f22b8a4a964..706919df17c 100644 --- a/mozilla/extensions/transformiix/source/base/TxString.h +++ b/mozilla/extensions/transformiix/source/base/TxString.h @@ -33,7 +33,6 @@ #include "TxObject.h" #include #include "nsString.h" -typedef PRUnichar UNICODE_CHAR; #ifdef TX_EXE class txCaseInsensitiveStringComparator @@ -64,7 +63,7 @@ public: * Constructor, allocates a buffer and copies the supplied string buffer. * If aLength is zero it computes the length from the supplied string. */ - explicit String(const UNICODE_CHAR* aSource, PRUint32 aLength = 0); + explicit String(const PRUnichar* aSource, PRUint32 aLength = 0); #endif explicit String(const nsAString& aSource); ~String(); @@ -72,56 +71,51 @@ public: /* * Append aSource to this string. */ - void append(UNICODE_CHAR aSource); - void append(const String& aSource); - void append(const UNICODE_CHAR* aSource, PRUint32 aLength); - void append(const nsAString& aSource); + void Append(PRUnichar aSource); + void Append(const String& aSource); + void Append(const PRUnichar* aSource, PRUint32 aLength); + void Append(const nsAString& aSource); /* * Insert aSource at aOffset in this string. */ - void insert(PRUint32 aOffset, UNICODE_CHAR aSource); + void insert(PRUint32 aOffset, PRUnichar aSource); void insert(PRUint32 aOffset, const String& aSource); /* * Replace characters starting at aOffset with aSource. */ - void replace(PRUint32 aOffset, UNICODE_CHAR aSource); + void replace(PRUint32 aOffset, PRUnichar aSource); void replace(PRUint32 aOffset, const String& aSource); /* * Delete aCount characters starting at aOffset. */ - void deleteChars(PRUint32 aOffset, PRUint32 aCount); + void Cut(PRUint32 aOffset, PRUint32 aCount); /* * Returns the character at aIndex. Caller needs to check the * index for out-of-bounds errors. */ - UNICODE_CHAR charAt(PRUint32 aIndex) const; - - /* - * Clear the string. - */ - void clear(); + PRUnichar CharAt(PRUint32 aIndex) const; /* * Returns index of first occurrence of aData. */ - PRInt32 indexOf(UNICODE_CHAR aData, + PRInt32 indexOf(PRUnichar aData, PRInt32 aOffset = 0) const; PRInt32 indexOf(const String& aData, PRInt32 aOffset = 0) const; /* * Returns index of last occurrence of aData. */ - PRInt32 lastIndexOf(UNICODE_CHAR aData, + PRInt32 RFindChar(PRUnichar aData, PRInt32 aOffset = -1) const; /* * Check equality between strings. */ - MBool isEqual(const String& aData) const; + MBool Equals(const String& aData) const; /* * Check equality (ignoring case) between strings. @@ -131,12 +125,12 @@ public: /* * Check whether the string is empty. */ - MBool isEmpty() const; + MBool IsEmpty() const; /* * Return the length of the string. */ - PRUint32 length() const; + PRUint32 Length() const; /* * Returns a substring starting at start @@ -164,7 +158,7 @@ public: /* * Shorten the string to aLength. */ - void truncate(PRUint32 aLength); + void Truncate(PRUint32 aLength = 0); /* * Return a reference to this string's nsString. @@ -181,19 +175,25 @@ private: friend ostream& operator << (ostream& aOutput, const String& aSource); +// XXX NOT IMPLEMENTED + explicit String(PRUint32 aSize); + explicit String(char* aSource); + explicit String(char aSource); + void Append(char* aSource); + void Append(char aSource); + MBool Equals(char* aSource); + MBool Equals(char aSource); +// XXX NOT IMPLEMENTED + // XXX DEPRECATED public: - explicit String(PRUint32 aSize); - explicit String(const char* aSource); // XXX Used for literal strings - void append(const char* aSource); - MBool isEqual(const char* aData) const; nsString& getNSString(); const nsString& getConstNSString() const; // XXX DEPRECATED }; /* - * Translate UNICODE_CHARs to Chars and output to the provided stream. + * Translate PRUnichars to Chars and output to the provided stream. */ ostream& operator << (ostream& aOutput, const String& aSource); diff --git a/mozilla/extensions/transformiix/source/base/txMozillaString.h b/mozilla/extensions/transformiix/source/base/txMozillaString.h index ef7959a3da3..d2a8b7dfa97 100644 --- a/mozilla/extensions/transformiix/source/base/txMozillaString.h +++ b/mozilla/extensions/transformiix/source/base/txMozillaString.h @@ -68,28 +68,28 @@ inline String::~String() MOZ_COUNT_DTOR(String); } -inline void String::append(UNICODE_CHAR aSource) +inline void String::Append(PRUnichar aSource) { mString.Append(aSource); } -inline void String::append(const String& aSource) +inline void String::Append(const String& aSource) { mString.Append(aSource.mString); } -inline void String::append(const UNICODE_CHAR* aSource, PRUint32 aLength) +inline void String::Append(const PRUnichar* aSource, PRUint32 aLength) { mString.Append(aSource, aLength); } -inline void String::append(const nsAString& aSource) +inline void String::Append(const nsAString& aSource) { mString.Append(aSource); } inline void String::insert(PRUint32 aOffset, - UNICODE_CHAR aSource) + PRUnichar aSource) { mString.Insert(aSource, aOffset); } @@ -100,7 +100,7 @@ inline void String::insert(PRUint32 aOffset, const String& aSource) } inline void String::replace(PRUint32 aOffset, - UNICODE_CHAR aSource) + PRUnichar aSource) { mString.SetCharAt(aSource, aOffset); } @@ -110,23 +110,17 @@ inline void String::replace(PRUint32 aOffset, const String& aSource) mString.Replace(aOffset, mString.Length() - aOffset, aSource.mString); } -inline void String::deleteChars(PRUint32 aOffset, - PRUint32 aCount) +inline void String::Cut(PRUint32 aOffset, PRUint32 aCount) { mString.Cut(aOffset, aCount); } -inline UNICODE_CHAR String::charAt(PRUint32 aIndex) const +inline PRUnichar String::CharAt(PRUint32 aIndex) const { return mString.CharAt(aIndex); } -inline void String::clear() -{ - mString.Truncate(); -} - -inline PRInt32 String::indexOf(UNICODE_CHAR aData, +inline PRInt32 String::indexOf(PRUnichar aData, PRInt32 aOffset) const { return mString.FindChar(aData, (PRUint32)aOffset); @@ -138,16 +132,13 @@ inline PRInt32 String::indexOf(const String& aData, return mString.Find(aData.mString, aOffset); } -inline PRInt32 String::lastIndexOf(UNICODE_CHAR aData, - PRInt32 aOffset) const +inline PRInt32 String::RFindChar(PRUnichar aData, PRInt32 aOffset) const { return mString.RFindChar(aData, aOffset); } -inline MBool String::isEqual(const String& aData) const +inline MBool String::Equals(const String& aData) const { - if (this == &aData) - return MB_TRUE; return mString.Equals(aData.mString); } @@ -158,17 +149,17 @@ inline MBool String::isEqualIgnoreCase(const String& aData) const return mString.Equals(aData.mString, txCaseInsensitiveStringComparator()); } -inline MBool String::isEmpty() const +inline MBool String::IsEmpty() const { return mString.IsEmpty(); } -inline PRUint32 String::length() const +inline PRUint32 String::Length() const { return mString.Length(); } -inline void String::truncate(PRUint32 aLength) +inline void String::Truncate(PRUint32 aLength) { mString.Truncate(aLength); } @@ -182,7 +173,7 @@ inline String& String::subString(PRUint32 aStart, String& aDest) const else { NS_ASSERTION(aStart == length, "Bonehead! Calling subString with negative length."); - aDest.clear(); + aDest.Truncate(); } return aDest; } @@ -196,7 +187,7 @@ inline String& String::subString(PRUint32 aStart, PRUint32 aEnd, else { NS_ASSERTION(aStart == aEnd, "Bonehead! Calling subString with negative length."); - aDest.clear(); + aDest.Truncate(); } return aDest; } @@ -224,28 +215,6 @@ inline String::operator const nsAString&() const } // XXX DEPRECATED -inline String::String(PRUint32 aSize) -{ - MOZ_COUNT_CTOR(String); - mString.SetCapacity(aSize); -} - -inline String::String(const char* aSource) -{ - MOZ_COUNT_CTOR(String); - mString.AssignWithConversion(aSource); -} - -inline void String::append(const char* aSource) -{ - mString.AppendWithConversion(aSource); -} - -inline MBool String::isEqual(const char* aData) const -{ - return mString.EqualsWithConversion(aData); -} - inline nsString& String::getNSString() { return mString; diff --git a/mozilla/extensions/transformiix/source/base/txURIUtils.cpp b/mozilla/extensions/transformiix/source/base/txURIUtils.cpp index 32a9acdaad9..2cdb7432a57 100644 --- a/mozilla/extensions/transformiix/source/base/txURIUtils.cpp +++ b/mozilla/extensions/transformiix/source/base/txURIUtils.cpp @@ -50,8 +50,8 @@ #ifdef TX_EXE //- Constants -/ -const String URIUtils::HTTP_PROTOCOL("http"); -const String URIUtils::FILE_PROTOCOL("file"); +const String URIUtils::HTTP_PROTOCOL(NS_LITERAL_STRING("http")); +const String URIUtils::FILE_PROTOCOL(NS_LITERAL_STRING("file")); const char URIUtils::HREF_PATH_SEP = '/'; const char URIUtils::DEVICE_SEP = '|'; const char URIUtils::PORT_SEP = ':'; @@ -97,28 +97,28 @@ istream* URIUtils::getInputStream **/ void URIUtils::getDocumentBase(const String& href, String& dest) { //-- use temp str so the subString method doesn't destroy dest - String docBase(""); + String docBase; - if (!href.isEmpty()) { + if (!href.IsEmpty()) { int idx = -1; //-- check for URL ParsedURI* uri = parseURI(href); if ( !uri->isMalformed ) { - idx = href.lastIndexOf(HREF_PATH_SEP); + idx = href.RFindChar(HREF_PATH_SEP); } else { //-- The following contains a fix from Shane Hathaway //-- to handle the case when both "\" and "/" appear in filename - int idx2 = href.lastIndexOf(HREF_PATH_SEP); - //idx = href.lastIndexOf(File.separator); + int idx2 = href.RFindChar(HREF_PATH_SEP); + //idx = href.RFindChar(File.separator); idx = -1; //-- hack change later if (idx2 > idx) idx = idx2; } if (idx >= 0) href.subString(0,idx, docBase); delete uri; } - dest.append(docBase); + dest.Append(docBase); } //-- getDocumentBase #endif @@ -129,12 +129,12 @@ void URIUtils::getDocumentBase(const String& href, String& dest) { **/ void URIUtils::resolveHref(const String& href, const String& base, String& dest) { - if (base.isEmpty()) { - dest.append(href); + if (base.IsEmpty()) { + dest.Append(href); return; } - if (href.isEmpty()) { - dest.append(base); + if (href.IsEmpty()) { + dest.Append(base); return; } @@ -144,7 +144,7 @@ void URIUtils::resolveHref(const String& href, const String& base, nsresult result = NS_NewURI(getter_AddRefs(pURL), base); if (NS_SUCCEEDED(result)) { NS_MakeAbsoluteURI(resultHref, href, pURL); - dest.append(resultHref); + dest.Append(resultHref); } #else String documentBase; @@ -153,7 +153,7 @@ void URIUtils::resolveHref(const String& href, const String& base, //-- check for URL ParsedURI* uri = parseURI(href); if ( !uri->isMalformed ) { - dest.append(href); + dest.Append(href); delete uri; return; } @@ -161,24 +161,24 @@ void URIUtils::resolveHref(const String& href, const String& base, //-- join document base + href String xHref; - if (!documentBase.isEmpty()) { - xHref.append(documentBase); - if (documentBase.charAt(documentBase.length()-1) != HREF_PATH_SEP) - xHref.append(HREF_PATH_SEP); + if (!documentBase.IsEmpty()) { + xHref.Append(documentBase); + if (documentBase.CharAt(documentBase.Length()-1) != HREF_PATH_SEP) + xHref.Append(PRUnichar(HREF_PATH_SEP)); } - xHref.append(href); + xHref.Append(href); //-- check new href ParsedURI* newUri = parseURI(xHref); if ( !newUri->isMalformed ) { - dest.append(xHref); + dest.Append(xHref); } else { // Try local files ifstream inFile(NS_LossyConvertUCS2toASCII(xHref).get(), ios::in); - if ( inFile ) dest.append(xHref); - else dest.append(href); + if ( inFile ) dest.Append(xHref); + else dest.Append(href); inFile.close(); } delete uri; @@ -189,16 +189,16 @@ void URIUtils::resolveHref(const String& href, const String& base, void URIUtils::getFragmentIdentifier(const String& href, String& frag) { PRInt32 pos; - pos = href.lastIndexOf('#'); + pos = href.RFindChar('#'); if(pos != kNotFound) href.subString(pos+1, frag); else - frag.clear(); + frag.Truncate(); } //-- getFragmentIdentifier void URIUtils::getDocumentURI(const String& href, String& docUri) { PRInt32 pos; - pos = href.lastIndexOf('#'); + pos = href.RFindChar('#'); if(pos != kNotFound) href.subString(0,pos,docUri); else @@ -211,7 +211,7 @@ istream* URIUtils::openStream(ParsedURI* uri) { // check protocol istream* inStream = 0; - if ( FILE_PROTOCOL.isEqual(uri->protocol) ) { + if ( FILE_PROTOCOL.Equals(uri->protocol) ) { ifstream* inFile = new ifstream(NS_LossyConvertUCS2toASCII(uri->path).get(), ios::in); @@ -231,32 +231,33 @@ URIUtils::ParsedURI* URIUtils::parseURI(const String& uri) { short mode = PROTOCOL_MODE; // look for protocol - int totalCount = uri.length(); + int totalCount = uri.Length(); int charCount = 0; - UNICODE_CHAR prevCh = '\0'; + PRUnichar prevCh = '\0'; int fslash = 0; - String buffer(uri.length()); + String buffer; + buffer.getNSString().SetCapacity(uri.Length()); while ( charCount < totalCount ) { - UNICODE_CHAR ch = uri.charAt(charCount++); + PRUnichar ch = uri.CharAt(charCount++); switch(ch) { case '.' : if ( mode == PROTOCOL_MODE ) { uriTokens->isMalformed = MB_TRUE; mode = HOST_MODE; } - buffer.append(ch); + buffer.Append(ch); break; case ':' : { switch ( mode ) { case PROTOCOL_MODE : uriTokens->protocol = buffer; - buffer.clear(); + buffer.Truncate(); mode = HOST_MODE; break; case HOST_MODE : uriTokens->host = buffer; - buffer.clear(); + buffer.Truncate(); mode = PORT_MODE; break; default: @@ -267,25 +268,25 @@ URIUtils::ParsedURI* URIUtils::parseURI(const String& uri) { case '/' : switch ( mode ) { case HOST_MODE : - if (!buffer.isEmpty()) { + if (!buffer.IsEmpty()) { mode = PATH_MODE; - buffer.append(ch); + buffer.Append(ch); } else if ( fslash == 2 ) mode = PATH_MODE; else ++fslash; break; case PORT_MODE : mode = PATH_MODE; - uriTokens->port.append(buffer); - buffer.clear(); + uriTokens->port.Append(buffer); + buffer.Truncate(); break; default: - buffer.append(ch); + buffer.Append(ch); break; } break; default: - buffer.append(ch); + buffer.Append(ch); } prevCh = ch; } @@ -294,19 +295,19 @@ URIUtils::ParsedURI* URIUtils::parseURI(const String& uri) { uriTokens->isMalformed = MB_TRUE; } //-- finish remaining mode - if (!buffer.isEmpty()) { + if (!buffer.IsEmpty()) { switch ( mode ) { case PROTOCOL_MODE : - uriTokens->protocol.append(buffer); + uriTokens->protocol.Append(buffer); break; case HOST_MODE : - uriTokens->host.append(buffer); + uriTokens->host.Append(buffer); break; case PORT_MODE : - uriTokens->port.append(buffer); + uriTokens->port.Append(buffer); break; case PATH_MODE : - uriTokens->path.append(buffer); + uriTokens->path.Append(buffer); break; default: break; diff --git a/mozilla/extensions/transformiix/source/main/transformiix.cpp b/mozilla/extensions/transformiix/source/main/transformiix.cpp index 8d4bf7b1d8f..f8eaee5078d 100644 --- a/mozilla/extensions/transformiix/source/main/transformiix.cpp +++ b/mozilla/extensions/transformiix/source/main/transformiix.cpp @@ -66,41 +66,41 @@ int main(int argc, char** argv) { //-- available flags StringList flags; - flags.add(new String("i")); // XML input - flags.add(new String("s")); // XSL input - flags.add(new String("o")); // Output filename - flags.add(new String("h")); // help - flags.add(new String("q")); // quiet + flags.add(new String(NS_LITERAL_STRING("i"))); // XML input + flags.add(new String(NS_LITERAL_STRING("s"))); // XSL input + flags.add(new String(NS_LITERAL_STRING("o"))); // Output filename + flags.add(new String(NS_LITERAL_STRING("h"))); // help + flags.add(new String(NS_LITERAL_STRING("q"))); // quiet NamedMap options; options.setObjectDeletion(MB_TRUE); CommandLineUtils::getOptions(options, argc, argv, flags); - if (!options.get(String("q"))) { - String copyright("(C) 1999 The MITRE Corporation, Keith Visco, and contributors"); + if (!options.get(String(NS_LITERAL_STRING("q")))) { + String copyright(NS_LITERAL_STRING("(C) 1999 The MITRE Corporation, Keith Visco, and contributors")); cerr << "TransforMiiX "; cerr << "1.2b pre" << endl; cerr << copyright << endl; //-- print banner line - PRUint32 fillSize = copyright.length() + 1; + PRUint32 fillSize = copyright.Length() + 1; PRUint32 counter; for (counter = 0; counter < fillSize; ++counter) cerr << '-'; cerr << endl << endl; } - if (options.get(String("h"))) { + if (options.get(String(NS_LITERAL_STRING("h")))) { printHelp(); return 0; } - String* xmlFilename = (String*)options.get(String("i")); - String* xsltFilename = (String*)options.get(String("s")); - String* outFilename = (String*)options.get(String("o")); + String* xmlFilename = (String*)options.get(String(NS_LITERAL_STRING("i"))); + String* xsltFilename = (String*)options.get(String(NS_LITERAL_STRING("s"))); + String* outFilename = (String*)options.get(String(NS_LITERAL_STRING("o"))); //-- handle output stream ostream* resultOutput = &cout; ofstream resultFileStream; - if (outFilename && !outFilename->isEqual("-")) { + if (outFilename && !outFilename->getConstNSString().Equals(NS_LITERAL_STRING("-"))) { resultFileStream.open(NS_LossyConvertUCS2toASCII(*outFilename).get(), ios::out); if (!resultFileStream) { diff --git a/mozilla/extensions/transformiix/source/main/txXSLTMarkDriver.cpp b/mozilla/extensions/transformiix/source/main/txXSLTMarkDriver.cpp index ef4f289df04..9c24c17e3e5 100644 --- a/mozilla/extensions/transformiix/source/main/txXSLTMarkDriver.cpp +++ b/mozilla/extensions/transformiix/source/main/txXSLTMarkDriver.cpp @@ -58,13 +58,13 @@ public: int loadStylesheet (char * filename) { delete mXSL; - mXSL = parsePath(String(filename), mObserver); + mXSL = parsePath(String(NS_ConvertASCIItoUCS2(filename)), mObserver); return mXSL ? 0 : 1; } int setInputDocument (char * filename) { delete mXML; - mXML = parsePath(String(filename), mObserver); + mXML = parsePath(String(NS_ConvertASCIItoUCS2(filename)), mObserver); return mXML ? 0 : 1; } int openOutput (char * outputFilename) diff --git a/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp b/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp index 50396209401..477a398d277 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp +++ b/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp @@ -41,7 +41,7 @@ void XMLDOMUtils::getNodeValue(Node* aNode, String& aResult) case Node::PROCESSING_INSTRUCTION_NODE: case Node::TEXT_NODE: { - aResult.append(aNode->getNodeValue()); + aResult.Append(aNode->getNodeValue()); break; } case Node::DOCUMENT_NODE: @@ -58,7 +58,7 @@ void XMLDOMUtils::getNodeValue(Node* aNode, String& aResult) nodeType = tmpNode->getNodeType(); if ((nodeType == Node::TEXT_NODE) || (nodeType == Node::CDATA_SECTION_NODE)) - aResult.append(tmpNode->getNodeValue()); + aResult.Append(tmpNode->getNodeValue()); else if (nodeType == Node::ELEMENT_NODE) getNodeValue(tmpNode, aResult); tmpNode = tmpNode->getNextSibling(); diff --git a/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp b/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp index 88134f94194..a0d9577174d 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp +++ b/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp @@ -81,7 +81,7 @@ void XMLUtils::getPrefix(const String& src, String& dest) NS_ASSERTION(idx > 0, "This QName looks invalid."); String tmp; src.subString(0, (PRUint32)idx, tmp); - dest.append(tmp); + dest.Append(tmp); } void XMLUtils::getLocalPart(const String& src, String& dest) @@ -89,7 +89,7 @@ void XMLUtils::getLocalPart(const String& src, String& dest) // Anything after ':' is the local part of the name PRInt32 idx = src.indexOf(':'); if (idx == kNotFound) { - dest.append(src); + dest.Append(src); return; } // Use a temporary String to prevent any chars in dest @@ -97,24 +97,24 @@ void XMLUtils::getLocalPart(const String& src, String& dest) NS_ASSERTION(idx > 0, "This QName looks invalid."); String tmp; src.subString((PRUint32)idx + 1, tmp); - dest.append(tmp); + dest.Append(tmp); } MBool XMLUtils::isValidQName(const String& aName) { - if (aName.isEmpty()) { + if (aName.IsEmpty()) { return MB_FALSE; } - if (!isLetter(aName.charAt(0))) { + if (!isLetter(aName.CharAt(0))) { return MB_FALSE; } - PRUint32 size = aName.length(); + PRUint32 size = aName.Length(); PRUint32 i; MBool foundColon = MB_FALSE; for (i = 1; i < size; ++i) { - UNICODE_CHAR character = aName.charAt(i); + PRUnichar character = aName.CharAt(i); if (character == ':') { foundColon = MB_TRUE; ++i; @@ -129,11 +129,11 @@ MBool XMLUtils::isValidQName(const String& aName) // a valid QName. return !foundColon; } - if (!isLetter(aName.charAt(i))) { + if (!isLetter(aName.CharAt(i))) { return MB_FALSE; } for (++i; i < size; ++i) { - if (!isNCNameChar(aName.charAt(i))) { + if (!isNCNameChar(aName.CharAt(i))) { return MB_FALSE; } } @@ -163,18 +163,18 @@ MBool XMLUtils::isWhitespace(const String& aText) void XMLUtils::normalizePIValue(String& piValue) { String origValue(piValue); - PRUint32 origLength = origValue.length(); + PRUint32 origLength = origValue.Length(); PRUint32 conversionLoop = 0; - UNICODE_CHAR prevCh = 0; - piValue.clear(); + PRUnichar prevCh = 0; + piValue.Truncate(); while (conversionLoop < origLength) { - UNICODE_CHAR ch = origValue.charAt(conversionLoop); + PRUnichar ch = origValue.CharAt(conversionLoop); switch (ch) { case '>': { if (prevCh == '?') { - piValue.append(' '); + piValue.Append(PRUnichar(' ')); } break; } @@ -183,7 +183,7 @@ void XMLUtils::normalizePIValue(String& piValue) break; } } - piValue.append(ch); + piValue.Append(ch); prevCh = ch; ++conversionLoop; } @@ -226,7 +226,7 @@ MBool XMLUtils::getXMLSpacePreserve(Node* aNode) #define TX_MATCH_CHAR(ch, a) if (ch < a) return MB_FALSE; \ if (ch == a) return MB_TRUE -MBool XMLUtils::isDigit(UNICODE_CHAR ch) +MBool XMLUtils::isDigit(PRUnichar ch) { TX_CHAR_RANGE(ch, 0x0030, 0x0039); /* '0'-'9' */ TX_CHAR_RANGE(ch, 0x0660, 0x0669); @@ -246,7 +246,7 @@ MBool XMLUtils::isDigit(UNICODE_CHAR ch) return MB_FALSE; } -MBool XMLUtils::isLetter(UNICODE_CHAR ch) +MBool XMLUtils::isLetter(PRUnichar ch) { /* Letter = BaseChar | Ideographic; and _ */ TX_CHAR_RANGE(ch, 0x0041, 0x005A); @@ -458,7 +458,7 @@ MBool XMLUtils::isLetter(UNICODE_CHAR ch) return MB_FALSE; } -MBool XMLUtils::isNCNameChar(UNICODE_CHAR ch) +MBool XMLUtils::isNCNameChar(PRUnichar ch) { /* NCNameChar = Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender */ diff --git a/mozilla/extensions/transformiix/source/xml/XMLUtils.h b/mozilla/extensions/transformiix/source/xml/XMLUtils.h index deefaad8798..b6217b2cd61 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLUtils.h +++ b/mozilla/extensions/transformiix/source/xml/XMLUtils.h @@ -106,7 +106,7 @@ public: /* * Returns true if the given character is whitespace. */ - static MBool isWhitespace(const UNICODE_CHAR& aChar) + static MBool isWhitespace(const PRUnichar& aChar) { return (aChar <= ' ' && (aChar == ' ' || aChar == '\r' || @@ -126,17 +126,17 @@ public: /* * Returns true if the given character represents a numeric letter (digit). */ - static MBool isDigit(UNICODE_CHAR ch); + static MBool isDigit(PRUnichar ch); /* * Returns true if the given character represents an Alpha letter */ - static MBool isLetter(UNICODE_CHAR ch); + static MBool isLetter(PRUnichar ch); /* * Returns true if the given character is an allowable NCName character */ - static MBool isNCNameChar(UNICODE_CHAR ch); + static MBool isNCNameChar(PRUnichar ch); /* * Walks up the document tree and returns true if the closest xml:space diff --git a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/MozillaElement.cpp b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/MozillaElement.cpp index fd5dd3ce325..df2cb039077 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/MozillaElement.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/MozillaElement.cpp @@ -80,7 +80,7 @@ MBool Element::getAttr(txAtom* aLocalName, PRInt32 aNSID, nsCOMPtr cont(do_QueryInterface(mMozObject)); NS_ASSERTION(cont, "Element doesn't implement nsIContent"); if (!cont || !cont->HasAttr(aNSID, aLocalName)) { - aValue.clear(); + aValue.Truncate(); return MB_FALSE; } nsresult rv; diff --git a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h index 45aa7190225..568fee0e075 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h +++ b/mozilla/extensions/transformiix/source/xml/dom/mozImpl/mozilladom.h @@ -55,8 +55,6 @@ typedef 0 NULL; #endif -typedef UNICODE_CHAR DOM_CHAR; - #define kTxNsNodeIndexOffset 0x00000000; #define kTxAttrIndexOffset 0x40000000; #define kTxChildIndexOffset 0x80000000; diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/Attr.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/Attr.cpp index d5b98eb80d2..a34dcbba91c 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/Attr.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/Attr.cpp @@ -70,7 +70,7 @@ Attr::Attr(const String& aNamespaceURI, Document* aOwner) : NodeDefinition(Node::ATTRIBUTE_NODE, aName, NULL_STRING, aOwner) { - if (aNamespaceURI.isEmpty()) + if (aNamespaceURI.IsEmpty()) mNamespaceID = kNameSpaceID_None; else mNamespaceID = txNamespaceManager::getNamespaceID(aNamespaceURI); @@ -116,10 +116,10 @@ const String& Attr::getValue() Node* child = getFirstChild(); while (child) { if (child->getNodeType() != Node::ENTITY_REFERENCE_NODE) { - nodeValue.append(child->getNodeValue()); + nodeValue.Append(child->getNodeValue()); child = child->getNextSibling(); if (child) - nodeValue.append(","); + nodeValue.Append(PRUnichar(',')); } else { child = child->getNextSibling(); } diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/CDATASection.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/CDATASection.cpp index be0c73957ed..3419068e703 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/CDATASection.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/CDATASection.cpp @@ -34,7 +34,7 @@ //Construct a text object with the specified document owner and data // CDATASection::CDATASection(const String& theData, Document* owner) : - Text(Node::CDATA_SECTION_NODE, String("#cdata-section"), theData, owner) + Text(Node::CDATA_SECTION_NODE, String(NS_LITERAL_STRING("#cdata-section")), theData, owner) { } diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/CharacterData.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/CharacterData.cpp index 52dd2810159..1f8c1cf485f 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/CharacterData.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/CharacterData.cpp @@ -60,7 +60,7 @@ void CharacterData::setData(const String& source) // PRUint32 CharacterData::getLength() const { - return nodeValue.length(); + return nodeValue.Length(); } // @@ -70,39 +70,39 @@ PRUint32 CharacterData::getLength() const // String& CharacterData::substringData(PRUint32 offset, PRUint32 count, String& dest) { - if ((offset < nodeValue.length()) && (count > 0)) + if ((offset < nodeValue.Length()) && (count > 0)) return nodeValue.subString(offset, offset+count, dest); else { - dest.clear(); + dest.Truncate(); return dest; } } void CharacterData::appendData(const String& arg) { - nodeValue.append(arg); + nodeValue.Append(arg); } void CharacterData::insertData(PRUint32 offset, const String& arg) { - if (offset < nodeValue.length()) + if (offset < nodeValue.Length()) nodeValue.insert(offset, arg); } void CharacterData::deleteData(PRUint32 offset, PRUint32 count) { - if ((offset < nodeValue.length()) && (count > 0)) - nodeValue.deleteChars(offset, count); + if ((offset < nodeValue.Length()) && (count > 0)) + nodeValue.Cut(offset, count); } void CharacterData::replaceData(PRUint32 offset, PRUint32 count, const String& arg) { String tempString; - if ((offset < nodeValue.length()) && (count > 0)) + if ((offset < nodeValue.Length()) && (count > 0)) { - if (count < arg.length()) + if (count < arg.Length()) { tempString = arg.subString(0, count, tempString); nodeValue.replace(offset, tempString); diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/Comment.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/Comment.cpp index 1d0fd67885b..e5e2d693608 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/Comment.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/Comment.cpp @@ -34,7 +34,7 @@ //Construct a text object with the specified document owner and data // Comment::Comment(const String& theData, Document* owner) : - CharacterData(Node::COMMENT_NODE, String("#comment"), theData, owner) + CharacterData(Node::COMMENT_NODE, String(NS_LITERAL_STRING("#comment")), theData, owner) { } diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/DOMImplementation.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/DOMImplementation.cpp index e887c764de4..e3cf3552c92 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/DOMImplementation.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/DOMImplementation.cpp @@ -30,8 +30,8 @@ #include "dom.h" -DOMImplementation::DOMImplementation() : implFeature("XML"), - implVersion("1.0") +DOMImplementation::DOMImplementation() : implFeature(NS_LITERAL_STRING("XML")), + implVersion(NS_LITERAL_STRING("1.0")) { } @@ -48,7 +48,7 @@ MBool DOMImplementation::hasFeature(String feature, { feature.toUpperCase(); - if (feature.isEqual(implFeature) && version.isEqual(implVersion)) + if (feature.Equals(implFeature) && version.Equals(implVersion)) return MB_TRUE; else return MB_FALSE; diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/Document.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/Document.cpp index 678ee48fa23..8d84c792f76 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/Document.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/Document.cpp @@ -38,7 +38,7 @@ //node constructor is called to identify the node type. // Document::Document(DocumentType* theDoctype) : - NodeDefinition(Node::DOCUMENT_NODE, String("#document"), NULL_STRING, NULL) + NodeDefinition(Node::DOCUMENT_NODE, String(NS_LITERAL_STRING("#document")), NULL_STRING, NULL) { documentElement = NULL; doctype = theDoctype; @@ -195,7 +195,7 @@ Node* Document::removeChild(Node* oldChild) // DocumentFragment* Document::createDocumentFragment() { - return new DocumentFragment(String("#document-fragment"), NULL_STRING, this); + return new DocumentFragment(String(NS_LITERAL_STRING("#document-fragment")), NULL_STRING, this); } // diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/Element.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/Element.cpp index 7beb0ba6f23..03a7483eb94 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/Element.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/Element.cpp @@ -57,7 +57,7 @@ Element::Element(const String& aNamespaceURI, NodeDefinition(Node::ELEMENT_NODE, aTagName, NULL_STRING, aOwner) { Element(aTagName, aOwner); - if (aNamespaceURI.isEmpty()) + if (aNamespaceURI.IsEmpty()) mNamespaceID = kNameSpaceID_None; else mNamespaceID = txNamespaceManager::getNamespaceID(aNamespaceURI); @@ -100,7 +100,7 @@ PRInt32 Element::getNamespaceID() if (((Element*)node)->getAttr(txXMLAtoms::xmlns, kNameSpaceID_XMLNS, nsURI)) { // xmlns = "" sets the default namespace ID to kNameSpaceID_None; - if (!nsURI.isEmpty()) { + if (!nsURI.IsEmpty()) { mNamespaceID = txNamespaceManager::getNamespaceID(nsURI); } else { @@ -263,7 +263,7 @@ Attr* Element::getAttributeNode(const String& name) MBool Element::getAttr(txAtom* aLocalName, PRInt32 aNSID, String& aValue) { - aValue.clear(); + aValue.Truncate(); AttrMap::ListItem* item = mAttributes.firstItem; while (item) { Attr* attrNode = (Attr*)item->node; @@ -271,7 +271,7 @@ MBool Element::getAttr(txAtom* aLocalName, PRInt32 aNSID, if (attrNode->getLocalName(&localName) && aNSID == attrNode->getNamespaceID() && aLocalName == localName) { - aValue.append(attrNode->getValue()); + aValue.Append(attrNode->getValue()); TX_IF_RELEASE_ATOM(localName); return MB_TRUE; } diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/NamedNodeMap.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/NamedNodeMap.cpp index 585cdcfddf5..904b8f5ab5a 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/NamedNodeMap.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/NamedNodeMap.cpp @@ -98,7 +98,7 @@ NodeListDefinition::ListItem* while (pSearchItem) { - if (name.isEqual(pSearchItem->node->getNodeName())) + if (name.Equals(pSearchItem->node->getNodeName())) return pSearchItem; pSearchItem = pSearchItem->next; diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp index f7efba7a96f..9ff0fee681f 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/NodeDefinition.cpp @@ -389,17 +389,17 @@ PRInt32 NodeDefinition::lookupNamespaceID(txAtom* aPrefix) if (node->getNodeType() != Node::ELEMENT_NODE) node = node->getXPathParent(); - String name("xmlns:"); + String name(NS_LITERAL_STRING("xmlns:")); if (aPrefix && (aPrefix != txXMLAtoms::_empty)) { // We have a prefix, search for xmlns:prefix attributes. String prefixString; TX_GET_ATOM_STRING(aPrefix, prefixString); - name.append(prefixString); + name.Append(prefixString); } else { // No prefix, look up the default namespace by searching for xmlns // attributes. Remove the trailing :, set length to 5 (xmlns). - name.truncate(5); + name.Truncate(5); } Attr* xmlns; while (node && node->getNodeType() == Node::ELEMENT_NODE) { diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/Text.cpp b/mozilla/extensions/transformiix/source/xml/dom/standalone/Text.cpp index 617079e3f19..517fe59b39f 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/Text.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/Text.cpp @@ -34,7 +34,7 @@ //Construct a text object with the specified document owner and data // Text::Text(const String& theData, Document* owner) : - CharacterData(Node::TEXT_NODE, String("#text"), theData, owner) + CharacterData(Node::TEXT_NODE, String(NS_LITERAL_STRING("#text")), theData, owner) { } @@ -57,11 +57,11 @@ Text* Text::splitText(PRUint32 offset) Text* newTextSibling = NULL; String newData; - if (offset < nodeValue.length()) + if (offset < nodeValue.Length()) { newTextSibling = getOwnerDocument()->createTextNode(nodeValue.subString(offset, newData)); getParentNode()->insertBefore(newTextSibling, getNextSibling()); - nodeValue.deleteChars(offset, nodeValue.length() - offset); + nodeValue.Cut(offset, nodeValue.Length() - offset); } return newTextSibling; diff --git a/mozilla/extensions/transformiix/source/xml/dom/standalone/dom.h b/mozilla/extensions/transformiix/source/xml/dom/standalone/dom.h index ec493f27a77..213d00301d7 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/standalone/dom.h +++ b/mozilla/extensions/transformiix/source/xml/dom/standalone/dom.h @@ -46,8 +46,6 @@ typedef 0 NULL; #endif -typedef UNICODE_CHAR DOM_CHAR; - #define kTxNsNodeIndexOffset 0x00000000; #define kTxAttrIndexOffset 0x40000000; #define kTxChildIndexOffset 0x80000000; @@ -711,7 +709,7 @@ public: while (nameIter.hasNext()) { uri = (String*)nameIter.next(); id++; - if (uri->isEqual(aURI)) + if (uri->Equals(aURI)) return id; } uri = new String(aURI); @@ -752,21 +750,21 @@ public: * xmlns prefix is 1, mapped to http://www.w3.org/2000/xmlns/ * xml prefix is 2, mapped to http://www.w3.org/XML/1998/namespace */ - String* XMLNSUri = new String("http://www.w3.org/2000/xmlns/"); + String* XMLNSUri = new String(NS_LITERAL_STRING("http://www.w3.org/2000/xmlns/")); if (!XMLNSUri) { delete mNamespaces; mNamespaces = 0; return MB_FALSE; } mNamespaces->add(XMLNSUri); - String* XMLUri = new String("http://www.w3.org/XML/1998/namespace"); + String* XMLUri = new String(NS_LITERAL_STRING("http://www.w3.org/XML/1998/namespace")); if (!XMLUri) { delete mNamespaces; mNamespaces = 0; return MB_FALSE; } mNamespaces->add(XMLUri); - String* XSLTUri = new String("http://www.w3.org/1999/XSL/Transform"); + String* XSLTUri = new String(NS_LITERAL_STRING("http://www.w3.org/1999/XSL/Transform")); if (!XSLTUri) { delete mNamespaces; mNamespaces = 0; diff --git a/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp b/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp index ec3b7fb413b..8bb0c37e096 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp +++ b/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp @@ -29,9 +29,9 @@ * * Marina Mechtcheriakova, mmarina@mindspring.com * -- UNICODE fix in method startElement, changed casting of - * char* to DOM_CHAR* to use the proper String constructor, + * char* to PRUnichar* to use the proper String constructor, * see method startElement - * -- Removed a number of castings of XML_Char to DOM_CHAR since they + * -- Removed a number of castings of XML_Char to PRUnichar since they * were not working on Windows properly * */ @@ -91,9 +91,9 @@ Document* XMLParser::getDocumentFromURI(const String& href, NS_ENSURE_SUCCESS(rv, 0); rv = loader->LoadDocument(channel, loaderUri, getter_AddRefs(theDocument)); if (NS_FAILED(rv) || !theDocument) { - errMsg.append("Document load of "); - errMsg.append(href); - errMsg.append(" failed."); + errMsg.Append(NS_LITERAL_STRING("Document load of ")); + errMsg.Append(href); + errMsg.Append(NS_LITERAL_STRING(" failed.")); return NULL; } @@ -107,7 +107,7 @@ Document* XMLParser::getDocumentFromURI(const String& href, delete xslInput; } if (!resultDoc) { - errMsg.append(getErrorString()); + errMsg.Append(getErrorString()); } return resultDoc; #endif @@ -136,9 +136,9 @@ Document* XMLParser::parse(istream& inputStream, const String& uri) char buf[bufferSize]; int done; - errorString.clear(); + errorString.Truncate(); if ( !inputStream ) { - errorString.append("unable to parse xml: invalid or unopen stream encountered."); + errorString.Append(NS_LITERAL_STRING("unable to parse xml: invalid or unopen stream encountered.")); return NULL; } XML_Parser parser = XML_ParserCreate(NULL); @@ -159,9 +159,9 @@ Document* XMLParser::parse(istream& inputStream, const String& uri) if (!XML_Parse(parser, buf, inputStream.gcount(), done)) { - errorString.append(XML_ErrorString(XML_GetErrorCode(parser))); - errorString.append(" at line "); - errorString.append(XML_GetCurrentLineNumber(parser)); + errorString.getNSString().AppendWithConversion(XML_ErrorString(XML_GetErrorCode(parser))); + errorString.Append(NS_LITERAL_STRING(" at line ")); + errorString.getNSString().AppendInt(XML_GetCurrentLineNumber(parser)); done = MB_TRUE; delete ps.document; ps.document = NULL; @@ -190,13 +190,13 @@ int startElement(void *userData, const XML_Char *name, const XML_Char **atts) Element* newElement; XML_Char** theAtts = (XML_Char**)atts; - String nodeName((UNICODE_CHAR *)name); + String nodeName((PRUnichar *)name); newElement = ps->document->createElement(nodeName); while (*theAtts) { - String attName((UNICODE_CHAR *)*theAtts++); - String attValue((UNICODE_CHAR *)*theAtts++); + String attName((PRUnichar *)*theAtts++); + String attValue((PRUnichar *)*theAtts++); newElement->setAttribute(attName, attValue); } @@ -217,7 +217,7 @@ int endElement(void *userData, const XML_Char* name) void charData(void* userData, const XML_Char* s, int len) { ParserState* ps = (ParserState*)userData; - String data((UNICODE_CHAR*)s, len); + String data((PRUnichar*)s, len); Node* prevSib = ps->currentNode->getLastChild(); if (prevSib && prevSib->getNodeType()==Node::TEXT_NODE){ ((CharacterData*)prevSib)->appendData(data); @@ -229,7 +229,7 @@ void charData(void* userData, const XML_Char* s, int len) void commentHandler(void* userData, const XML_Char* s) { ParserState* ps = (ParserState*)userData; - String data((UNICODE_CHAR*)s); + String data((PRUnichar*)s); ps->currentNode->appendChild(ps->document->createComment(data)); } //-- commentHandler @@ -238,8 +238,8 @@ void commentHandler(void* userData, const XML_Char* s) **/ int piHandler(void *userData, const XML_Char *target, const XML_Char *data) { ParserState* ps = (ParserState*)userData; - String targetStr((UNICODE_CHAR *)target); - String dataStr((UNICODE_CHAR *)data); + String targetStr((PRUnichar *)target); + String dataStr((PRUnichar *)data); ps->currentNode->appendChild( ps->document->createProcessingInstruction(targetStr, dataStr)); diff --git a/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp b/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp index 43b6fa7ba67..502684a92fd 100644 --- a/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/AdditiveExpr.cpp @@ -97,18 +97,18 @@ ExprResult* AdditiveExpr::evaluate(txIEvalContext* aContext) void AdditiveExpr::toString(String& str) { if ( leftExpr ) leftExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); switch ( op ) { case SUBTRACTION: - str.append(" - "); + str.Append(NS_LITERAL_STRING(" - ")); break; default: - str.append(" + "); + str.Append(NS_LITERAL_STRING(" + ")); break; } if ( rightExpr ) rightExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp b/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp index f091f41e5d0..5046071c428 100644 --- a/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp +++ b/mozilla/extensions/transformiix/source/xpath/AttributeValueTemplate.cpp @@ -83,10 +83,10 @@ ExprResult* AttributeValueTemplate::evaluate(txIEvalContext* aContext) void AttributeValueTemplate::toString(String& str) { txListIterator iter(&expressions); while (iter.hasNext()) { - str.append('{'); + str.Append(PRUnichar('{')); Expr* expr = (Expr*)iter.next(); expr->toString(str); - str.append('}'); + str.Append(PRUnichar('}')); } } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp b/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp index dca4045fba5..73152d2b26c 100644 --- a/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/BooleanExpr.cpp @@ -95,18 +95,18 @@ ExprResult* BooleanExpr::evaluate(txIEvalContext* aContext) void BooleanExpr::toString(String& str) { if ( leftExpr ) leftExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); switch ( op ) { case OR: - str.append(" or "); + str.Append(NS_LITERAL_STRING(" or ")); break; default: - str.append(" and "); + str.Append(NS_LITERAL_STRING(" and ")); break; } if ( rightExpr ) rightExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp index 116a55e091e..19e7cdea635 100644 --- a/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/BooleanFunctionCall.cpp @@ -55,7 +55,7 @@ ExprResult* BooleanFunctionCall::evaluate(txIEvalContext* aContext) case TX_BOOLEAN: { if (!requireParams(1, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); return new BooleanResult(evaluateToBoolean((Expr*)iter.next(), aContext)); @@ -63,7 +63,7 @@ ExprResult* BooleanFunctionCall::evaluate(txIEvalContext* aContext) case TX_LANG: { if (!requireParams(1, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String lang; Node* node = aContext->getContextNode(); @@ -84,8 +84,8 @@ ExprResult* BooleanFunctionCall::evaluate(txIEvalContext* aContext) arg.toUpperCase(); // case-insensitive comparison lang.toUpperCase(); result = lang.indexOf(arg) == 0 && - (lang.length() == arg.length() || - lang.charAt(arg.length()) == '-'); + (lang.Length() == arg.Length() || + lang.CharAt(arg.Length()) == '-'); } return new BooleanResult(result); @@ -93,7 +93,7 @@ ExprResult* BooleanFunctionCall::evaluate(txIEvalContext* aContext) case TX_NOT: { if (!requireParams(1, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); return new BooleanResult(!evaluateToBoolean((Expr*)iter.next(), aContext)); @@ -101,22 +101,22 @@ ExprResult* BooleanFunctionCall::evaluate(txIEvalContext* aContext) case TX_TRUE: { if (!requireParams(0, 0, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); return new BooleanResult(MB_TRUE); } case TX_FALSE: { if (!requireParams(0, 0, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); return new BooleanResult(MB_FALSE); } } - String err("Internal error"); + String err(NS_LITERAL_STRING("Internal error")); aContext->receiveError(err, NS_ERROR_UNEXPECTED); - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } nsresult BooleanFunctionCall::getNameAtom(txAtom** aAtom) diff --git a/mozilla/extensions/transformiix/source/xpath/BooleanResult.cpp b/mozilla/extensions/transformiix/source/xpath/BooleanResult.cpp index 3e5d8bdd339..647fb6b8e63 100644 --- a/mozilla/extensions/transformiix/source/xpath/BooleanResult.cpp +++ b/mozilla/extensions/transformiix/source/xpath/BooleanResult.cpp @@ -58,8 +58,8 @@ short BooleanResult::getResultType() { } //-- getResultType void BooleanResult::stringValue(String& str) { - if ( value ) str.append("true"); - else str.append("false"); + if ( value ) str.Append(NS_LITERAL_STRING("true")); + else str.Append(NS_LITERAL_STRING("false")); } //-- toString MBool BooleanResult::booleanValue() { diff --git a/mozilla/extensions/transformiix/source/xpath/ExprLexer.cpp b/mozilla/extensions/transformiix/source/xpath/ExprLexer.cpp index ed4fc8bbec8..923e8e4413b 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprLexer.cpp +++ b/mozilla/extensions/transformiix/source/xpath/ExprLexer.cpp @@ -75,10 +75,10 @@ Token::Token(const String& value, short type) this->value = value; } //-- Token -Token::Token(UNICODE_CHAR uniChar, short type) +Token::Token(PRUnichar uniChar, short type) { this->type = type; - this->value.append(uniChar); + this->value.Append(uniChar); } //-- Token /** @@ -107,30 +107,30 @@ Token::~Token() * Complex Tokens */ //-- Nodetype tokens -const String ExprLexer::COMMENT("comment"); -const String ExprLexer::NODE("node"); -const String ExprLexer::PROC_INST("processing-instruction"); -const String ExprLexer::TEXT("text"); +const String ExprLexer::COMMENT(NS_LITERAL_STRING("comment")); +const String ExprLexer::NODE(NS_LITERAL_STRING("node")); +const String ExprLexer::PROC_INST(NS_LITERAL_STRING("processing-instruction")); +const String ExprLexer::TEXT(NS_LITERAL_STRING("text")); //-- boolean -const String ExprLexer::AND("and"); -const String ExprLexer::OR("or"); +const String ExprLexer::AND(NS_LITERAL_STRING("and")); +const String ExprLexer::OR(NS_LITERAL_STRING("or")); //-- multiplicative operators -const String ExprLexer::MODULUS("mod"); -const String ExprLexer::DIVIDE("div"); +const String ExprLexer::MODULUS(NS_LITERAL_STRING("mod")); +const String ExprLexer::DIVIDE(NS_LITERAL_STRING("div")); /** * The set of Lexer error messages **/ const String ExprLexer::error_message[] = { - String("VariableReference expected"), - String("Operator expected"), - String("Literal is not closed"), - String(": not expected"), - String("! not expected, use != or not()"), - String("found a unkown character") + String(NS_LITERAL_STRING("VariableReference expected")), + String(NS_LITERAL_STRING("Operator expected")), + String(NS_LITERAL_STRING("Literal is not closed")), + String(NS_LITERAL_STRING(": not expected")), + String(NS_LITERAL_STRING("! not expected, use != or not()")), + String(NS_LITERAL_STRING("found a unkown character")) }; //---------------/ @@ -234,14 +234,14 @@ MBool ExprLexer::nextIsOperatorToken(Token* token) **/ void ExprLexer::parse(const String& pattern) { - if (pattern.isEmpty()) + if (pattern.IsEmpty()) return; String tokenBuffer; PRUint32 iter = 0, start; - PRUint32 size = pattern.length(); + PRUint32 size = pattern.Length(); short defType; - UNICODE_CHAR ch; + PRUnichar ch; //-- initialize previous token, this will automatically get //-- deleted when it goes out of scope @@ -251,11 +251,11 @@ void ExprLexer::parse(const String& pattern) while (iter < size) { - ch = pattern.charAt(iter); + ch = pattern.CharAt(iter); defType = Token::CNAME; if (ch==DOLLAR_SIGN) { - if (++iter == size || !XMLUtils::isLetter(ch=pattern.charAt(iter))) { + if (++iter == size || !XMLUtils::isLetter(ch=pattern.CharAt(iter))) { // Error, VariableReference expected errorPos = iter; errorCode = ERROR_UNRESOLVED_VAR_REFERENCE; @@ -277,27 +277,27 @@ void ExprLexer::parse(const String& pattern) // and are dealt with below start = iter; while (++iter < size && - XMLUtils::isNCNameChar(pattern.charAt(iter))) /* just go */ ; - if (iter < size && pattern.charAt(iter)==COLON) { + XMLUtils::isNCNameChar(pattern.CharAt(iter))) /* just go */ ; + if (iter < size && pattern.CharAt(iter)==COLON) { // try QName or wildcard, might need to step back for axis if (++iter < size) - if (XMLUtils::isLetter(pattern.charAt(iter))) + if (XMLUtils::isLetter(pattern.CharAt(iter))) while (++iter < size && - XMLUtils::isNCNameChar(pattern.charAt(iter))) /* just go */ ; - else if (pattern.charAt(iter)=='*' + XMLUtils::isNCNameChar(pattern.CharAt(iter))) /* just go */ ; + else if (pattern.CharAt(iter)=='*' && defType != Token::VAR_REFERENCE) ++iter; /* eat wildcard for NameTest, bail for var ref at COLON */ else iter--; // step back } if (nextIsOperatorToken(prevToken)) { - if (pattern.subString(start,iter,subStr).isEqual(AND)) + if (pattern.subString(start,iter,subStr).Equals(AND)) defType = Token::AND_OP; - else if (pattern.subString(start,iter,subStr).isEqual(OR)) + else if (pattern.subString(start,iter,subStr).Equals(OR)) defType = Token::OR_OP; - else if (pattern.subString(start,iter,subStr).isEqual(MODULUS)) + else if (pattern.subString(start,iter,subStr).Equals(MODULUS)) defType = Token::MODULUS_OP; - else if (pattern.subString(start,iter,subStr).isEqual(DIVIDE)) + else if (pattern.subString(start,iter,subStr).Equals(DIVIDE)) defType = Token::DIVIDE_OP; else { // Error "operator expected" @@ -317,10 +317,10 @@ void ExprLexer::parse(const String& pattern) else if (isXPathDigit(ch)) { start = iter; while (++iter < size && - isXPathDigit(pattern.charAt(iter))) /* just go */; - if (iter < size && pattern.charAt(iter) == '.') + isXPathDigit(pattern.CharAt(iter))) /* just go */; + if (iter < size && pattern.CharAt(iter) == '.') while (++iter < size && - isXPathDigit(pattern.charAt(iter))) /* just go */; + isXPathDigit(pattern.CharAt(iter))) /* just go */; addToken(new Token(pattern.subString(start,iter,subStr),Token::NUMBER)); } else { @@ -355,11 +355,11 @@ void ExprLexer::parse(const String& pattern) case PERIOD: // period can be .., .(DIGITS)+ or ., check next if (++iter < size) { - ch=pattern.charAt(iter); + ch=pattern.CharAt(iter); if (isXPathDigit(ch)) { start=iter-1; while (++iter < size && - isXPathDigit(pattern.charAt(iter))) /* just go */; + isXPathDigit(pattern.CharAt(iter))) /* just go */; addToken(new Token(pattern.subString(start,iter,subStr), Token::NUMBER)); } @@ -376,7 +376,7 @@ void ExprLexer::parse(const String& pattern) break; case COLON: // QNames are dealt above, must be axis ident - if (++iter < size && pattern.charAt(iter)==COLON && + if (++iter < size && pattern.CharAt(iter)==COLON && prevToken->type == Token::CNAME) { prevToken->type = Token::AXIS_IDENTIFIER; ++iter; @@ -393,7 +393,7 @@ void ExprLexer::parse(const String& pattern) } break; case FORWARD_SLASH : - if (++iter < size && pattern.charAt(iter)==ch) { + if (++iter < size && pattern.CharAt(iter)==ch) { addToken(new Token(pattern.subString(iter-1,++iter,subStr), Token::ANCESTOR_OP)); } @@ -402,7 +402,7 @@ void ExprLexer::parse(const String& pattern) } break; case BANG : // can only be != - if (++iter < size && pattern.charAt(iter)==EQUAL) { + if (++iter < size && pattern.CharAt(iter)==EQUAL) { addToken(new Token(pattern.subString(iter-1,++iter,subStr), Token::NOT_EQUAL_OP)); } @@ -422,7 +422,7 @@ void ExprLexer::parse(const String& pattern) ++iter; break; case L_ANGLE: - if (++iter < size && pattern.charAt(iter)==EQUAL) { + if (++iter < size && pattern.CharAt(iter)==EQUAL) { addToken(new Token(pattern.subString(iter-1,++iter,subStr), Token::LESS_OR_EQUAL_OP)); } @@ -430,7 +430,7 @@ void ExprLexer::parse(const String& pattern) addToken(new Token(ch,Token::LESS_THAN_OP)); break; case R_ANGLE: - if (++iter < size && pattern.charAt(iter)==EQUAL) { + if (++iter < size && pattern.CharAt(iter)==EQUAL) { addToken(new Token(pattern.subString(iter-1,++iter,subStr), Token::GREATER_OR_EQUAL_OP)); } @@ -450,13 +450,13 @@ void ExprLexer::parse(const String& pattern) break; case L_PAREN: if (prevToken->type == Token::CNAME) { - if (prevToken->value.isEqual(COMMENT)) + if (prevToken->value.Equals(COMMENT)) prevToken->type = Token::COMMENT; - else if (prevToken->value.isEqual(NODE)) + else if (prevToken->value.Equals(NODE)) prevToken->type = Token::NODE; - else if (prevToken->value.isEqual(PROC_INST)) + else if (prevToken->value.Equals(PROC_INST)) prevToken->type = Token::PROC_INST; - else if (prevToken->value.isEqual(TEXT)) + else if (prevToken->value.Equals(TEXT)) prevToken->type = Token::TEXT; else prevToken->type = Token::FUNCTION_NAME; diff --git a/mozilla/extensions/transformiix/source/xpath/ExprLexer.h b/mozilla/extensions/transformiix/source/xpath/ExprLexer.h index 10d5db81eed..671d0d7f1f8 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprLexer.h +++ b/mozilla/extensions/transformiix/source/xpath/ExprLexer.h @@ -119,7 +119,7 @@ public: Token(); Token(short type); Token(const String& value, short type); - Token(UNICODE_CHAR uniChar, short type); + Token(PRUnichar uniChar, short type); /** * Copy Constructor **/ @@ -254,7 +254,7 @@ private: * Returns true if the given character represents a numeric letter (digit) * Implemented in ExprLexerChars.cpp **/ - static MBool isXPathDigit(UNICODE_CHAR ch) + static MBool isXPathDigit(PRUnichar ch) { return (ch >= '0' && ch <= '9'); } diff --git a/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp b/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp index c046431274d..04f84af5add 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp +++ b/mozilla/extensions/transformiix/source/xpath/ExprParser.cpp @@ -80,33 +80,33 @@ public: static const String FLOOR_FN; }; -const String XPathNames::BOOLEAN_FN("boolean"); -const String XPathNames::CONCAT_FN("concat"); -const String XPathNames::CONTAINS_FN("contains"); -const String XPathNames::COUNT_FN("count"); -const String XPathNames::FALSE_FN("false"); -const String XPathNames::ID_FN("id"); -const String XPathNames::LAST_FN("last"); -const String XPathNames::LOCAL_NAME_FN("local-name"); -const String XPathNames::NAME_FN("name"); -const String XPathNames::NAMESPACE_URI_FN("namespace-uri"); -const String XPathNames::NORMALIZE_SPACE_FN("normalize-space"); -const String XPathNames::NOT_FN("not"); -const String XPathNames::POSITION_FN("position"); -const String XPathNames::STARTS_WITH_FN("starts-with"); -const String XPathNames::STRING_FN("string"); -const String XPathNames::STRING_LENGTH_FN("string-length"); -const String XPathNames::SUBSTRING_FN("substring"); -const String XPathNames::SUBSTRING_AFTER_FN("substring-after"); -const String XPathNames::SUBSTRING_BEFORE_FN("substring-before"); -const String XPathNames::SUM_FN("sum"); -const String XPathNames::TRANSLATE_FN("translate"); -const String XPathNames::TRUE_FN("true"); -const String XPathNames::NUMBER_FN("number"); -const String XPathNames::ROUND_FN("round"); -const String XPathNames::CEILING_FN("ceiling"); -const String XPathNames::FLOOR_FN("floor"); -const String XPathNames::LANG_FN("lang"); +const String XPathNames::BOOLEAN_FN(NS_LITERAL_STRING("boolean")); +const String XPathNames::CONCAT_FN(NS_LITERAL_STRING("concat")); +const String XPathNames::CONTAINS_FN(NS_LITERAL_STRING("contains")); +const String XPathNames::COUNT_FN(NS_LITERAL_STRING("count")); +const String XPathNames::FALSE_FN(NS_LITERAL_STRING("false")); +const String XPathNames::ID_FN(NS_LITERAL_STRING("id")); +const String XPathNames::LAST_FN(NS_LITERAL_STRING("last")); +const String XPathNames::LOCAL_NAME_FN(NS_LITERAL_STRING("local-name")); +const String XPathNames::NAME_FN(NS_LITERAL_STRING("name")); +const String XPathNames::NAMESPACE_URI_FN(NS_LITERAL_STRING("namespace-uri")); +const String XPathNames::NORMALIZE_SPACE_FN(NS_LITERAL_STRING("normalize-space")); +const String XPathNames::NOT_FN(NS_LITERAL_STRING("not")); +const String XPathNames::POSITION_FN(NS_LITERAL_STRING("position")); +const String XPathNames::STARTS_WITH_FN(NS_LITERAL_STRING("starts-with")); +const String XPathNames::STRING_FN(NS_LITERAL_STRING("string")); +const String XPathNames::STRING_LENGTH_FN(NS_LITERAL_STRING("string-length")); +const String XPathNames::SUBSTRING_FN(NS_LITERAL_STRING("substring")); +const String XPathNames::SUBSTRING_AFTER_FN(NS_LITERAL_STRING("substring-after")); +const String XPathNames::SUBSTRING_BEFORE_FN(NS_LITERAL_STRING("substring-before")); +const String XPathNames::SUM_FN(NS_LITERAL_STRING("sum")); +const String XPathNames::TRANSLATE_FN(NS_LITERAL_STRING("translate")); +const String XPathNames::TRUE_FN(NS_LITERAL_STRING("true")); +const String XPathNames::NUMBER_FN(NS_LITERAL_STRING("number")); +const String XPathNames::ROUND_FN(NS_LITERAL_STRING("round")); +const String XPathNames::CEILING_FN(NS_LITERAL_STRING("ceiling")); +const String XPathNames::FLOOR_FN(NS_LITERAL_STRING("floor")); +const String XPathNames::LANG_FN(NS_LITERAL_STRING("lang")); /** @@ -122,32 +122,32 @@ AttributeValueTemplate* ExprParser::createAttributeValueTemplate return 0; } - if (attValue.isEmpty()) + if (attValue.IsEmpty()) return avt; - PRUint32 size = attValue.length(); + PRUint32 size = attValue.Length(); PRUint32 cc = 0; - UNICODE_CHAR nextCh; - UNICODE_CHAR ch; + PRUnichar nextCh; + PRUnichar ch; String buffer; MBool inExpr = MB_FALSE; MBool inLiteral = MB_FALSE; - UNICODE_CHAR endLiteral = 0; + PRUnichar endLiteral = 0; - nextCh = attValue.charAt(cc); + nextCh = attValue.CharAt(cc); while (cc++ < size) { ch = nextCh; - nextCh = cc != size ? attValue.charAt(cc) : 0; + nextCh = cc != size ? attValue.CharAt(cc) : 0; // if in literal just add ch to buffer if (inLiteral && (ch != endLiteral)) { - buffer.append(ch); + buffer.Append(ch); continue; } switch ( ch ) { case '\'' : case '"' : - buffer.append(ch); + buffer.Append(ch); if (inLiteral) inLiteral = MB_FALSE; else if (inExpr) { @@ -159,12 +159,12 @@ AttributeValueTemplate* ExprParser::createAttributeValueTemplate if (!inExpr) { // Ignore case where we find two { if (nextCh == ch) { - buffer.append(ch); //-- append '{' + buffer.Append(ch); //-- append '{' cc++; - nextCh = cc != size ? attValue.charAt(cc) : 0; + nextCh = cc != size ? attValue.CharAt(cc) : 0; } else { - if (!buffer.isEmpty()) { + if (!buffer.IsEmpty()) { Expr* strExpr = new StringExpr(buffer); if (!strExpr) { // XXX ErrorReport: out of memory @@ -173,12 +173,12 @@ AttributeValueTemplate* ExprParser::createAttributeValueTemplate } avt->addExpr(strExpr); } - buffer.clear(); + buffer.Truncate(); inExpr = MB_TRUE; } } else - buffer.append(ch); //-- simply append '{' + buffer.Append(ch); //-- simply append '{' break; case '}': if (inExpr) { @@ -190,12 +190,12 @@ AttributeValueTemplate* ExprParser::createAttributeValueTemplate return 0; } avt->addExpr(expr); - buffer.clear(); + buffer.Truncate(); } else if (nextCh == ch) { - buffer.append(ch); + buffer.Append(ch); cc++; - nextCh = cc != size ? attValue.charAt(cc) : 0; + nextCh = cc != size ? attValue.CharAt(cc) : 0; } else { //XXX ErrorReport: unmatched '}' found @@ -204,7 +204,7 @@ AttributeValueTemplate* ExprParser::createAttributeValueTemplate } break; default: - buffer.append(ch); + buffer.Append(ch); break; } } @@ -215,7 +215,7 @@ AttributeValueTemplate* ExprParser::createAttributeValueTemplate return 0; } - if (!buffer.isEmpty()) { + if (!buffer.IsEmpty()) { Expr* strExpr = new StringExpr(buffer); if (!strExpr) { // XXX ErrorReport: out of memory @@ -470,85 +470,85 @@ Expr* ExprParser::createFunctionCall(ExprLexer& lexer, nsresult rv = NS_OK; - if (XPathNames::BOOLEAN_FN.isEqual(tok->value)) { + if (XPathNames::BOOLEAN_FN.Equals(tok->value)) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::TX_BOOLEAN); } - else if (XPathNames::CONCAT_FN.isEqual(tok->value)) { + else if (XPathNames::CONCAT_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::CONCAT); } - else if (XPathNames::CONTAINS_FN.isEqual(tok->value)) { + else if (XPathNames::CONTAINS_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::CONTAINS); } - else if (XPathNames::COUNT_FN.isEqual(tok->value)) { + else if (XPathNames::COUNT_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::COUNT); } - else if (XPathNames::FALSE_FN.isEqual(tok->value)) { + else if (XPathNames::FALSE_FN.Equals(tok->value)) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::TX_FALSE); } - else if (XPathNames::ID_FN.isEqual(tok->value)) { + else if (XPathNames::ID_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::ID); } - else if (XPathNames::LANG_FN.isEqual(tok->value)) { + else if (XPathNames::LANG_FN.Equals(tok->value)) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::TX_LANG); } - else if (XPathNames::LAST_FN.isEqual(tok->value)) { + else if (XPathNames::LAST_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::LAST); } - else if (XPathNames::LOCAL_NAME_FN.isEqual(tok->value)) { + else if (XPathNames::LOCAL_NAME_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::LOCAL_NAME); } - else if (XPathNames::NAME_FN.isEqual(tok->value)) { + else if (XPathNames::NAME_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::NAME); } - else if (XPathNames::NAMESPACE_URI_FN.isEqual(tok->value)) { + else if (XPathNames::NAMESPACE_URI_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::NAMESPACE_URI); } - else if (XPathNames::NORMALIZE_SPACE_FN.isEqual(tok->value)) { + else if (XPathNames::NORMALIZE_SPACE_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::NORMALIZE_SPACE); } - else if (XPathNames::NOT_FN.isEqual(tok->value)) { + else if (XPathNames::NOT_FN.Equals(tok->value)) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::TX_NOT); } - else if (XPathNames::POSITION_FN.isEqual(tok->value)) { + else if (XPathNames::POSITION_FN.Equals(tok->value)) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::POSITION); } - else if (XPathNames::STARTS_WITH_FN.isEqual(tok->value)) { + else if (XPathNames::STARTS_WITH_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::STARTS_WITH); } - else if (XPathNames::STRING_FN.isEqual(tok->value)) { + else if (XPathNames::STRING_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::STRING); } - else if (XPathNames::STRING_LENGTH_FN.isEqual(tok->value)) { + else if (XPathNames::STRING_LENGTH_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::STRING_LENGTH); } - else if (XPathNames::SUBSTRING_FN.isEqual(tok->value)) { + else if (XPathNames::SUBSTRING_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::SUBSTRING); } - else if (XPathNames::SUBSTRING_AFTER_FN.isEqual(tok->value)) { + else if (XPathNames::SUBSTRING_AFTER_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::SUBSTRING_AFTER); } - else if (XPathNames::SUBSTRING_BEFORE_FN.isEqual(tok->value)) { + else if (XPathNames::SUBSTRING_BEFORE_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::SUBSTRING_BEFORE); } - else if (XPathNames::SUM_FN.isEqual(tok->value)) { + else if (XPathNames::SUM_FN.Equals(tok->value)) { fnCall = new NumberFunctionCall(NumberFunctionCall::SUM); } - else if (XPathNames::TRANSLATE_FN.isEqual(tok->value)) { + else if (XPathNames::TRANSLATE_FN.Equals(tok->value)) { fnCall = new StringFunctionCall(StringFunctionCall::TRANSLATE); } - else if (XPathNames::TRUE_FN.isEqual(tok->value)) { + else if (XPathNames::TRUE_FN.Equals(tok->value)) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::TX_TRUE); } - else if (XPathNames::NUMBER_FN.isEqual(tok->value)) { + else if (XPathNames::NUMBER_FN.Equals(tok->value)) { fnCall = new NumberFunctionCall(NumberFunctionCall::NUMBER); } - else if (XPathNames::ROUND_FN.isEqual(tok->value)) { + else if (XPathNames::ROUND_FN.Equals(tok->value)) { fnCall = new NumberFunctionCall(NumberFunctionCall::ROUND); } - else if (XPathNames::CEILING_FN.isEqual(tok->value)) { + else if (XPathNames::CEILING_FN.Equals(tok->value)) { fnCall = new NumberFunctionCall(NumberFunctionCall::CEILING); } - else if (XPathNames::FLOOR_FN.isEqual(tok->value)) { + else if (XPathNames::FLOOR_FN.Equals(tok->value)) { fnCall = new NumberFunctionCall(NumberFunctionCall::FLOOR); } else { @@ -573,7 +573,7 @@ Expr* ExprParser::createFunctionCall(ExprLexer& lexer, return 0; } String err(tok->value); - err.append(" not implemented."); + err.Append(NS_LITERAL_STRING(" not implemented.")); return new StringExpr(err); } @@ -612,43 +612,43 @@ LocationStep* ExprParser::createLocationStep(ExprLexer& lexer, //-- eat token lexer.nextToken(); //-- should switch to a hash here for speed if necessary - if (ANCESTOR_AXIS.isEqual(tok->value)) { + if (ANCESTOR_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::ANCESTOR_AXIS; } - else if (ANCESTOR_OR_SELF_AXIS.isEqual(tok->value)) { + else if (ANCESTOR_OR_SELF_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::ANCESTOR_OR_SELF_AXIS; } - else if (ATTRIBUTE_AXIS.isEqual(tok->value)) { + else if (ATTRIBUTE_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::ATTRIBUTE_AXIS; } - else if (CHILD_AXIS.isEqual(tok->value)) { + else if (CHILD_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::CHILD_AXIS; } - else if (DESCENDANT_AXIS.isEqual(tok->value)) { + else if (DESCENDANT_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::DESCENDANT_AXIS; } - else if (DESCENDANT_OR_SELF_AXIS.isEqual(tok->value)) { + else if (DESCENDANT_OR_SELF_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::DESCENDANT_OR_SELF_AXIS; } - else if (FOLLOWING_AXIS.isEqual(tok->value)) { + else if (FOLLOWING_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::FOLLOWING_AXIS; } - else if (FOLLOWING_SIBLING_AXIS.isEqual(tok->value)) { + else if (FOLLOWING_SIBLING_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::FOLLOWING_SIBLING_AXIS; } - else if (NAMESPACE_AXIS.isEqual(tok->value)) { + else if (NAMESPACE_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::NAMESPACE_AXIS; } - else if (PARENT_AXIS.isEqual(tok->value)) { + else if (PARENT_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::PARENT_AXIS; } - else if (PRECEDING_AXIS.isEqual(tok->value)) { + else if (PRECEDING_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::PRECEDING_AXIS; } - else if (PRECEDING_SIBLING_AXIS.isEqual(tok->value)) { + else if (PRECEDING_SIBLING_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::PRECEDING_SIBLING_AXIS; } - else if (SELF_AXIS.isEqual(tok->value)) { + else if (SELF_AXIS.Equals(tok->value)) { axisIdentifier = LocationStep::SELF_AXIS; } else { diff --git a/mozilla/extensions/transformiix/source/xpath/ExprResult.h b/mozilla/extensions/transformiix/source/xpath/ExprResult.h index 23374892e93..066eb7a27d2 100644 --- a/mozilla/extensions/transformiix/source/xpath/ExprResult.h +++ b/mozilla/extensions/transformiix/source/xpath/ExprResult.h @@ -129,8 +129,7 @@ class StringResult : public ExprResult { public: StringResult(); - StringResult(const String& str); - StringResult(const char* str); + StringResult(const nsAString& str); virtual ExprResult* clone(); virtual short getResultType(); diff --git a/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp b/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp index d5907adeff9..dda17aaf0f9 100644 --- a/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/FilterExpr.cpp @@ -73,7 +73,7 @@ ExprResult* FilterExpr::evaluate(txIEvalContext* aContext) } else if(!isEmpty()) { // We can't filter a non-nodeset - String err("Expecting nodeset as result of: "); + String err(NS_LITERAL_STRING("Expecting nodeset as result of: ")); expr->toString(err); aContext->receiveError(err, NS_ERROR_XPATH_EVAL_FAILED); delete exprResult; @@ -90,7 +90,7 @@ ExprResult* FilterExpr::evaluate(txIEvalContext* aContext) **/ void FilterExpr::toString(String& str) { if ( expr ) expr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); PredicateList::toString(str); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp index 6eb84eea769..6839b5f9500 100644 --- a/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/FunctionCall.cpp @@ -33,10 +33,10 @@ **/ const String FunctionCall::INVALID_PARAM_COUNT( - "invalid number of parameters for function: "); + NS_LITERAL_STRING("invalid number of parameters for function: ")); const String FunctionCall::INVALID_PARAM_VALUE( - "invalid parameter value for function: "); + NS_LITERAL_STRING("invalid parameter value for function: ")); FunctionCall::FunctionCall() { @@ -126,7 +126,7 @@ NodeSet* FunctionCall::evaluateToNodeSet(Expr* aExpr, txIEvalContext* aContext) return 0; if (exprResult->getResultType() != ExprResult::NODESET) { - String err("NodeSet expected as argument"); + String err(NS_LITERAL_STRING("NodeSet expected as argument")); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); delete exprResult; return 0; @@ -187,17 +187,17 @@ void FunctionCall::toString(String& aDest) } TX_RELEASE_ATOM(functionNameAtom); - aDest.append(functionName); - aDest.append('('); + aDest.Append(functionName); + aDest.Append(PRUnichar('(')); txListIterator iter(¶ms); MBool addComma = MB_FALSE; while (iter.hasNext()) { if (addComma) { - aDest.append(','); + aDest.Append(PRUnichar(',')); } addComma = MB_TRUE; Expr* expr = (Expr*)iter.next(); expr->toString(aDest); } - aDest.append(')'); + aDest.Append(PRUnichar(')')); } diff --git a/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp b/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp index 1922d5440a3..f7976042c72 100644 --- a/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp +++ b/mozilla/extensions/transformiix/source/xpath/LocationStep.cpp @@ -253,40 +253,40 @@ void LocationStep::fromDescendantsRev(Node* node, txIMatchContext* cs, void LocationStep::toString(String& str) { switch (mAxisIdentifier) { case ANCESTOR_AXIS : - str.append("ancestor::"); + str.Append(NS_LITERAL_STRING("ancestor::")); break; case ANCESTOR_OR_SELF_AXIS : - str.append("ancestor-or-self::"); + str.Append(NS_LITERAL_STRING("ancestor-or-self::")); break; case ATTRIBUTE_AXIS: - str.append("@"); + str.Append(PRUnichar('@')); break; case DESCENDANT_AXIS: - str.append("descendant::"); + str.Append(NS_LITERAL_STRING("descendant::")); break; case DESCENDANT_OR_SELF_AXIS: - str.append("descendant-or-self::"); + str.Append(NS_LITERAL_STRING("descendant-or-self::")); break; case FOLLOWING_AXIS : - str.append("following::"); + str.Append(NS_LITERAL_STRING("following::")); break; case FOLLOWING_SIBLING_AXIS: - str.append("following-sibling::"); + str.Append(NS_LITERAL_STRING("following-sibling::")); break; case NAMESPACE_AXIS: - str.append("namespace::"); + str.Append(NS_LITERAL_STRING("namespace::")); break; case PARENT_AXIS : - str.append("parent::"); + str.Append(NS_LITERAL_STRING("parent::")); break; case PRECEDING_AXIS : - str.append("preceding::"); + str.Append(NS_LITERAL_STRING("preceding::")); break; case PRECEDING_SIBLING_AXIS : - str.append("preceding-sibling::"); + str.Append(NS_LITERAL_STRING("preceding-sibling::")); break; case SELF_AXIS : - str.append("self::"); + str.Append(NS_LITERAL_STRING("self::")); break; default: break; diff --git a/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp b/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp index 2bba2b8b27c..98b1407bae4 100644 --- a/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/MultiplicativeExpr.cpp @@ -132,21 +132,21 @@ ExprResult* MultiplicativeExpr::evaluate(txIEvalContext* aContext) void MultiplicativeExpr::toString(String& str) { if ( leftExpr ) leftExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); switch ( op ) { case DIVIDE: - str.append(" div "); + str.Append(NS_LITERAL_STRING(" div ")); break; case MODULUS: - str.append(" mod "); + str.Append(NS_LITERAL_STRING(" mod ")); break; default: - str.append(" * "); + str.Append(NS_LITERAL_STRING(" * ")); break; } if ( rightExpr ) rightExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp index 24583db1fbe..d72daf3cdbc 100644 --- a/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/NodeSetFunctionCall.cpp @@ -60,12 +60,12 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { case COUNT: { if (!requireParams(1, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); NodeSet* nodes; nodes = evaluateToNodeSet((Expr*)iter.next(), aContext); if (!nodes) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); double count = nodes->size(); delete nodes; @@ -74,12 +74,12 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { case ID: { if (!requireParams(1, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); ExprResult* exprResult; exprResult = ((Expr*)iter.next())->evaluate(aContext); if (!exprResult) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); NodeSet* resultSet = new NodeSet(); if (!resultSet) { @@ -127,7 +127,7 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { case LAST: { if (!requireParams(0, 0, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); return new NumberResult(aContext->size()); } @@ -136,7 +136,7 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { case NAMESPACE_URI: { if (!requireParams(0, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); Node* node = 0; // Check for optional arg @@ -144,7 +144,7 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { NodeSet* nodes; nodes = evaluateToNodeSet((Expr*)iter.next(), aContext); if (!nodes) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); if (nodes->isEmpty()) { delete nodes; @@ -197,15 +197,15 @@ ExprResult* NodeSetFunctionCall::evaluate(txIEvalContext* aContext) { case POSITION: { if (!requireParams(0, 0, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); return new NumberResult(aContext->position()); } } - String err("Internal error"); + String err(NS_LITERAL_STRING("Internal error")); aContext->receiveError(err, NS_ERROR_UNEXPECTED); - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } nsresult NodeSetFunctionCall::getNameAtom(txAtom** aAtom) diff --git a/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp index 1021c928e80..8d296d8fe43 100644 --- a/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/NumberFunctionCall.cpp @@ -61,11 +61,11 @@ ExprResult* NumberFunctionCall::evaluate(txIEvalContext* aContext) if (mType == NUMBER) { if (!requireParams(0, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } else { if (!requireParams(1, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } switch (mType) { @@ -107,7 +107,7 @@ ExprResult* NumberFunctionCall::evaluate(txIEvalContext* aContext) nodes = evaluateToNodeSet((Expr*)iter.next(), aContext); if (!nodes) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); double res = 0; int i; @@ -133,9 +133,9 @@ ExprResult* NumberFunctionCall::evaluate(txIEvalContext* aContext) } } - String err("Internal error"); + String err(NS_LITERAL_STRING("Internal error")); aContext->receiveError(err, NS_ERROR_UNEXPECTED); - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } nsresult NumberFunctionCall::getNameAtom(txAtom** aAtom) diff --git a/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp b/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp index f15b12e64d2..fafe422f862 100644 --- a/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/PathExpr.cpp @@ -42,9 +42,9 @@ //------------/ const String PathExpr::RTF_INVALID_OP( - "Result tree fragments don't allow location steps"); + NS_LITERAL_STRING("Result tree fragments don't allow location steps")); const String PathExpr::NODESET_EXPECTED( - "Filter expression must evaluate to a NodeSet"); + NS_LITERAL_STRING("Filter expression must evaluate to a NodeSet")); /** * Creates a new PathExpr @@ -103,7 +103,7 @@ ExprResult* PathExpr::evaluate(txIEvalContext* aContext) { if (!aContext || (expressions.getLength() == 0)) { NS_ASSERTION(0, "internal error"); - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } NodeSet* nodes = new NodeSet(aContext->getContextNode()); @@ -206,10 +206,10 @@ void PathExpr::toString(String& dest) while ((pxi = (PathExprItem*)iter.next())) { switch (pxi->pathOp) { case DESCENDANT_OP: - dest.append("//"); + dest.Append(NS_LITERAL_STRING("//")); break; case RELATIVE_OP: - dest.append('/'); + dest.Append(PRUnichar('/')); break; } pxi->expr->toString(dest); diff --git a/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp b/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp index 6cc8064057e..02b3015b9ac 100644 --- a/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp +++ b/mozilla/extensions/transformiix/source/xpath/PredicateList.cpp @@ -112,9 +112,9 @@ void PredicateList::toString(String& dest) txListIterator iter(&predicates); while (iter.hasNext()) { Expr* expr = (Expr*) iter.next(); - dest.append("["); + dest.Append(PRUnichar('[')); expr->toString(dest); - dest.append("]"); + dest.Append(PRUnichar(']')); } } // toString diff --git a/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp b/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp index 8d5319e917d..871bc0f4a3b 100644 --- a/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/RelationalExpr.cpp @@ -118,7 +118,7 @@ MBool RelationalExpr::compareResults(ExprResult* left, ExprResult* right) { left->stringValue(lStr); String rStr; right->stringValue(rStr); - result = !lStr.isEqual(rStr); + result = !lStr.Equals(rStr); } } else if ( op == EQUAL) { @@ -145,7 +145,7 @@ MBool RelationalExpr::compareResults(ExprResult* left, ExprResult* right) { left->stringValue(lStr); String rStr; right->stringValue(rStr); - result = lStr.isEqual(rStr); + result = lStr.Equals(rStr); } } @@ -240,31 +240,31 @@ ExprResult* RelationalExpr::evaluate(txIEvalContext* aContext) void RelationalExpr::toString(String& str) { if ( leftExpr ) leftExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); switch ( op ) { case NOT_EQUAL: - str.append("!="); + str.Append(NS_LITERAL_STRING("!=")); break; case LESS_THAN: - str.append("<"); + str.Append(PRUnichar('<')); break; case LESS_OR_EQUAL: - str.append("<="); + str.Append(NS_LITERAL_STRING("<=")); break; case GREATER_THAN : - str.append(">"); + str.Append(PRUnichar('>')); break; case GREATER_OR_EQUAL: - str.append(">="); + str.Append(NS_LITERAL_STRING(">=")); break; default: - str.append("="); + str.Append(PRUnichar('=')); break; } if ( rightExpr ) rightExpr->toString(str); - else str.append("null"); + else str.Append(NS_LITERAL_STRING("null")); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp b/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp index f847aeee251..c7f60bef318 100644 --- a/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/RootExpr.cpp @@ -65,5 +65,5 @@ ExprResult* RootExpr::evaluate(txIEvalContext* aContext) **/ void RootExpr::toString(String& dest) { if (mSerialize) - dest.append('/'); + dest.Append(PRUnichar('/')); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/StringExpr.cpp b/mozilla/extensions/transformiix/source/xpath/StringExpr.cpp index 0fef7f800ab..3ded21effb7 100644 --- a/mozilla/extensions/transformiix/source/xpath/StringExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/StringExpr.cpp @@ -35,7 +35,7 @@ **/ StringExpr::StringExpr(const String& value) { //-- copy value - this->value.append(value); + this->value.Append(value); } //-- StringExpr /** @@ -59,11 +59,11 @@ ExprResult* StringExpr::evaluate(txIEvalContext* aContext) * @return the String representation of this Expr. **/ void StringExpr::toString(String& str) { - UNICODE_CHAR ch = '\''; + PRUnichar ch = '\''; if (value.indexOf(ch) != kNotFound) ch = '\"'; - str.append(ch); - str.append(value); - str.append(ch); + str.Append(ch); + str.Append(value); + str.Append(ch); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp b/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp index 50e2b53e507..539dfb8d175 100644 --- a/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xpath/StringFunctionCall.cpp @@ -58,7 +58,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case CONCAT: { if (!requireParams(2, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String resultStr; while (iter.hasNext()) { @@ -69,7 +69,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case CONTAINS: { if (!requireParams(2, 2, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String arg1, arg2; evaluateToString((Expr*)iter.next(), aContext, arg1); @@ -79,7 +79,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case NORMALIZE_SPACE: { if (!requireParams(0, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String resultStr; if (iter.hasNext()) @@ -90,19 +90,20 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) MBool addSpace = MB_FALSE; MBool first = MB_TRUE; - String normed(resultStr.length()); - UNICODE_CHAR c; + String normed; + normed.getNSString().SetCapacity(resultStr.Length()); + PRUnichar c; PRUint32 src; - for (src = 0; src < resultStr.length(); src++) { - c = resultStr.charAt(src); + for (src = 0; src < resultStr.Length(); src++) { + c = resultStr.CharAt(src); if (XMLUtils::isWhitespace(c)) { addSpace = MB_TRUE; } else { if (addSpace && !first) - normed.append(' '); + normed.Append(PRUnichar(' ')); - normed.append(c); + normed.Append(c); addSpace = MB_FALSE; first = MB_FALSE; } @@ -112,7 +113,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case STARTS_WITH: { if (!requireParams(2, 2, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String arg1, arg2; evaluateToString((Expr*)iter.next(), aContext, arg1); @@ -122,7 +123,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case STRING_LENGTH: { if (!requireParams(0, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String resultStr; if (iter.hasNext()) @@ -130,12 +131,12 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) else XMLDOMUtils::getNodeValue(aContext->getContextNode(), resultStr); - return new NumberResult(resultStr.length()); + return new NumberResult(resultStr.Length()); } case SUBSTRING: { if (!requireParams(2, 3, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String src; double start, end; @@ -145,7 +146,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) // check for NaN or +/-Inf if (Double::isNaN(start) || Double::isInfinite(start) || - start >= src.length() + 0.5) + start >= src.Length() + 0.5) return new StringResult(); start = floor(start + 0.5) - 1; @@ -155,13 +156,13 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) if (Double::isNaN(end) || end < 0) return new StringResult(); - if (end > src.length()) - end = src.length(); + if (end > src.Length()) + end = src.Length(); else end = floor(end + 0.5); } else { - end = src.length(); + end = src.Length(); } if (start < 0) @@ -177,14 +178,14 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case SUBSTRING_AFTER: { if (!requireParams(2, 2, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String arg1, arg2; evaluateToString((Expr*)iter.next(), aContext, arg1); evaluateToString((Expr*)iter.next(), aContext, arg2); PRInt32 idx = arg1.indexOf(arg2); if (idx != kNotFound) { - PRUint32 len = arg2.length(); + PRUint32 len = arg2.Length(); arg1.subString(idx + len, arg2); return new StringResult(arg2); } @@ -193,14 +194,14 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case SUBSTRING_BEFORE: { if (!requireParams(2, 2, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String arg1, arg2; evaluateToString((Expr*)iter.next(), aContext, arg1); evaluateToString((Expr*)iter.next(), aContext, arg2); PRInt32 idx = arg1.indexOf(arg2); if (idx != kNotFound) { - arg2.clear(); + arg2.Truncate(); arg1.subString(0, idx, arg2); return new StringResult(arg2); } @@ -209,26 +210,26 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case TRANSLATE: { if (!requireParams(3, 3, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String src; evaluateToString((Expr*)iter.next(), aContext, src); - if (src.isEmpty()) + if (src.IsEmpty()) return new StringResult(); String oldChars, newChars, dest; evaluateToString((Expr*)iter.next(), aContext, oldChars); evaluateToString((Expr*)iter.next(), aContext, newChars); PRUint32 i; - PRInt32 newCharsLength = (PRInt32)newChars.length(); - for (i = 0; i < src.length(); i++) { - PRInt32 idx = oldChars.indexOf(src.charAt(i)); + PRInt32 newCharsLength = (PRInt32)newChars.Length(); + for (i = 0; i < src.Length(); i++) { + PRInt32 idx = oldChars.indexOf(src.CharAt(i)); if (idx != kNotFound) { if (idx < newCharsLength) - dest.append(newChars.charAt((PRUint32)idx)); + dest.Append(newChars.CharAt((PRUint32)idx)); } else { - dest.append(src.charAt(i)); + dest.Append(src.CharAt(i)); } } return new StringResult(dest); @@ -236,7 +237,7 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) case STRING: { if (!requireParams(0, 1, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); String resultStr; if (iter.hasNext()) @@ -248,9 +249,9 @@ ExprResult* StringFunctionCall::evaluate(txIEvalContext* aContext) } } - String err("Internal error"); + String err(NS_LITERAL_STRING("Internal error")); aContext->receiveError(err, NS_ERROR_UNEXPECTED); - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } nsresult StringFunctionCall::getNameAtom(txAtom** aAtom) diff --git a/mozilla/extensions/transformiix/source/xpath/StringResult.cpp b/mozilla/extensions/transformiix/source/xpath/StringResult.cpp index d2ed5982c23..614bf7751ec 100644 --- a/mozilla/extensions/transformiix/source/xpath/StringResult.cpp +++ b/mozilla/extensions/transformiix/source/xpath/StringResult.cpp @@ -40,18 +40,9 @@ StringResult::StringResult() { * Creates a new StringResult with the value of the given String parameter * @param str the String to use for initialization of this StringResult's value **/ -StringResult::StringResult(const String& str) { +StringResult::StringResult(const nsAString& str) { //-- copy str - this->value = str; -} //-- StringResult - -/** - * Creates a new StringResult with the value of the given String parameter - * @param str the String to use for initialization of this StringResult's value -**/ -StringResult::StringResult(const char* str) { - //-- copy str - this->value.append(str); + this->value.Append(str); } //-- StringResult /* @@ -68,11 +59,11 @@ short StringResult::getResultType() { } //-- getResultType void StringResult::stringValue(String& str) { - str.append(this->value); + str.Append(this->value); } //-- stringValue MBool StringResult::booleanValue() { - return !value.isEmpty(); + return !value.IsEmpty(); } //-- booleanValue double StringResult::numberValue() { diff --git a/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp b/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp index 18b47c6f6dc..5dc40dd2ec3 100644 --- a/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/UnaryExpr.cpp @@ -72,6 +72,6 @@ void UnaryExpr::toString(String& str) { if (!expr) return; - str.append('-'); + str.Append(PRUnichar('-')); expr->toString(str); } diff --git a/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp b/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp index 01f12f490d8..8535216c5b0 100644 --- a/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/UnionExpr.cpp @@ -84,7 +84,7 @@ ExprResult* UnionExpr::evaluate(txIEvalContext* aContext) exprResult->getResultType() != ExprResult::NODESET) { delete exprResult; delete nodes; - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } nodes->add((NodeSet*)exprResult); delete exprResult; @@ -108,7 +108,7 @@ void UnionExpr::toString(String& dest) { while (iter.hasNext()) { //-- set operator if (count > 0) - dest.append(" | "); + dest.Append(NS_LITERAL_STRING(" | ")); ((Expr*)iter.next())->toString(dest); ++count; } diff --git a/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp b/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp index 48ef8502dd6..623969c5153 100644 --- a/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp +++ b/mozilla/extensions/transformiix/source/xpath/VariableRefExpr.cpp @@ -68,7 +68,7 @@ ExprResult* VariableRefExpr::evaluate(txIEvalContext* aContext) nsresult rv = aContext->getVariable(mNamespace, mLocalName, exprResult); if (NS_FAILED(rv)) { // XXX report error, undefined variable - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); } return exprResult->clone(); } @@ -83,14 +83,14 @@ ExprResult* VariableRefExpr::evaluate(txIEvalContext* aContext) **/ void VariableRefExpr::toString(String& aDest) { - aDest.append('$'); + aDest.Append(PRUnichar('$')); if (mPrefix) { String prefix; TX_GET_ATOM_STRING(mPrefix, prefix); - aDest.append(prefix); - aDest.append(':'); + aDest.Append(prefix); + aDest.Append(PRUnichar(':')); } String lname; TX_GET_ATOM_STRING(mLocalName, lname); - aDest.append(lname); + aDest.Append(lname); } //-- toString diff --git a/mozilla/extensions/transformiix/source/xpath/txForwardContext.cpp b/mozilla/extensions/transformiix/source/xpath/txForwardContext.cpp index fc1003fe9d3..9d833191523 100644 --- a/mozilla/extensions/transformiix/source/xpath/txForwardContext.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txForwardContext.cpp @@ -73,8 +73,8 @@ void txForwardContext::receiveError(const String& aMsg, nsresult aRes) { NS_ASSERTION(mInner, "mInner is null!!!"); #ifdef DEBUG - String error("forwarded error: "); - error.append(aMsg); + String error(NS_LITERAL_STRING("forwarded error: ")); + error.Append(aMsg); mInner->receiveError(error, aRes); #else mInner->receiveError(aMsg, aRes); diff --git a/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp b/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp index e3d01f3d52f..1588902b518 100644 --- a/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txNameTest.cpp @@ -97,10 +97,10 @@ void txNameTest::toString(String& aDest) if (mPrefix) { String prefix; TX_GET_ATOM_STRING(mPrefix, prefix); - aDest.append(prefix); - aDest.append(':'); + aDest.Append(prefix); + aDest.Append(PRUnichar(':')); } String localName; TX_GET_ATOM_STRING(mLocalName, localName); - aDest.append(localName); + aDest.Append(localName); } diff --git a/mozilla/extensions/transformiix/source/xpath/txNodeSetContext.cpp b/mozilla/extensions/transformiix/source/xpath/txNodeSetContext.cpp index a29dcd5c282..849f3808656 100644 --- a/mozilla/extensions/transformiix/source/xpath/txNodeSetContext.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txNodeSetContext.cpp @@ -72,8 +72,8 @@ void txNodeSetContext::receiveError(const String& aMsg, nsresult aRes) { NS_ASSERTION(mInner, "mInner is null!!!"); #ifdef DEBUG - String error("forwarded error: "); - error.append(aMsg); + String error(NS_LITERAL_STRING("forwarded error: ")); + error.Append(aMsg); mInner->receiveError(error, aRes); #else mInner->receiveError(aMsg, aRes); diff --git a/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp b/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp index 64da786916b..64dff3cd77f 100644 --- a/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp +++ b/mozilla/extensions/transformiix/source/xpath/txNodeTypeTest.cpp @@ -98,24 +98,24 @@ void txNodeTypeTest::toString(String& aDest) { switch (mNodeType) { case COMMENT_TYPE: - aDest.append("comment()"); + aDest.Append(NS_LITERAL_STRING("comment()")); break; case TEXT_TYPE: - aDest.append("text()"); + aDest.Append(NS_LITERAL_STRING("text()")); break; case PI_TYPE: - aDest.append("processing-instruction("); + aDest.Append(NS_LITERAL_STRING("processing-instruction(")); if (mNodeName) { String str; TX_GET_ATOM_STRING(mNodeName, str); - aDest.append('\''); - aDest.append(str); - aDest.append('\''); + aDest.Append(PRUnichar('\'')); + aDest.Append(str); + aDest.Append(PRUnichar('\'')); } - aDest.append(')'); + aDest.Append(PRUnichar(')')); break; case NODE_TYPE: - aDest.append("node()"); + aDest.Append(NS_LITERAL_STRING("node()")); break; } } diff --git a/mozilla/extensions/transformiix/source/xpath/txSingleNodeContext.h b/mozilla/extensions/transformiix/source/xpath/txSingleNodeContext.h index bc6cab10c4b..7af8dad3785 100644 --- a/mozilla/extensions/transformiix/source/xpath/txSingleNodeContext.h +++ b/mozilla/extensions/transformiix/source/xpath/txSingleNodeContext.h @@ -70,8 +70,8 @@ public: { NS_ASSERTION(mInner, "mInner is null!!!"); #ifdef DEBUG - String error("forwarded error: "); - error.append(aMsg); + String error(NS_LITERAL_STRING("forwarded error: ")); + error.Append(aMsg); mInner->receiveError(error, aRes); #else mInner->receiveError(aMsg, aRes); diff --git a/mozilla/extensions/transformiix/source/xslt/Names.cpp b/mozilla/extensions/transformiix/source/xslt/Names.cpp index f6cab1158ca..449c656eca8 100644 --- a/mozilla/extensions/transformiix/source/xslt/Names.cpp +++ b/mozilla/extensions/transformiix/source/xslt/Names.cpp @@ -37,30 +37,30 @@ #include "Names.h" //-- Global Strings -const String STYLESHEET_PI("xml-stylesheet"); -const String STYLESHEET_PI_OLD("xml:stylesheet"); -const String XSL_MIME_TYPE("text/xsl"); +const String STYLESHEET_PI(NS_LITERAL_STRING("xml-stylesheet")); +const String STYLESHEET_PI_OLD(NS_LITERAL_STRING("xml:stylesheet")); +const String XSL_MIME_TYPE(NS_LITERAL_STRING("text/xsl")); //-- Attribute Values -const String ASCENDING_VALUE("ascending"); -const String DESCENDING_VALUE("descending"); -const String LOWER_FIRST_VALUE("lower-first"); -const String NUMBER_VALUE("number"); -const String TEXT_VALUE("text"); -const String UPPER_FIRST_VALUE("upper-first"); -const String YES_VALUE("yes"); +const String ASCENDING_VALUE(NS_LITERAL_STRING("ascending")); +const String DESCENDING_VALUE(NS_LITERAL_STRING("descending")); +const String LOWER_FIRST_VALUE(NS_LITERAL_STRING("lower-first")); +const String NUMBER_VALUE(NS_LITERAL_STRING("number")); +const String TEXT_VALUE(NS_LITERAL_STRING("text")); +const String UPPER_FIRST_VALUE(NS_LITERAL_STRING("upper-first")); +const String YES_VALUE(NS_LITERAL_STRING("yes")); //-- Stylesheet attributes -const String ANCESTOR_AXIS("ancestor"); -const String ANCESTOR_OR_SELF_AXIS("ancestor-or-self"); -const String ATTRIBUTE_AXIS("attribute"); -const String CHILD_AXIS("child"); -const String DESCENDANT_AXIS("descendant"); -const String DESCENDANT_OR_SELF_AXIS("descendant-or-self"); -const String FOLLOWING_AXIS("following"); -const String FOLLOWING_SIBLING_AXIS("following-sibling"); -const String NAMESPACE_AXIS("namespace"); -const String PARENT_AXIS("parent"); -const String PRECEDING_AXIS("preceding"); -const String PRECEDING_SIBLING_AXIS("preceding-sibling"); -const String SELF_AXIS("self"); +const String ANCESTOR_AXIS(NS_LITERAL_STRING("ancestor")); +const String ANCESTOR_OR_SELF_AXIS(NS_LITERAL_STRING("ancestor-or-self")); +const String ATTRIBUTE_AXIS(NS_LITERAL_STRING("attribute")); +const String CHILD_AXIS(NS_LITERAL_STRING("child")); +const String DESCENDANT_AXIS(NS_LITERAL_STRING("descendant")); +const String DESCENDANT_OR_SELF_AXIS(NS_LITERAL_STRING("descendant-or-self")); +const String FOLLOWING_AXIS(NS_LITERAL_STRING("following")); +const String FOLLOWING_SIBLING_AXIS(NS_LITERAL_STRING("following-sibling")); +const String NAMESPACE_AXIS(NS_LITERAL_STRING("namespace")); +const String PARENT_AXIS(NS_LITERAL_STRING("parent")); +const String PRECEDING_AXIS(NS_LITERAL_STRING("preceding")); +const String PRECEDING_SIBLING_AXIS(NS_LITERAL_STRING("preceding-sibling")); +const String SELF_AXIS(NS_LITERAL_STRING("self")); diff --git a/mozilla/extensions/transformiix/source/xslt/ProcessorState.cpp b/mozilla/extensions/transformiix/source/xslt/ProcessorState.cpp index 966735536f5..01ccd95f3b3 100644 --- a/mozilla/extensions/transformiix/source/xslt/ProcessorState.cpp +++ b/mozilla/extensions/transformiix/source/xslt/ProcessorState.cpp @@ -128,7 +128,7 @@ void ProcessorState::addAttributeSet(Element* aAttributeSet, aAttributeSet->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameStr); nsresult rv = name.init(nameStr, aAttributeSet, MB_FALSE); if (NS_FAILED(rv)) { - String err("missing or malformed name for xsl:attribute-set"); + String err(NS_LITERAL_STRING("missing or malformed name for xsl:attribute-set")); receiveError(err); return; } @@ -181,18 +181,18 @@ void ProcessorState::addTemplate(Element* aXslTemplate, txExpandedName name; rv = name.init(nameStr, aXslTemplate, MB_FALSE); if (NS_FAILED(rv)) { - String err("missing or malformed template name: '"); - err.append(nameStr); - err.append('\''); + String err(NS_LITERAL_STRING("missing or malformed template name: '")); + err.Append(nameStr); + err.Append(PRUnichar('\'')); receiveError(err, NS_ERROR_FAILURE); return; } rv = aImportFrame->mNamedTemplates.add(name, aXslTemplate); if (NS_FAILED(rv)) { - String err("Unable to add template named '"); - err.append(nameStr); - err.append("'. Does that name already exist?"); + String err(NS_LITERAL_STRING("Unable to add template named '")); + err.Append(nameStr); + err.Append(NS_LITERAL_STRING("'. Does that name already exist?")); receiveError(err, NS_ERROR_FAILURE); return; } @@ -210,9 +210,9 @@ void ProcessorState::addTemplate(Element* aXslTemplate, if (aXslTemplate->getAttr(txXSLTAtoms::mode, kNameSpaceID_None, modeStr)) { rv = mode.init(modeStr, aXslTemplate, MB_FALSE); if (NS_FAILED(rv)) { - String err("malformed template-mode name: '"); - err.append(modeStr); - err.append('\''); + String err(NS_LITERAL_STRING("malformed template-mode name: '")); + err.Append(modeStr); + err.Append(PRUnichar('\'')); receiveError(err, NS_ERROR_FAILURE); return; } @@ -376,10 +376,10 @@ Node* ProcessorState::retrieveDocument(const String& uri, const String& baseUri) xmlDoc = xmlParser.getDocumentFromURI(docUrl, xslDocument, errMsg); if (!xmlDoc) { - String err("Couldn't load document '"); - err.append(docUrl); - err.append("': "); - err.append(errMsg); + String err(NS_LITERAL_STRING("Couldn't load document '")); + err.Append(docUrl); + err.Append(NS_LITERAL_STRING("': ")); + err.Append(errMsg); receiveError(err, NS_ERROR_XSLT_INVALID_URL); return NULL; } @@ -388,7 +388,7 @@ Node* ProcessorState::retrieveDocument(const String& uri, const String& baseUri) } // return element with supplied id if supplied - if (!frag.isEmpty()) + if (!frag.IsEmpty()) return xmlDoc->getElementById(frag); return xmlDoc; @@ -575,8 +575,8 @@ Expr* ProcessorState::getExpr(Element* aElem, ExprAttr aAttr) expr = ExprParser::createExpr(attr, &pContext); if (!expr) { - String err("Error in parsing XPath expression: "); - err.append(attr); + String err(NS_LITERAL_STRING("Error in parsing XPath expression: ")); + err.Append(attr); receiveError(err, NS_ERROR_XPATH_PARSE_FAILED); } else { @@ -614,8 +614,8 @@ txPattern* ProcessorState::getPattern(Element* aElem, PatternAttr aAttr) pattern = txPatternParser::createPattern(attr, &pContext, this); if (!pattern) { - String err("Error in parsing pattern: "); - err.append(attr); + String err(NS_LITERAL_STRING("Error in parsing pattern: ")); + err.Append(attr); receiveError(err, NS_ERROR_XPATH_PARSE_FAILED); } else { @@ -710,14 +710,14 @@ void ProcessorState::processAttrValueTemplate(const String& aAttValue, Element* aContext, String& aResult) { - aResult.clear(); + aResult.Truncate(); txPSParseContext pContext(this, aContext); AttributeValueTemplate* avt = ExprParser::createAttributeValueTemplate(aAttValue, &pContext); if (!avt) { // fallback, just copy the attribute - aResult.append(aAttValue); + aResult.Append(aAttValue); return; } @@ -750,7 +750,7 @@ void ProcessorState::shouldStripSpace(String& aNames, Element* aElement, PRInt32 aNSID = kNameSpaceID_None; txAtom* prefixAtom = 0; XMLUtils::getPrefix(name, prefix); - if (!prefix.isEmpty()) { + if (!prefix.IsEmpty()) { prefixAtom = TX_GET_ATOM(prefix); aNSID = aElement->lookupNamespaceID(prefixAtom); } @@ -806,7 +806,7 @@ MBool ProcessorState::addKey(Element* aKeyElem) match = txPatternParser::createPattern(attrVal, &pContext, this); } Expr* use = 0; - attrVal.clear(); + attrVal.Truncate(); if (aKeyElem->getAttr(txXSLTAtoms::use, kNameSpaceID_None, attrVal)) { use = ExprParser::createExpr(attrVal, &pContext); } @@ -851,16 +851,16 @@ MBool ProcessorState::addDecimalFormat(Element* element) if (element->getAttr(txXSLTAtoms::decimalSeparator, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mDecimalSeparator = attValue.charAt(0); + if (attValue.Length() == 1) + format->mDecimalSeparator = attValue.CharAt(0); else success = MB_FALSE; } if (element->getAttr(txXSLTAtoms::groupingSeparator, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mGroupingSeparator = attValue.charAt(0); + if (attValue.Length() == 1) + format->mGroupingSeparator = attValue.CharAt(0); else success = MB_FALSE; } @@ -871,8 +871,8 @@ MBool ProcessorState::addDecimalFormat(Element* element) if (element->getAttr(txXSLTAtoms::minusSign, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mMinusSign = attValue.charAt(0); + if (attValue.Length() == 1) + format->mMinusSign = attValue.CharAt(0); else success = MB_FALSE; } @@ -883,40 +883,40 @@ MBool ProcessorState::addDecimalFormat(Element* element) if (element->getAttr(txXSLTAtoms::percent, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mPercent = attValue.charAt(0); + if (attValue.Length() == 1) + format->mPercent = attValue.CharAt(0); else success = MB_FALSE; } if (element->getAttr(txXSLTAtoms::perMille, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mPerMille = attValue.charAt(0); - else if (!attValue.isEmpty()) + if (attValue.Length() == 1) + format->mPerMille = attValue.CharAt(0); + else if (!attValue.IsEmpty()) success = MB_FALSE; } if (element->getAttr(txXSLTAtoms::zeroDigit, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mZeroDigit = attValue.charAt(0); - else if (!attValue.isEmpty()) + if (attValue.Length() == 1) + format->mZeroDigit = attValue.CharAt(0); + else if (!attValue.IsEmpty()) success = MB_FALSE; } if (element->getAttr(txXSLTAtoms::digit, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mDigit = attValue.charAt(0); + if (attValue.Length() == 1) + format->mDigit = attValue.CharAt(0); else success = MB_FALSE; } if (element->getAttr(txXSLTAtoms::patternSeparator, kNameSpaceID_None, attValue)) { - if (attValue.length() == 1) - format->mPatternSeparator = attValue.charAt(0); + if (attValue.Length() == 1) + format->mPatternSeparator = attValue.CharAt(0); else success = MB_FALSE; } @@ -984,7 +984,7 @@ nsresult ProcessorState::getVariable(PRInt32 aNamespace, txAtom* aLName, globVar = (GlobalVariableValue*)mGlobalVariableValues.get(varName); if (globVar) { if (globVar->mFlags == GlobalVariableValue::evaluating) { - String err("Cyclic variable-value detected"); + String err(NS_LITERAL_STRING("Cyclic variable-value detected")); receiveError(err, NS_ERROR_FAILURE); return NS_ERROR_FAILURE; } diff --git a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp index ca34948c70c..d23a0622560 100644 --- a/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/XSLTProcessor.cpp @@ -313,7 +313,7 @@ txXSLTProcessor::processAction(Node* aAction, curr = aPs->getCurrentTemplateRule(); if (!curr) { - String err("apply-imports not allowed here"); + String err(NS_LITERAL_STRING("apply-imports not allowed here")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -381,7 +381,7 @@ txXSLTProcessor::processAction(Node* aAction, kNameSpaceID_None, modeStr)) { rv = mode.init(modeStr, actionElement, MB_FALSE); if (NS_FAILED(rv)) { - String err("malformed mode-name in xsl:apply-templates"); + String err(NS_LITERAL_STRING("malformed mode-name in xsl:apply-templates")); aPs->receiveError(err); TX_IF_RELEASE_ATOM(localName); return; @@ -403,7 +403,7 @@ txXSLTProcessor::processAction(Node* aAction, aPs->setEvalContext(priorEC); } else { - String err("error processing apply-templates"); + String err(NS_LITERAL_STRING("error processing apply-templates")); aPs->receiveError(err, NS_ERROR_FAILURE); } //-- clean up @@ -414,7 +414,7 @@ txXSLTProcessor::processAction(Node* aAction, String nameAttr; if (!actionElement->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameAttr)) { - String err("missing required name attribute for xsl:attribute"); + String err(NS_LITERAL_STRING("missing required name attribute for xsl:attribute")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -426,9 +426,9 @@ txXSLTProcessor::processAction(Node* aAction, // Check name validity (must be valid QName and not xmlns) if (!XMLUtils::isValidQName(name)) { - String err("error processing xsl:attribute, "); - err.append(name); - err.append(" is not a valid QName."); + String err(NS_LITERAL_STRING("error processing xsl:attribute, ")); + err.Append(name); + err.Append(NS_LITERAL_STRING(" is not a valid QName.")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -437,7 +437,7 @@ txXSLTProcessor::processAction(Node* aAction, txAtom* nameAtom = TX_GET_ATOM(name); if (nameAtom == txXMLAtoms::xmlns) { TX_RELEASE_ATOM(nameAtom); - String err("error processing xsl:attribute, name is xmlns."); + String err(NS_LITERAL_STRING("error processing xsl:attribute, name is xmlns.")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -464,7 +464,7 @@ txXSLTProcessor::processAction(Node* aAction, resultNsID = actionElement->lookupNamespaceID(prefixAtom); else // Cut xmlns: (6 characters) - name.deleteChars(0, 6); + name.Cut(0, 6); } TX_IF_RELEASE_ATOM(prefixAtom); } @@ -506,7 +506,7 @@ txXSLTProcessor::processAction(Node* aAction, } } else { - String err("missing or malformed name in xsl:call-template"); + String err(NS_LITERAL_STRING("missing or malformed name in xsl:call-template")); aPs->receiveError(err, NS_ERROR_FAILURE); } } @@ -554,10 +554,10 @@ txXSLTProcessor::processAction(Node* aAction, String value; processChildrenAsValue(actionElement, aPs, MB_TRUE, value); PRInt32 pos = 0; - PRUint32 length = value.length(); + PRUint32 length = value.Length(); while ((pos = value.indexOf('-', pos)) != kNotFound) { ++pos; - if (((PRUint32)pos == length) || (value.charAt(pos) == '-')) { + if (((PRUint32)pos == length) || (value.CharAt(pos) == '-')) { value.insert(pos++, ' '); ++length; } @@ -586,7 +586,7 @@ txXSLTProcessor::processAction(Node* aAction, String nameAttr; if (!actionElement->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameAttr)) { - String err("missing required name attribute for xsl:element"); + String err(NS_LITERAL_STRING("missing required name attribute for xsl:element")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -598,9 +598,9 @@ txXSLTProcessor::processAction(Node* aAction, // Check name validity (must be valid QName and not xmlns) if (!XMLUtils::isValidQName(name)) { - String err("error processing xsl:element, '"); - err.append(name); - err.append("' is not a valid QName."); + String err(NS_LITERAL_STRING("error processing xsl:element, '")); + err.Append(name); + err.Append(NS_LITERAL_STRING("' is not a valid QName.")); aPs->receiveError(err, NS_ERROR_FAILURE); // XXX We should processChildren without creating attributes or // namespace nodes. @@ -615,7 +615,7 @@ txXSLTProcessor::processAction(Node* aAction, if (actionElement->getAttr(txXSLTAtoms::_namespace, kNameSpaceID_None, resultNs)) { String nsURI; aPs->processAttrValueTemplate(resultNs, actionElement, nsURI); - if (nsURI.isEmpty()) + if (nsURI.IsEmpty()) resultNsID = kNameSpaceID_None; else resultNsID = aPs->getStylesheetDocument()->namespaceURIToID(nsURI); @@ -629,9 +629,9 @@ txXSLTProcessor::processAction(Node* aAction, } if (resultNsID == kNameSpaceID_Unknown) { - String err("error processing xsl:element, can't resolve prefix on'"); - err.append(name); - err.append("'."); + String err(NS_LITERAL_STRING("error processing xsl:element, can't resolve prefix on'")); + err.Append(name); + err.Append(NS_LITERAL_STRING("'.")); aPs->receiveError(err, NS_ERROR_FAILURE); // XXX We should processChildren without creating attributes or // namespace nodes. @@ -712,7 +712,7 @@ txXSLTProcessor::processAction(Node* aAction, aPs->setEvalContext(priorEC); } else { - String err("error processing for-each"); + String err(NS_LITERAL_STRING("error processing for-each")); aPs->receiveError(err, NS_ERROR_FAILURE); } //-- clean up exprResult @@ -754,7 +754,7 @@ txXSLTProcessor::processAction(Node* aAction, } // xsl:param else if (localName == txXSLTAtoms::param) { - String err("misplaced xsl:param"); + String err(NS_LITERAL_STRING("misplaced xsl:param")); aPs->receiveError(err, NS_ERROR_FAILURE); } // xsl:processing-instruction @@ -762,8 +762,7 @@ txXSLTProcessor::processAction(Node* aAction, String nameAttr; if (!actionElement->getAttr(txXSLTAtoms::name, kNameSpaceID_None, nameAttr)) { - String err("missing required name attribute for" - " xsl:processing-instruction"); + String err(NS_LITERAL_STRING("missing required name attribute for xsl:processing-instruction")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -776,9 +775,9 @@ txXSLTProcessor::processAction(Node* aAction, // Check name validity (must be valid NCName and a PITarget) // XXX Need to check for NCName and PITarget if (!XMLUtils::isValidQName(name)) { - String err("error processing xsl:processing-instruction, '"); - err.append(name); - err.append("' is not a valid QName."); + String err(NS_LITERAL_STRING("error processing xsl:processing-instruction, '")); + err.Append(name); + err.Append(NS_LITERAL_STRING("' is not a valid QName.")); aPs->receiveError(err, NS_ERROR_FAILURE); } @@ -805,7 +804,7 @@ txXSLTProcessor::processAction(Node* aAction, String attValue; doe = actionElement->getAttr(txXSLTAtoms::disableOutputEscaping, kNameSpaceID_None, attValue) && - attValue.isEqual(YES_VALUE); + attValue.Equals(YES_VALUE); } if (doe) { aPs->mOutputHandler->charactersNoOutputEscaping(data); @@ -825,7 +824,7 @@ txXSLTProcessor::processAction(Node* aAction, ExprResult* exprResult = expr->evaluate(aPs->getEvalContext()); String value; if (!exprResult) { - String err("null ExprResult"); + String err(NS_LITERAL_STRING("null ExprResult")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -839,7 +838,7 @@ txXSLTProcessor::processAction(Node* aAction, String attValue; doe = actionElement->getAttr(txXSLTAtoms::disableOutputEscaping, kNameSpaceID_None, attValue) && - attValue.isEqual(YES_VALUE); + attValue.Equals(YES_VALUE); } if (doe) { aPs->mOutputHandler->charactersNoOutputEscaping(value); @@ -857,7 +856,7 @@ txXSLTProcessor::processAction(Node* aAction, qName); rv = varName.init(qName, actionElement, MB_FALSE); if (NS_FAILED(rv)) { - String err("bad name for xsl:variable"); + String err(NS_LITERAL_STRING("bad name for xsl:variable")); aPs->receiveError(err, NS_ERROR_FAILURE); TX_RELEASE_ATOM(localName); return; @@ -872,7 +871,7 @@ txXSLTProcessor::processAction(Node* aAction, NS_ASSERTION(vars, "missing localvariable map"); rv = vars->bindVariable(varName, exprResult, MB_TRUE); if (NS_FAILED(rv)) { - String err("bad name for xsl:variable"); + String err(NS_LITERAL_STRING("bad name for xsl:variable")); aPs->receiveError(err, NS_ERROR_FAILURE); } } @@ -891,7 +890,7 @@ txXSLTProcessor::processAttributeSets(Element* aElement, namespaceID = kNameSpaceID_None; else namespaceID = kNameSpaceID_XSLT; - if (!aElement->getAttr(txXSLTAtoms::useAttributeSets, namespaceID, names) || names.isEmpty()) + if (!aElement->getAttr(txXSLTAtoms::useAttributeSets, namespaceID, names) || names.IsEmpty()) return; // Split names @@ -902,7 +901,7 @@ txXSLTProcessor::processAttributeSets(Element* aElement, txExpandedName name; rv = name.init(nameStr, aElement, MB_FALSE); if (NS_FAILED(rv)) { - String err("missing or malformed name in use-attribute-sets"); + String err(NS_LITERAL_STRING("missing or malformed name in use-attribute-sets")); aPs->receiveError(err); return; } @@ -911,7 +910,7 @@ txXSLTProcessor::processAttributeSets(Element* aElement, txStackIterator attributeSets(aRecursionStack); while (attributeSets.hasNext()) { if (name == *(txExpandedName*)attributeSets.next()) { - String err("circular inclusion detected in use-attribute-sets"); + String err(NS_LITERAL_STRING("circular inclusion detected in use-attribute-sets")); aPs->receiveError(err); return; } @@ -992,7 +991,7 @@ txXSLTProcessor::processDefaultTemplate(ProcessorState* aPs, ExprResult* exprResult = gNodeExpr->evaluate(aPs->getEvalContext()); if (!exprResult || exprResult->getResultType() != ExprResult::NODESET) { - String err("None-nodeset returned while processing default template"); + String err(NS_LITERAL_STRING("None-nodeset returned while processing default template")); aPs->receiveError(err, NS_ERROR_FAILURE); delete exprResult; return; @@ -1041,9 +1040,9 @@ txXSLTProcessor::processInclude(String& aHref, // make sure the include isn't included yet txStackIterator iter(aPs->getEnteredStylesheets()); while (iter.hasNext()) { - if (((String*)iter.next())->isEqual(aHref)) { - String err("Stylesheet includes itself. URI: "); - err.append(aHref); + if (((String*)iter.next())->Equals(aHref)) { + String err(NS_LITERAL_STRING("Stylesheet includes itself. URI: ")); + err.Append(aHref); aPs->receiveError(err, NS_ERROR_FAILURE); return; } @@ -1053,8 +1052,8 @@ txXSLTProcessor::processInclude(String& aHref, // Load XSL document Node* stylesheet = aPs->retrieveDocument(aHref, String()); if (!stylesheet) { - String err("Unable to load included stylesheet "); - err.append(aHref); + String err(NS_LITERAL_STRING("Unable to load included stylesheet ")); + err.Append(aHref); aPs->receiveError(err, NS_ERROR_FAILURE); aPs->getEnteredStylesheets()->pop(); return; @@ -1071,7 +1070,7 @@ txXSLTProcessor::processInclude(String& aHref, break; default: // This should never happen - String err("Unsupported fragment identifier"); + String err(NS_LITERAL_STRING("Unsupported fragment identifier")); aPs->receiveError(err, NS_ERROR_FAILURE); break; } @@ -1129,7 +1128,7 @@ txXSLTProcessor::processParameters(Element* aAction, action->getAttr(txXSLTAtoms::name, kNameSpaceID_None, qName); rv = paramName.init(qName, action, MB_FALSE); if (NS_FAILED(rv)) { - String err("bad name for xsl:param"); + String err(NS_LITERAL_STRING("bad name for xsl:param")); aPs->receiveError(err, NS_ERROR_FAILURE); break; } @@ -1141,9 +1140,9 @@ txXSLTProcessor::processParameters(Element* aAction, rv = aMap->bindVariable(paramName, exprResult, MB_TRUE); if (NS_FAILED(rv)) { - String err("Unable to bind parameter '"); - err.append(qName); - err.append("'"); + String err(NS_LITERAL_STRING("Unable to bind parameter '")); + err.Append(qName); + err.Append(PRUnichar('\'')); aPs->receiveError(err, NS_ERROR_FAILURE); return rv; } @@ -1234,7 +1233,7 @@ txXSLTProcessor::processTemplate(Node* aTemplate, action->getAttr(txXSLTAtoms::name, kNameSpaceID_None, qName); rv = paramName.init(qName, action, MB_FALSE); if (NS_FAILED(rv)) { - String err("bad name for xsl:param"); + String err(NS_LITERAL_STRING("bad name for xsl:param")); aPs->receiveError(err, NS_ERROR_FAILURE); break; } @@ -1251,7 +1250,7 @@ txXSLTProcessor::processTemplate(Node* aTemplate, } if (NS_FAILED(rv)) { - String err("unable to bind xsl:param"); + String err(NS_LITERAL_STRING("unable to bind xsl:param")); aPs->receiveError(err, NS_ERROR_FAILURE); } @@ -1369,16 +1368,16 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, String fName; element->getAttr(txXSLTAtoms::name, kNameSpaceID_None, fName); - String err("unable to add "); - if (fName.isEmpty()) { - err.append("default"); + String err(NS_LITERAL_STRING("unable to add ")); + if (fName.IsEmpty()) { + err.Append(NS_LITERAL_STRING("default")); } else { - err.append("\""); - err.append(fName); - err.append("\""); + err.Append(PRUnichar('\"')); + err.Append(fName); + err.Append(PRUnichar('\"')); } - err.append(" decimal format for xsl:decimal-format"); + err.Append(NS_LITERAL_STRING(" decimal format for xsl:decimal-format")); aPs->receiveError(err, NS_ERROR_FAILURE); } } @@ -1401,18 +1400,18 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, rv = aPs->addGlobalVariable(varName, element, currentFrame, defaultValue); if (NS_FAILED(rv)) { - String err("unable to add global xsl:param"); + String err(NS_LITERAL_STRING("unable to add global xsl:param")); aPs->receiveError(err, NS_ERROR_FAILURE); } } else { - String err("unable to add global xsl:param"); + String err(NS_LITERAL_STRING("unable to add global xsl:param")); aPs->receiveError(err, NS_ERROR_FAILURE); } } // xsl:import else if (localName == txXSLTAtoms::import) { - String err("xsl:import only allowed at top of stylesheet"); + String err(NS_LITERAL_STRING("xsl:import only allowed at top of stylesheet")); aPs->receiveError(err, NS_ERROR_FAILURE); } // xsl:include @@ -1431,9 +1430,9 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, String name; element->getAttr(txXSLTAtoms::name, kNameSpaceID_None, name); - String err("error adding key '"); - err.append(name); - err.append("'"); + String err(NS_LITERAL_STRING("error adding key '")); + err.Append(name); + err.Append(PRUnichar('\'')); aPs->receiveError(err, NS_ERROR_FAILURE); } } @@ -1444,10 +1443,10 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, if (element->getAttr(txXSLTAtoms::method, kNameSpaceID_None, attValue)) { - if (attValue.isEqual("html")) { + if (attValue.getConstNSString().Equals(NS_LITERAL_STRING("html"))) { format.mMethod = eHTMLOutput; } - else if (attValue.isEqual("text")) { + else if (attValue.getConstNSString().Equals(NS_LITERAL_STRING("text"))) { format.mMethod = eTextOutput; } else { @@ -1467,12 +1466,12 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, if (element->getAttr(txXSLTAtoms::omitXmlDeclaration, kNameSpaceID_None, attValue)) { - format.mOmitXMLDeclaration = attValue.isEqual(YES_VALUE) ? eTrue : eFalse; + format.mOmitXMLDeclaration = attValue.Equals(YES_VALUE) ? eTrue : eFalse; } if (element->getAttr(txXSLTAtoms::standalone, kNameSpaceID_None, attValue)) { - format.mStandalone = attValue.isEqual(YES_VALUE) ? eTrue : eFalse; + format.mStandalone = attValue.Equals(YES_VALUE) ? eTrue : eFalse; } if (element->getAttr(txXSLTAtoms::doctypePublic, @@ -1522,7 +1521,7 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, if (element->getAttr(txXSLTAtoms::indent, kNameSpaceID_None, attValue)) { - format.mIndent = attValue.isEqual(YES_VALUE) ? eTrue : eFalse; + format.mIndent = attValue.Equals(YES_VALUE) ? eTrue : eFalse; } if (element->getAttr(txXSLTAtoms::mediaType, kNameSpaceID_None, @@ -1544,12 +1543,12 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, rv = aPs->addGlobalVariable(varName, element, currentFrame, 0); if (NS_FAILED(rv)) { - String err("unable to add global xsl:variable"); + String err(NS_LITERAL_STRING("unable to add global xsl:variable")); aPs->receiveError(err, NS_ERROR_FAILURE); } } else { - String err("unable to add global xsl:variable"); + String err(NS_LITERAL_STRING("unable to add global xsl:variable")); aPs->receiveError(err, NS_ERROR_FAILURE); } } @@ -1559,8 +1558,8 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, if (!element->getAttr(txXSLTAtoms::elements, kNameSpaceID_None, elements)) { //-- add error to ErrorObserver - String err("missing required 'elements' attribute for "); - err.append("xsl:preserve-space"); + String err(NS_LITERAL_STRING("missing required 'elements' attribute for ")); + err.Append(NS_LITERAL_STRING("xsl:preserve-space")); aPs->receiveError(err, NS_ERROR_FAILURE); } else { @@ -1575,8 +1574,8 @@ txXSLTProcessor::processTopLevel(Element* aStylesheet, if (!element->getAttr(txXSLTAtoms::elements, kNameSpaceID_None, elements)) { //-- add error to ErrorObserver - String err("missing required 'elements' attribute for "); - err.append("xsl:strip-space"); + String err(NS_LITERAL_STRING("missing required 'elements' attribute for ")); + err.Append(NS_LITERAL_STRING("xsl:strip-space")); aPs->receiveError(err, NS_ERROR_FAILURE); } else { @@ -1600,7 +1599,7 @@ txXSLTProcessor::processVariable(Element* aVariable, if (aVariable->hasAttr(txXSLTAtoms::select, kNameSpaceID_None)) { Expr* expr = aPs->getExpr(aVariable, ProcessorState::SelectAttr); if (!expr) - return new StringResult("unable to process variable"); + return new StringResult(NS_LITERAL_STRING("unable to process variable")); return expr->evaluate(aPs->getEvalContext()); } if (aVariable->hasChildNodes()) { diff --git a/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp index 596c65a59cf..a6d92b1c5d5 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/DocumentFunctionCall.cpp @@ -77,7 +77,7 @@ ExprResult* DocumentFunctionCall::evaluate(txIEvalContext* aContext) Expr* param2 = (Expr*)iter.next(); ExprResult* exprResult2 = param2->evaluate(aContext); if (exprResult2->getResultType() != ExprResult::NODESET) { - String err("node-set expected as second argument to document(): "); + String err(NS_LITERAL_STRING("node-set expected as second argument to document(): ")); toString(err); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); delete exprResult1; diff --git a/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp index 8c169fdcacd..9db3fe589ed 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/ElementAvailableFnCall.cpp @@ -119,7 +119,7 @@ ExprResult* ElementAvailableFunctionCall::evaluate(txIEvalContext* aContext) } } else { - String err("Invalid argument passed to element-available(), expecting String"); + String err(NS_LITERAL_STRING("Invalid argument passed to element-available(), expecting String")); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); result = new StringResult(err); } diff --git a/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp index 46e604499a8..43fd263ebe1 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/FunctionAvailableFnCall.cpp @@ -118,7 +118,7 @@ ExprResult* FunctionAvailableFunctionCall::evaluate(txIEvalContext* aContext) } } else { - String err("Invalid argument passed to function-available, expecting String"); + String err(NS_LITERAL_STRING("Invalid argument passed to function-available, expecting String")); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); result = new StringResult(err); } diff --git a/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp index a32d4b3f25e..cc7b14a5420 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/GenerateIdFunctionCall.cpp @@ -73,8 +73,7 @@ ExprResult* GenerateIdFunctionCall::evaluate(txIEvalContext* aContext) return 0; if (exprResult->getResultType() != ExprResult::NODESET) { - String err("Invalid argument passed to generate-id(), " - "expecting NodeSet"); + String err(NS_LITERAL_STRING("Invalid argument passed to generate-id(), expecting NodeSet")); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); delete exprResult; return new StringResult(err); @@ -99,7 +98,7 @@ ExprResult* GenerateIdFunctionCall::evaluate(txIEvalContext* aContext) #else PR_snprintf(buf, 21, printfFmt, node); #endif - return new StringResult(buf); + return new StringResult(NS_ConvertASCIItoUCS2(buf)); } nsresult GenerateIdFunctionCall::getNameAtom(txAtom** aAtom) diff --git a/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp index 24cfef6e794..238b1ef8839 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/SystemPropertyFunctionCall.cpp @@ -44,22 +44,22 @@ ExprResult* SystemPropertyFunctionCall::evaluate(txIEvalContext* aContext) result = new NumberResult(1.0); } else if (qname.mLocalName == txXSLTAtoms::vendor) { - result = new StringResult("Transformiix"); + result = new StringResult(NS_LITERAL_STRING("Transformiix")); } else if (qname.mLocalName == txXSLTAtoms::vendorUrl) { - result = new StringResult("http://www.mozilla.org/projects/xslt/"); + result = new StringResult(NS_LITERAL_STRING("http://www.mozilla.org/projects/xslt/")); } } } else { - String err("Invalid argument passed to system-property(), expecting String"); + String err(NS_LITERAL_STRING("Invalid argument passed to system-property(), expecting String")); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); result = new StringResult(err); } } if (!result) { - result = new StringResult(""); + result = new StringResult(); } return result; } diff --git a/mozilla/extensions/transformiix/source/xslt/functions/XSLTFunctions.h b/mozilla/extensions/transformiix/source/xslt/functions/XSLTFunctions.h index 14396dc3ac1..b447c00962b 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/XSLTFunctions.h +++ b/mozilla/extensions/transformiix/source/xslt/functions/XSLTFunctions.h @@ -179,7 +179,7 @@ public: TX_DECL_FUNCTION; private: - static const UNICODE_CHAR FORMAT_QUOTE; + static const PRUnichar FORMAT_QUOTE; enum FormatParseState { Prefix, @@ -209,16 +209,16 @@ public: txDecimalFormat(); MBool isEqual(txDecimalFormat* other); - UNICODE_CHAR mDecimalSeparator; - UNICODE_CHAR mGroupingSeparator; + PRUnichar mDecimalSeparator; + PRUnichar mGroupingSeparator; String mInfinity; - UNICODE_CHAR mMinusSign; + PRUnichar mMinusSign; String mNaN; - UNICODE_CHAR mPercent; - UNICODE_CHAR mPerMille; - UNICODE_CHAR mZeroDigit; - UNICODE_CHAR mDigit; - UNICODE_CHAR mPatternSeparator; + PRUnichar mPercent; + PRUnichar mPerMille; + PRUnichar mZeroDigit; + PRUnichar mDigit; + PRUnichar mPatternSeparator; }; /** diff --git a/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp index be7bd96a228..259f3dbb037 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/txFormatNumberFunctionCall.cpp @@ -49,7 +49,7 @@ #include #endif -const UNICODE_CHAR txFormatNumberFunctionCall::FORMAT_QUOTE = '\''; +const PRUnichar txFormatNumberFunctionCall::FORMAT_QUOTE = '\''; /* * FormatNumberFunctionCall @@ -98,7 +98,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) txDecimalFormat* format = mPs->getDecimalFormat(formatName); if (!format) { - String err("unknown decimal format for: "); + String err(NS_LITERAL_STRING("unknown decimal format for: ")); toString(err); aContext->receiveError(err, NS_ERROR_XPATH_INVALID_ARG); return new StringResult(err); @@ -113,8 +113,8 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) if (value == Double::NEGATIVE_INFINITY) { String res; - res.append(format->mMinusSign); - res.append(format->mInfinity); + res.Append(format->mMinusSign); + res.Append(format->mInfinity); return new StringResult(res); } @@ -128,7 +128,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) int groupSize=-1; PRUint32 pos = 0; - PRUint32 formatLen = formatStr.length(); + PRUint32 formatLen = formatStr.Length(); MBool inQuote; // Get right subexpression @@ -136,15 +136,15 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) if (Double::isNeg(value)) { while (pos < formatLen && (inQuote || - formatStr.charAt(pos) != format->mPatternSeparator)) { - if (formatStr.charAt(pos) == FORMAT_QUOTE) + formatStr.CharAt(pos) != format->mPatternSeparator)) { + if (formatStr.CharAt(pos) == FORMAT_QUOTE) inQuote = !inQuote; pos++; } if (pos == formatLen) { pos = 0; - prefix.append(format->mMinusSign); + prefix.Append(format->mMinusSign); } else pos++; @@ -154,9 +154,9 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) FormatParseState pState = Prefix; inQuote = MB_FALSE; - UNICODE_CHAR c = 0; + PRUnichar c = 0; while (pos < formatLen && pState != Finished) { - c=formatStr.charAt(pos++); + c=formatStr.CharAt(pos++); switch (pState) { @@ -199,9 +199,9 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) if (c == FORMAT_QUOTE) inQuote = !inQuote; else if (pState == Prefix) - prefix.append(c); + prefix.Append(c); else - suffix.append(c); + suffix.Append(c); break; case IntDigit: @@ -321,9 +321,9 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) int i; for (i = 0; i < intDigits; ++i) { if ((intDigits-i)%groupSize == 0 && i != 0) - res.append(format->mGroupingSeparator); + res.Append(format->mGroupingSeparator); - res.append((UNICODE_CHAR)(buf[i] - '0' + format->mZeroDigit)); + res.Append((PRUnichar)(buf[i] - '0' + format->mZeroDigit)); } // Fractions @@ -339,22 +339,22 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) } else { if (printDeci) { - res.append(format->mDecimalSeparator); + res.Append(format->mDecimalSeparator); printDeci = MB_FALSE; } while (extraZeros) { - res.append(format->mZeroDigit); + res.Append(format->mZeroDigit); extraZeros--; } - res.append((UNICODE_CHAR)(buf[i] - '0' + format->mZeroDigit)); + res.Append((PRUnichar)(buf[i] - '0' + format->mZeroDigit)); } } if (!intDigits && printDeci) { // If we havn't added any characters we add a '0' // This can only happen for formats like '##.##' - res.append(format->mZeroDigit); + res.Append(format->mZeroDigit); } delete [] buf; @@ -386,7 +386,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) groupSize = intDigits + 10; //to simplify grouping // XXX We shouldn't use SetLength. - res.getNSString().SetLength(res.length() + + res.getNSString().SetLength(res.Length() + intDigits + // integer digits 1 + // decimal separator maxFractionSize + // fractions @@ -396,7 +396,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) MBool carry = (i+1 < buflen) && (buf[i+1] >= '5'); MBool hasFraction = MB_FALSE; - PRUint32 resPos = res.length()-1; + PRUint32 resPos = res.Length()-1; // Fractions for (; i >= bufIntDigits; --i) { @@ -416,10 +416,10 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) if (hasFraction || digit != 0 || i < bufIntDigits+minFractionSize) { hasFraction = MB_TRUE; res.replace(resPos--, - (UNICODE_CHAR)(digit + format->mZeroDigit)); + (PRUnichar)(digit + format->mZeroDigit)); } else { - res.truncate(resPos--); + res.Truncate(resPos--); } } @@ -428,7 +428,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) res.replace(resPos--, format->mDecimalSeparator); } else { - res.truncate(resPos--); + res.Truncate(resPos--); } // Integer digits @@ -450,20 +450,20 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) res.replace(resPos--, format->mGroupingSeparator); } - res.replace(resPos--, (UNICODE_CHAR)(digit + format->mZeroDigit)); + res.replace(resPos--, (PRUnichar)(digit + format->mZeroDigit)); } if (carry) { if (i%groupSize == 0) { res.insert(resPos + 1, format->mGroupingSeparator); } - res.insert(resPos + 1, (UNICODE_CHAR)(1 + format->mZeroDigit)); + res.insert(resPos + 1, (PRUnichar)(1 + format->mZeroDigit)); } if (!hasFraction && !intDigits && !carry) { // If we havn't added any characters we add a '0' // This can only happen for formats like '##.##' - res.append(format->mZeroDigit); + res.Append(format->mZeroDigit); } delete [] buf; @@ -471,7 +471,7 @@ ExprResult* txFormatNumberFunctionCall::evaluate(txIEvalContext* aContext) #endif // TX_EXE // Build suffix - res.append(suffix); + res.Append(suffix); return new StringResult(res); } //-- evaluate @@ -488,8 +488,8 @@ nsresult txFormatNumberFunctionCall::getNameAtom(txAtom** aAtom) * A representation of the XSLT element */ -txDecimalFormat::txDecimalFormat() : mInfinity("Infinity"), - mNaN("NaN") +txDecimalFormat::txDecimalFormat() : mInfinity(NS_LITERAL_STRING("Infinity")), + mNaN(NS_LITERAL_STRING("NaN")) { mDecimalSeparator = '.'; mGroupingSeparator = ','; @@ -505,9 +505,9 @@ MBool txDecimalFormat::isEqual(txDecimalFormat* other) { return mDecimalSeparator == other->mDecimalSeparator && mGroupingSeparator == other->mGroupingSeparator && - mInfinity.isEqual(other->mInfinity) && + mInfinity.Equals(other->mInfinity) && mMinusSign == other->mMinusSign && - mNaN.isEqual(other->mNaN) && + mNaN.Equals(other->mNaN) && mPercent == other->mPercent && mPerMille == other->mPerMille && mZeroDigit == other->mZeroDigit && diff --git a/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp b/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp index 4bb5e64fee4..374c0f370a1 100644 --- a/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xslt/functions/txKeyFunctionCall.cpp @@ -50,7 +50,7 @@ txKeyFunctionCall::txKeyFunctionCall(ProcessorState* aPs, ExprResult* txKeyFunctionCall::evaluate(txIEvalContext* aContext) { if (!aContext || !requireParams(2, 2, aContext)) - return new StringResult("error"); + return new StringResult(NS_LITERAL_STRING("error")); NodeSet* res = new NodeSet; if (!res) { @@ -71,7 +71,7 @@ ExprResult* txKeyFunctionCall::evaluate(txIEvalContext* aContext) } if (!key) { - String err("No key with that name in: "); + String err(NS_LITERAL_STRING("No key with that name in: ")); toString(err); aContext->receiveError(err, NS_ERROR_INVALID_ARG); return res; @@ -252,7 +252,7 @@ void txXSLKey::testNode(Node* aNode, NamedMap* aMap) if (exprResult->getResultType() == ExprResult::NODESET) { NodeSet* res = (NodeSet*)exprResult; for (int i=0; isize(); i++) { - val.clear(); + val.Truncate(); XMLDOMUtils::getNodeValue(res->get(i), val); nodeSet = (NodeSet*)aMap->get(val); diff --git a/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp b/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp index ad6bb1c07b0..cdba0eeea3e 100644 --- a/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txMozillaXMLOutput.cpp @@ -704,7 +704,7 @@ txMozillaXMLOutput::createResultDocument(const String& aName, PRInt32 aNsID, } // Add a doc-type if requested - if (!mOutputFormat.mSystemId.isEmpty()) { + if (!mOutputFormat.mSystemId.IsEmpty()) { nsCOMPtr implementation; rv = aSourceDocument->GetImplementation(getter_AddRefs(implementation)); NS_ENSURE_SUCCESS(rv, rv); diff --git a/mozilla/extensions/transformiix/source/xslt/txOutputFormat.cpp b/mozilla/extensions/transformiix/source/xslt/txOutputFormat.cpp index 7d87d6624f2..3a3e6cee5d1 100644 --- a/mozilla/extensions/transformiix/source/xslt/txOutputFormat.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txOutputFormat.cpp @@ -56,17 +56,17 @@ txOutputFormat::~txOutputFormat() void txOutputFormat::reset() { mMethod = eMethodNotSet; - mVersion.clear(); - if (mEncoding.isEmpty()) + mVersion.Truncate(); + if (mEncoding.IsEmpty()) mOmitXMLDeclaration = eNotSet; mStandalone = eNotSet; - mPublicId.clear(); - mSystemId.clear(); + mPublicId.Truncate(); + mSystemId.Truncate(); txListIterator iter(&mCDATASectionElements); while (iter.hasNext()) delete (txExpandedName*)iter.next(); mIndent = eNotSet; - mMediaType.clear(); + mMediaType.Truncate(); } void txOutputFormat::merge(txOutputFormat& aOutputFormat) @@ -74,10 +74,10 @@ void txOutputFormat::merge(txOutputFormat& aOutputFormat) if (mMethod == eMethodNotSet) mMethod = aOutputFormat.mMethod; - if (mVersion.isEmpty()) + if (mVersion.IsEmpty()) mVersion = aOutputFormat.mVersion; - if (mEncoding.isEmpty()) + if (mEncoding.IsEmpty()) mEncoding = aOutputFormat.mEncoding; if (mOmitXMLDeclaration == eNotSet) @@ -86,10 +86,10 @@ void txOutputFormat::merge(txOutputFormat& aOutputFormat) if (mStandalone == eNotSet) mStandalone = aOutputFormat.mStandalone; - if (mPublicId.isEmpty()) + if (mPublicId.IsEmpty()) mPublicId = aOutputFormat.mPublicId; - if (mSystemId.isEmpty()) + if (mSystemId.IsEmpty()) mSystemId = aOutputFormat.mSystemId; txListIterator iter(&aOutputFormat.mCDATASectionElements); @@ -103,7 +103,7 @@ void txOutputFormat::merge(txOutputFormat& aOutputFormat) if (mIndent == eNotSet) mIndent = aOutputFormat.mIndent; - if (mMediaType.isEmpty()) + if (mMediaType.IsEmpty()) mMediaType = aOutputFormat.mMediaType; } @@ -117,11 +117,11 @@ void txOutputFormat::setFromDefaults() } case eXMLOutput: { - if (mVersion.isEmpty()) - mVersion.append("1.0"); + if (mVersion.IsEmpty()) + mVersion.Append(NS_LITERAL_STRING("1.0")); - if (mEncoding.isEmpty()) - mEncoding.append("UTF-8"); + if (mEncoding.IsEmpty()) + mEncoding.Append(NS_LITERAL_STRING("UTF-8")); if (mOmitXMLDeclaration == eNotSet) mOmitXMLDeclaration = eFalse; @@ -129,34 +129,34 @@ void txOutputFormat::setFromDefaults() if (mIndent == eNotSet) mIndent = eFalse; - if (mMediaType.isEmpty()) - mMediaType.append("text/xml"); + if (mMediaType.IsEmpty()) + mMediaType.Append(NS_LITERAL_STRING("text/xml")); break; } case eHTMLOutput: { - if (mVersion.isEmpty()) - mVersion.append("4.0"); + if (mVersion.IsEmpty()) + mVersion.Append(NS_LITERAL_STRING("4.0")); - if (mEncoding.isEmpty()) - mEncoding.append("UTF-8"); + if (mEncoding.IsEmpty()) + mEncoding.Append(NS_LITERAL_STRING("UTF-8")); if (mIndent == eNotSet) mIndent = eTrue; - if (mMediaType.isEmpty()) - mMediaType.append("text/html"); + if (mMediaType.IsEmpty()) + mMediaType.Append(NS_LITERAL_STRING("text/html")); break; } case eTextOutput: { - if (mEncoding.isEmpty()) - mEncoding.append("UTF-8"); + if (mEncoding.IsEmpty()) + mEncoding.Append(NS_LITERAL_STRING("UTF-8")); - if (mMediaType.isEmpty()) - mMediaType.append("text/plain"); + if (mMediaType.IsEmpty()) + mMediaType.Append(NS_LITERAL_STRING("text/plain")); break; } diff --git a/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp b/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp index 8b0bc1a2c31..de78c1ed4d2 100644 --- a/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txPatternParser.cpp @@ -285,10 +285,10 @@ nsresult txPatternParser::createStepPattern(ExprLexer& aLexer, MBool isAttr = MB_FALSE; Token* tok = aLexer.peek(); if (tok->type == Token::AXIS_IDENTIFIER) { - if (ATTRIBUTE_AXIS.isEqual(tok->value)) { + if (ATTRIBUTE_AXIS.Equals(tok->value)) { isAttr = MB_TRUE; } - else if (!CHILD_AXIS.isEqual(tok->value)) { + else if (!CHILD_AXIS.Equals(tok->value)) { // all done already for CHILD_AXIS, for all others // XXX report unexpected axis error return NS_ERROR_XPATH_PARSE_FAILED; diff --git a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp index 5fb9a53a0ba..17f9c02fc4a 100644 --- a/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txStandaloneXSLTProcessor.cpp @@ -259,14 +259,14 @@ void txStandaloneXSLTProcessor::getHrefFromStylesheetPI(Document& xmlDocument, while (node) { if (node->getNodeType() == Node::PROCESSING_INSTRUCTION_NODE) { String target = ((ProcessingInstruction*)node)->getTarget(); - if (STYLESHEET_PI.isEqual(target) || - STYLESHEET_PI_OLD.isEqual(target)) { + if (STYLESHEET_PI.Equals(target) || + STYLESHEET_PI_OLD.Equals(target)) { String data = ((ProcessingInstruction*)node)->getData(); - type.clear(); - tmpHref.clear(); + type.Truncate(); + tmpHref.Truncate(); parseStylesheetPI(data, type, tmpHref); - if (XSL_MIME_TYPE.isEqual(type)) { - href.clear(); + if (XSL_MIME_TYPE.Equals(type)) { + href.Truncate(); URIUtils::resolveHref(tmpHref, node->getBaseURI(), href); } } @@ -283,32 +283,32 @@ void txStandaloneXSLTProcessor::parseStylesheetPI(String& data, String& type, String& href) { - PRUint32 size = data.length(); + PRUint32 size = data.Length(); NamedMap bufferMap; - bufferMap.put(String("type"), &type); - bufferMap.put(String("href"), &href); + bufferMap.put(String(NS_LITERAL_STRING("type")), &type); + bufferMap.put(String(NS_LITERAL_STRING("href")), &href); PRUint32 ccount = 0; MBool inLiteral = MB_FALSE; - char matchQuote = '"'; + PRUnichar matchQuote = '"'; String sink; String* buffer = &sink; for (ccount = 0; ccount < size; ccount++) { - char ch = data.charAt(ccount); + PRUnichar ch = data.CharAt(ccount); switch ( ch ) { case ' ': if (inLiteral) { - buffer->append(ch); + buffer->Append(ch); } break; case '=': if (inLiteral) { - buffer->append(ch); + buffer->Append(ch); } - else if (buffer->length() > 0) { + else if (!buffer->IsEmpty()) { buffer = (String*)bufferMap.get(*buffer); if (!buffer) { - sink.clear(); + sink.Truncate(); buffer = &sink; } } @@ -318,11 +318,11 @@ void txStandaloneXSLTProcessor::parseStylesheetPI(String& data, if (inLiteral) { if (matchQuote == ch) { inLiteral = MB_FALSE; - sink.clear(); + sink.Truncate(); buffer = &sink; } else { - buffer->append(ch); + buffer->Append(ch); } } else { @@ -331,7 +331,7 @@ void txStandaloneXSLTProcessor::parseStylesheetPI(String& data, } break; default: - buffer->append(ch); + buffer->Append(ch); break; } } @@ -342,8 +342,8 @@ txStandaloneXSLTProcessor::parsePath(const String& aPath, ErrorObserver& aErr) { ifstream xmlInput(NS_LossyConvertUCS2toASCII(aPath).get(), ios::in); if (!xmlInput) { - String err("Couldn't open "); - err.append(aPath); + String err(NS_LITERAL_STRING("Couldn't open ")); + err.Append(aPath); aErr.receiveError(err); return 0; } @@ -352,8 +352,8 @@ txStandaloneXSLTProcessor::parsePath(const String& aPath, ErrorObserver& aErr) Document* xmlDoc = xmlParser.parse(xmlInput, aPath); xmlInput.close(); if (!xmlDoc) { - String err("Parsing error in "); - err.append(aPath); + String err(NS_LITERAL_STRING("Parsing error in ")); + err.Append(aPath); aErr.receiveError(err); } return xmlDoc; diff --git a/mozilla/extensions/transformiix/source/xslt/txTextHandler.cpp b/mozilla/extensions/transformiix/source/xslt/txTextHandler.cpp index 50c79d812be..a3e0eec7f02 100644 --- a/mozilla/extensions/transformiix/source/xslt/txTextHandler.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txTextHandler.cpp @@ -58,7 +58,7 @@ void txTextHandler::attribute(const String& aName, void txTextHandler::characters(const String& aData) { if (mLevel == 0) - mValue.append(aData); + mValue.Append(aData); } void txTextHandler::comment(const String& aData) diff --git a/mozilla/extensions/transformiix/source/xslt/txUnknownHandler.cpp b/mozilla/extensions/transformiix/source/xslt/txUnknownHandler.cpp index 5c39e126923..5ee8c200638 100644 --- a/mozilla/extensions/transformiix/source/xslt/txUnknownHandler.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txUnknownHandler.cpp @@ -180,7 +180,7 @@ void txUnknownHandler::startElement(const String& aName, rv = createHandlerAndFlush(format->mMethod, aName, aNsID); } else if (aNsID == kNameSpaceID_None && - aName.isEqualIgnoreCase(String("html"))) { + aName.isEqualIgnoreCase(String(NS_LITERAL_STRING("html")))) { rv = createHandlerAndFlush(eHTMLOutput, aName, aNsID); } else { diff --git a/mozilla/extensions/transformiix/source/xslt/txXMLOutput.cpp b/mozilla/extensions/transformiix/source/xslt/txXMLOutput.cpp index cb2f808f0ba..537c19908f8 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXMLOutput.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txXMLOutput.cpp @@ -99,7 +99,7 @@ void txXMLOutput::characters(const String& aData) if (mInCDATASection) { PRUint32 i = 0; PRUint32 j = 0; - PRUint32 length = aData.length(); + PRUint32 length = aData.Length(); *mOut << CDATA_START; @@ -107,12 +107,12 @@ void txXMLOutput::characters(const String& aData) printUTF8Chars(aData); } else { - mBuffer[j++] = aData.charAt(i++); - mBuffer[j++] = aData.charAt(i++); - mBuffer[j++] = aData.charAt(i++); + mBuffer[j++] = aData.CharAt(i++); + mBuffer[j++] = aData.CharAt(i++); + mBuffer[j++] = aData.CharAt(i++); while (i < length) { - mBuffer[j++] = aData.charAt(i++); + mBuffer[j++] = aData.CharAt(i++); if (mBuffer[(j - 1) % 4] == ']' && mBuffer[j % 4] == ']' && mBuffer[(j + 1) % 4] == '>') { @@ -282,9 +282,9 @@ void txXMLOutput::closeStartTag(MBool aUseEmptyElementShorthand) } } -void txXMLOutput::printUTF8Char(DOM_CHAR& ch) +void txXMLOutput::printUTF8Char(PRUnichar& ch) { - // DOM_CHAR is 16-bits so we only need to cover up to 0xFFFF + // PRUnichar is 16-bits so we only need to cover up to 0xFFFF // 0x0000-0x007F if (ch < 128) { @@ -305,11 +305,11 @@ void txXMLOutput::printUTF8Char(DOM_CHAR& ch) void txXMLOutput::printUTF8Chars(const String& aData) { - DOM_CHAR currChar; + PRUnichar currChar; PRUint32 i = 0; - while (i < aData.length()) { - currChar = aData.charAt(i++); + while (i < aData.Length()) { + currChar = aData.CharAt(i++); printUTF8Char(currChar); } } @@ -317,14 +317,14 @@ void txXMLOutput::printUTF8Chars(const String& aData) void txXMLOutput::printWithXMLEntities(const String& aData, MBool aAttribute) { - DOM_CHAR currChar; + PRUnichar currChar; PRUint32 i; if (&aData == &NULL_STRING) return; - for (i = 0; i < aData.length(); i++) { - currChar = aData.charAt(i); + for (i = 0; i < aData.Length(); i++) { + currChar = aData.CharAt(i); switch (currChar) { case AMPERSAND: *mOut << AMP_ENTITY; diff --git a/mozilla/extensions/transformiix/source/xslt/txXMLOutput.h b/mozilla/extensions/transformiix/source/xslt/txXMLOutput.h index ac6f2acafb7..d91c93a512c 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXMLOutput.h +++ b/mozilla/extensions/transformiix/source/xslt/txXMLOutput.h @@ -183,7 +183,7 @@ public: protected: virtual void closeStartTag(MBool aUseEmptyElementShorthand); - void printUTF8Char(DOM_CHAR& ch); + void printUTF8Char(PRUnichar& ch); void printUTF8Chars(const String& aData); void printWithXMLEntities(const String& aData, MBool aAttribute = MB_FALSE); @@ -199,7 +199,7 @@ protected: Stack mCDATASections; private: - DOM_CHAR mBuffer[4]; + PRUnichar mBuffer[4]; }; #endif diff --git a/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.cpp b/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.cpp index 889ca2f4bd4..9acbc52235c 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.cpp @@ -46,7 +46,7 @@ nsresult txXSLTNumber::createNumber(Element* aNumberElement, ProcessorState* aPs, String& aResult) { - aResult.clear(); + aResult.Truncate(); nsresult rv = NS_OK; // Parse format @@ -61,11 +61,11 @@ nsresult txXSLTNumber::createNumber(Element* aNumberElement, rv = getValueList(aNumberElement, aPs, values, valueString); NS_ENSURE_SUCCESS(rv, rv); - if (valueString.length()) { + if (!valueString.IsEmpty()) { // XXX Xalan and XSLT2 says this, but XSLT1 says otherwise aResult = head; - aResult.append(valueString); - aResult.append(tail); + aResult.Append(valueString); + aResult.Append(tail); return NS_OK; } @@ -83,14 +83,14 @@ nsresult txXSLTNumber::createNumber(Element* aNumberElement, } if (!first) { - aResult.append(counter->mSeparator); + aResult.Append(counter->mSeparator); } counter->appendNumber(value, aResult); first = MB_FALSE; } - aResult.append(tail); + aResult.Append(tail); txListIterator iter(&counters); while (iter.hasNext()) { @@ -104,7 +104,7 @@ nsresult txXSLTNumber::getValueList(Element* aNumberElement, ProcessorState* aPs, txList& aValues, String& aValueString) { - aValueString.clear(); + aValueString.Truncate(); // If the value attribute exists then use that if (aNumberElement->hasAttr(txXSLTAtoms::value, kNameSpaceID_None)) { @@ -316,7 +316,7 @@ nsresult txXSLTNumber::getValueList(Element* aNumberElement, } } else { - aPs->receiveError(String("unknown value for format attribute"), + aPs->receiveError(String(NS_LITERAL_STRING("unknown value for format attribute")), NS_ERROR_FAILURE); } @@ -333,8 +333,8 @@ nsresult txXSLTNumber::getCounters(Element* aNumberElement, ProcessorState* aPs, txList& aCounters, String& aHead, String& aTail) { - aHead.clear(); - aTail.clear(); + aHead.Truncate(); + aTail.Truncate(); nsresult rv = NS_OK; @@ -360,25 +360,25 @@ txXSLTNumber::getCounters(Element* aNumberElement, ProcessorState* aPs, formatAVT)) { aPs->processAttrValueTemplate(formatAVT, aNumberElement, format); } - PRUint32 formatLen = format.length(); + PRUint32 formatLen = format.Length(); PRUint32 formatPos = 0; - UNICODE_CHAR ch = 0; + PRUnichar ch = 0; // start with header while (formatPos < formatLen && - !isAlphaNumeric(ch = format.charAt(formatPos))) { - aHead.append(ch); + !isAlphaNumeric(ch = format.CharAt(formatPos))) { + aHead.Append(ch); ++formatPos; } // If there are no formatting tokens we need to create a default one. if (formatPos == formatLen) { txFormattedCounter* defaultCounter; - rv = txFormattedCounter::getCounterFor(String("1"), groupSize, + rv = txFormattedCounter::getCounterFor(String(NS_LITERAL_STRING("1")), groupSize, groupSeparator, defaultCounter); NS_ENSURE_SUCCESS(rv, rv); - defaultCounter->mSeparator = String("."); + defaultCounter->mSeparator = String(NS_LITERAL_STRING(".")); rv = aCounters.add(defaultCounter); if (NS_FAILED(rv)) { // XXX ErrorReport: out of memory @@ -397,12 +397,12 @@ txXSLTNumber::getCounters(Element* aNumberElement, ProcessorState* aPs, // there is only one formatting token and we're formatting a // value-list longer then one we use the default separator. This // won't be used when formatting the first value anyway. - sepToken = String("."); + sepToken = String(NS_LITERAL_STRING(".")); } else { while (formatPos < formatLen && - !isAlphaNumeric(ch = format.charAt(formatPos))) { - sepToken.append(ch); + !isAlphaNumeric(ch = format.CharAt(formatPos))) { + sepToken.Append(ch); ++formatPos; } } @@ -416,8 +416,8 @@ txXSLTNumber::getCounters(Element* aNumberElement, ProcessorState* aPs, // parse formatting token String numToken; while (formatPos < formatLen && - isAlphaNumeric(ch = format.charAt(formatPos))) { - numToken.append(ch); + isAlphaNumeric(ch = format.CharAt(formatPos))) { + numToken.Append(ch); ++formatPos; } @@ -488,7 +488,7 @@ txXSLTNumber::getPrevInDocumentOrder(Node* aNode) #define TX_MATCH_CHAR(ch, a) if (ch < a) return MB_FALSE; \ if (ch == a) return MB_TRUE -MBool txXSLTNumber::isAlphaNumeric(UNICODE_CHAR ch) +MBool txXSLTNumber::isAlphaNumeric(PRUnichar ch) { TX_CHAR_RANGE(ch, 0x0030, 0x0039); TX_CHAR_RANGE(ch, 0x0041, 0x005A); diff --git a/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.h b/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.h index 2cc882c0a3a..3dfe26e1f6a 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.h +++ b/mozilla/extensions/transformiix/source/xslt/txXSLTNumber.h @@ -60,7 +60,7 @@ private: static Node* getPrevInDocumentOrder(Node* aNode); - static MBool isAlphaNumeric(UNICODE_CHAR ch); + static MBool isAlphaNumeric(PRUnichar ch); }; class txFormattedCounter { diff --git a/mozilla/extensions/transformiix/source/xslt/txXSLTNumberCounters.cpp b/mozilla/extensions/transformiix/source/xslt/txXSLTNumberCounters.cpp index 803d178113c..71674ea2684 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXSLTNumberCounters.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txXSLTNumberCounters.cpp @@ -59,14 +59,14 @@ private: class txAlphaCounter : public txFormattedCounter { public: - txAlphaCounter(UNICODE_CHAR aOffset) : mOffset(aOffset) + txAlphaCounter(PRUnichar aOffset) : mOffset(aOffset) { } virtual void appendNumber(PRInt32 aNumber, String& aDest); private: - UNICODE_CHAR mOffset; + PRUnichar mOffset; }; class txRomanCounter : public txFormattedCounter { @@ -87,12 +87,12 @@ txFormattedCounter::getCounterFor(const String& aToken, PRInt32 aGroupSize, const String& aGroupSeparator, txFormattedCounter*& aCounter) { - PRInt32 length = aToken.length(); + PRInt32 length = aToken.Length(); NS_ASSERTION(length, "getting counter for empty token"); aCounter = 0; if (length == 1) { - UNICODE_CHAR ch = aToken.charAt(0); + PRUnichar ch = aToken.CharAt(0); switch (ch) { case 'i': @@ -117,10 +117,10 @@ txFormattedCounter::getCounterFor(const String& aToken, PRInt32 aGroupSize, // for now, the only multi-char token we support are decimals PRInt32 i; for (i = 0; i < length-1; ++i) { - if (aToken.charAt(i) != '0') + if (aToken.CharAt(i) != '0') break; } - if (i == length-1 && aToken.charAt(i) == '1') { + if (i == length-1 && aToken.CharAt(i) == '1') { aCounter = new txDecimalCounter(length, aGroupSize, aGroupSeparator); } else { @@ -144,10 +144,8 @@ txDecimalCounter::txDecimalCounter(PRInt32 aMinLength, PRInt32 aGroupSize, void txDecimalCounter::appendNumber(PRInt32 aNumber, String& aDest) { - String num; - const PRInt32 bufsize = 10; //must be able to fit an PRInt32 - UNICODE_CHAR buf[bufsize]; + PRUnichar buf[bufsize]; PRInt32 pos = bufsize; while (aNumber > 0) { PRInt32 ch = aNumber % 10; @@ -167,26 +165,26 @@ void txDecimalCounter::appendNumber(PRInt32 aNumber, String& aDest) // pos will always be zero PRInt32 extraPos = mMinLength; while (extraPos > bufsize) { - aDest.append('0'); + aDest.Append(PRUnichar('0')); --extraPos; if (extraPos % mGroupSize == 0) { - aDest.append(mGroupSeparator); + aDest.Append(mGroupSeparator); } } // copy string to buffer if (mGroupSize >= bufsize - pos) { // no grouping will occur - aDest.append(buf + pos, (PRUint32)(bufsize - pos)); + aDest.Append(buf + pos, (PRUint32)(bufsize - pos)); } else { // append chars up to first grouping separator PRInt32 len = ((bufsize - pos - 1) % mGroupSize) + 1; - aDest.append(buf + pos, len); + aDest.Append(buf + pos, len); pos += len; while (bufsize - pos > 0) { - aDest.append(mGroupSeparator); - aDest.append(buf + pos, mGroupSize); + aDest.Append(mGroupSeparator); + aDest.Append(buf + pos, mGroupSize); pos += mGroupSize; } NS_ASSERTION(bufsize == pos, "error while grouping"); @@ -196,9 +194,7 @@ void txDecimalCounter::appendNumber(PRInt32 aNumber, String& aDest) void txAlphaCounter::appendNumber(PRInt32 aNumber, String& aDest) { - String num; - - UNICODE_CHAR buf[11]; + PRUnichar buf[11]; buf[11] = 0; PRInt32 pos = 11; while (aNumber > 0) { @@ -208,7 +204,7 @@ void txAlphaCounter::appendNumber(PRInt32 aNumber, String& aDest) buf[--pos] = ch + mOffset; } - aDest.append(buf + pos, (PRUint32)(11 - pos)); + aDest.Append(buf + pos, (PRUint32)(11 - pos)); } @@ -229,7 +225,7 @@ void txRomanCounter::appendNumber(PRInt32 aNumber, String& aDest) } while (aNumber >= 1000) { - aDest.append(!mTableOffset ? 'm' : 'M'); + aDest.Append(!mTableOffset ? PRUnichar('m') : PRUnichar('M')); aNumber -= 1000; } @@ -238,14 +234,14 @@ void txRomanCounter::appendNumber(PRInt32 aNumber, String& aDest) // Hundreds posValue = aNumber / 100; aNumber %= 100; - aDest.append(NS_ConvertASCIItoUCS2(kTxRomanNumbers[posValue + + aDest.Append(NS_ConvertASCIItoUCS2(kTxRomanNumbers[posValue + mTableOffset])); // Tens posValue = aNumber / 10; aNumber %= 10; - aDest.append(NS_ConvertASCIItoUCS2(kTxRomanNumbers[10 + posValue + + aDest.Append(NS_ConvertASCIItoUCS2(kTxRomanNumbers[10 + posValue + mTableOffset])); // Ones - aDest.append(NS_ConvertASCIItoUCS2(kTxRomanNumbers[20 + aNumber + + aDest.Append(NS_ConvertASCIItoUCS2(kTxRomanNumbers[20 + aNumber + mTableOffset])); } diff --git a/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp b/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp index eaff365e772..b0a7b279fd6 100644 --- a/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp +++ b/mozilla/extensions/transformiix/source/xslt/txXSLTPatterns.cpp @@ -138,17 +138,17 @@ nsresult txUnionPattern::getSimplePatterns(txList& aList) void txUnionPattern::toString(String& aDest) { #ifdef DEBUG - aDest.append("txUnionPattern{"); + aDest.Append(NS_LITERAL_STRING("txUnionPattern{")); #endif txListIterator iter(&mLocPathPatterns); if (iter.hasNext()) ((txPattern*)iter.next())->toString(aDest); while (iter.hasNext()) { - aDest.append(" | "); + aDest.Append(NS_LITERAL_STRING(" | ")); ((txPattern*)iter.next())->toString(aDest); } #ifdef DEBUG - aDest.append("}"); + aDest.Append(PRUnichar('}')); #endif } // toString @@ -259,7 +259,7 @@ void txLocPathPattern::toString(String& aDest) { txListIterator iter(&mSteps); #ifdef DEBUG - aDest.append("txLocPathPattern{"); + aDest.Append(NS_LITERAL_STRING("txLocPathPattern{")); #endif Step* step; step = (Step*)iter.next(); @@ -268,13 +268,13 @@ void txLocPathPattern::toString(String& aDest) } while ((step = (Step*)iter.next())) { if (step->isChild) - aDest.append("/"); + aDest.Append(PRUnichar('/')); else - aDest.append("//"); + aDest.Append(NS_LITERAL_STRING("//")); step->pattern->toString(aDest); } #ifdef DEBUG - aDest.append("}"); + aDest.Append(PRUnichar('}')); #endif } // txLocPathPattern::toString @@ -301,12 +301,12 @@ double txRootPattern::getDefaultPriority() void txRootPattern::toString(String& aDest) { #ifdef DEBUG - aDest.append("txRootPattern{"); + aDest.Append(NS_LITERAL_STRING("txRootPattern{")); #endif if (mSerialize) - aDest.append("/"); + aDest.Append(PRUnichar('/')); #ifdef DEBUG - aDest.append("}"); + aDest.Append(PRUnichar('}')); #endif } @@ -406,17 +406,17 @@ double txIdPattern::getDefaultPriority() void txIdPattern::toString(String& aDest) { #ifdef DEBUG - aDest.append("txIdPattern{"); + aDest.Append(NS_LITERAL_STRING("txIdPattern{")); #endif - aDest.append("id('"); + aDest.Append(NS_LITERAL_STRING("id('")); #ifdef TX_EXE - aDest.append(mIds); + aDest.Append(mIds); #else aDest.getNSString().Append(mIds); #endif - aDest.append("')"); + aDest.Append(NS_LITERAL_STRING("')")); #ifdef DEBUG - aDest.append("}"); + aDest.Append(PRUnichar('}')); #endif } @@ -456,22 +456,22 @@ double txKeyPattern::getDefaultPriority() void txKeyPattern::toString(String& aDest) { #ifdef DEBUG - aDest.append("txKeyPattern{"); + aDest.Append(NS_LITERAL_STRING("txKeyPattern{")); #endif - aDest.append("key('"); + aDest.Append(NS_LITERAL_STRING("key('")); String tmp; if (mPrefix) { TX_GET_ATOM_STRING(mPrefix, tmp); - aDest.append(tmp); - aDest.append(':'); + aDest.Append(tmp); + aDest.Append(PRUnichar(':')); } TX_GET_ATOM_STRING(mName.mLocalName, tmp); - aDest.append(tmp); - aDest.append(", "); - aDest.append(mValue); - aDest.append("')"); + aDest.Append(tmp); + aDest.Append(NS_LITERAL_STRING(", ")); + aDest.Append(mValue); + aDest.Append(NS_LITERAL_STRING("')")); #ifdef DEBUG - aDest.append("}"); + aDest.Append(PRUnichar('}')); #endif } @@ -606,15 +606,15 @@ double txStepPattern::getDefaultPriority() void txStepPattern::toString(String& aDest) { #ifdef DEBUG - aDest.append("txStepPattern{"); + aDest.Append(NS_LITERAL_STRING("txStepPattern{")); #endif if (mIsAttr) - aDest.append("@"); + aDest.Append(PRUnichar('@')); if (mNodeTest) mNodeTest->toString(aDest); PredicateList::toString(aDest); #ifdef DEBUG - aDest.append("}"); + aDest.Append(PRUnichar('}')); #endif } diff --git a/mozilla/extensions/transformiix/source/xslt/util/txNodeSorter.cpp b/mozilla/extensions/transformiix/source/xslt/util/txNodeSorter.cpp index c6b1d0882cc..87a82baf8a1 100644 --- a/mozilla/extensions/transformiix/source/xslt/util/txNodeSorter.cpp +++ b/mozilla/extensions/transformiix/source/xslt/util/txNodeSorter.cpp @@ -49,7 +49,7 @@ * Sorts Nodes as specified by the W3C XSLT 1.0 Recommendation */ -#define DEFAULT_LANG "en" +#define DEFAULT_LANG NS_LITERAL_STRING("en") txNodeSorter::txNodeSorter(ProcessorState* aPs) : mPs(aPs), mNKeys(0), @@ -99,10 +99,10 @@ MBool txNodeSorter::addSortElement(Element* aSortElement) // Order MBool ascending; MBool hasAttr = getAttrAsAVT(aSortElement, txXSLTAtoms::order, attrValue); - if (!hasAttr || attrValue.isEqual(ASCENDING_VALUE)) { + if (!hasAttr || attrValue.Equals(ASCENDING_VALUE)) { ascending = MB_TRUE; } - else if (attrValue.isEqual(DESCENDING_VALUE)) { + else if (attrValue.Equals(DESCENDING_VALUE)) { ascending = MB_FALSE; } else { @@ -115,21 +115,21 @@ MBool txNodeSorter::addSortElement(Element* aSortElement) // Create comparator depending on datatype String dataType; hasAttr = getAttrAsAVT(aSortElement, txXSLTAtoms::dataType, dataType); - if (!hasAttr || dataType.isEqual(TEXT_VALUE)) { + if (!hasAttr || dataType.Equals(TEXT_VALUE)) { // Text comparator // Language String lang; if (!getAttrAsAVT(aSortElement, txXSLTAtoms::lang, lang)) - lang.append(DEFAULT_LANG); + lang.Append(DEFAULT_LANG); // Case-order MBool upperFirst; hasAttr = getAttrAsAVT(aSortElement, txXSLTAtoms::caseOrder, attrValue); - if (!hasAttr || attrValue.isEqual(UPPER_FIRST_VALUE)) { + if (!hasAttr || attrValue.Equals(UPPER_FIRST_VALUE)) { upperFirst = MB_TRUE; } - else if (attrValue.isEqual(LOWER_FIRST_VALUE)) { + else if (attrValue.Equals(LOWER_FIRST_VALUE)) { upperFirst = MB_FALSE; } else { @@ -142,7 +142,7 @@ MBool txNodeSorter::addSortElement(Element* aSortElement) upperFirst, lang); } - else if (dataType.isEqual(NUMBER_VALUE)) { + else if (dataType.Equals(NUMBER_VALUE)) { // Number comparator key->mComparator = new txResultNumberComparator(ascending); } @@ -267,7 +267,7 @@ MBool txNodeSorter::getAttrAsAVT(Element* aSortElement, txAtom* aAttrName, String& aResult) { - aResult.clear(); + aResult.Truncate(); String attValue; if (!aSortElement->getAttr(aAttrName, kNameSpaceID_None, attValue)) diff --git a/mozilla/extensions/transformiix/source/xslt/util/txXPathResultComparator.cpp b/mozilla/extensions/transformiix/source/xslt/util/txXPathResultComparator.cpp index 0b74256a2d8..2c44756da65 100644 --- a/mozilla/extensions/transformiix/source/xslt/util/txXPathResultComparator.cpp +++ b/mozilla/extensions/transformiix/source/xslt/util/txXPathResultComparator.cpp @@ -144,14 +144,14 @@ int txResultStringComparator::compareValues(TxObject* aVal1, TxObject* aVal2) StringValue* strval1 = (StringValue*)aVal1; StringValue* strval2 = (StringValue*)aVal2; #ifdef TX_EXE - PRUint32 len1 = strval1->mStr.length(); - PRUint32 len2 = strval2->mStr.length(); + PRUint32 len1 = strval1->mStr.Length(); + PRUint32 len2 = strval2->mStr.Length(); PRUint32 minLength = (len1 < len2) ? len1 : len2; PRUint32 c = 0; while (c < minLength) { - UNICODE_CHAR ch1 = strval1->mStr.charAt(c); - UNICODE_CHAR ch2 = strval2->mStr.charAt(c); + PRUnichar ch1 = strval1->mStr.CharAt(c); + PRUnichar ch2 = strval2->mStr.CharAt(c); if (ch1 < ch2) return ((mSorting & kAscending) ? 1 : -1) * -1; if (ch2 < ch1)