Bug 1374580 (part 1) - Remove nsASingleFragment{,C}String typedefs. r=froydnj.

All the instances are converted as follows.

- nsASingleFragmentString  --> nsAString
- nsASingleFragmentCString --> nsACString

--HG--
extra : rebase_source : e6a1ddc8938fecd9a735b15e872c054edf4c7910
This commit is contained in:
Nicholas Nethercote 2017-06-20 19:18:17 +10:00
parent 2072b6b9f1
commit 1572f96f5d
18 changed files with 56 additions and 59 deletions

View File

@ -1437,9 +1437,9 @@ nsXMLContentSerializer::AppendToStringConvertLF(const nsAString& aStr,
bool
nsXMLContentSerializer::AppendFormatedWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
const nsASingleFragmentString::const_char_iterator aSequenceStart,
nsAString::const_char_iterator &aPos,
const nsAString::const_char_iterator aEnd,
const nsAString::const_char_iterator aSequenceStart,
bool &aMayIgnoreStartOfLineWhitespaceSequence,
nsAString &aOutputStr)
{
@ -1515,9 +1515,9 @@ nsXMLContentSerializer::AppendFormatedWrapped_WhitespaceSequence(
bool
nsXMLContentSerializer::AppendWrapped_NonWhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
const nsASingleFragmentString::const_char_iterator aSequenceStart,
nsAString::const_char_iterator &aPos,
const nsAString::const_char_iterator aEnd,
const nsAString::const_char_iterator aSequenceStart,
bool &aMayIgnoreStartOfLineWhitespaceSequence,
bool &aSequenceStartAfterAWhiteSpace,
nsAString& aOutputStr)
@ -1680,14 +1680,14 @@ nsXMLContentSerializer::AppendWrapped_NonWhitespaceSequence(
}
bool
nsXMLContentSerializer::AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
nsXMLContentSerializer::AppendToStringFormatedWrapped(const nsAString& aStr,
nsAString& aOutputStr)
{
if (mBodyOnly && !mInBody) {
return true;
}
nsASingleFragmentString::const_char_iterator pos, end, sequenceStart;
nsAString::const_char_iterator pos, end, sequenceStart;
aStr.BeginReading(pos);
aStr.EndReading(end);
@ -1729,9 +1729,9 @@ nsXMLContentSerializer::AppendToStringFormatedWrapped(const nsASingleFragmentStr
bool
nsXMLContentSerializer::AppendWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
const nsASingleFragmentString::const_char_iterator aSequenceStart,
nsAString::const_char_iterator &aPos,
const nsAString::const_char_iterator aEnd,
const nsAString::const_char_iterator aSequenceStart,
nsAString &aOutputStr)
{
// Handle the complete sequence of whitespace.
@ -1741,7 +1741,7 @@ nsXMLContentSerializer::AppendWrapped_WhitespaceSequence(
mIsIndentationAddedOnCurrentLine = false;
bool leaveLoop = false;
nsASingleFragmentString::const_char_iterator lastPos = aPos;
nsAString::const_char_iterator lastPos = aPos;
do {
switch (*aPos) {
@ -1783,14 +1783,14 @@ nsXMLContentSerializer::AppendWrapped_WhitespaceSequence(
}
bool
nsXMLContentSerializer::AppendToStringWrapped(const nsASingleFragmentString& aStr,
nsXMLContentSerializer::AppendToStringWrapped(const nsAString& aStr,
nsAString& aOutputStr)
{
if (mBodyOnly && !mInBody) {
return true;
}
nsASingleFragmentString::const_char_iterator pos, end, sequenceStart;
nsAString::const_char_iterator pos, end, sequenceStart;
aStr.BeginReading(pos);
aStr.EndReading(end);

View File

@ -113,7 +113,7 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* It updates the column position.
*/
MOZ_MUST_USE
bool AppendToStringWrapped(const nsASingleFragmentString& aStr,
bool AppendToStringWrapped(const nsAString& aStr,
nsAString& aOutputStr);
/**
@ -121,32 +121,32 @@ class nsXMLContentSerializer : public nsIContentSerializer {
* It updates the column position.
*/
MOZ_MUST_USE
bool AppendToStringFormatedWrapped(const nsASingleFragmentString& aStr,
bool AppendToStringFormatedWrapped(const nsAString& aStr,
nsAString& aOutputStr);
// used by AppendToStringWrapped
MOZ_MUST_USE
bool AppendWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
const nsASingleFragmentString::const_char_iterator aSequenceStart,
nsAString::const_char_iterator &aPos,
const nsAString::const_char_iterator aEnd,
const nsAString::const_char_iterator aSequenceStart,
nsAString &aOutputStr);
// used by AppendToStringFormatedWrapped
MOZ_MUST_USE
bool AppendFormatedWrapped_WhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
const nsASingleFragmentString::const_char_iterator aSequenceStart,
nsAString::const_char_iterator &aPos,
const nsAString::const_char_iterator aEnd,
const nsAString::const_char_iterator aSequenceStart,
bool &aMayIgnoreStartOfLineWhitespaceSequence,
nsAString &aOutputStr);
// used by AppendToStringWrapped and AppendToStringFormatedWrapped
MOZ_MUST_USE
bool AppendWrapped_NonWhitespaceSequence(
nsASingleFragmentString::const_char_iterator &aPos,
const nsASingleFragmentString::const_char_iterator aEnd,
const nsASingleFragmentString::const_char_iterator aSequenceStart,
nsAString::const_char_iterator &aPos,
const nsAString::const_char_iterator aEnd,
const nsAString::const_char_iterator aSequenceStart,
bool &aMayIgnoreStartOfLineWhitespaceSequence,
bool &aSequenceStartAfterAWhiteSpace,
nsAString &aOutputStr);

View File

@ -89,7 +89,7 @@ nsresult
nsXBLContentSink::FlushText(bool aReleaseTextNode)
{
if (mTextLength != 0) {
const nsASingleFragmentString& text = Substring(mText, mText+mTextLength);
const nsAString& text = Substring(mText, mText+mTextLength);
if (mState == eXBL_InHandlers) {
NS_ASSERTION(mBinding, "Must have binding here");
// Get the text and add it to the event handler.

View File

@ -17,7 +17,7 @@ typedef nsCaseInsensitiveStringComparator txCaseInsensitiveStringComparator;
* Check equality between a string and an atom containing ASCII.
*/
inline bool
TX_StringEqualsAtom(const nsASingleFragmentString& aString, nsIAtom* aAtom)
TX_StringEqualsAtom(const nsAString& aString, nsIAtom* aAtom)
{
return aAtom->Equals(aString);
}

View File

@ -92,7 +92,7 @@ txExprLexer::nextIsOperatorToken(Token* aToken)
* Parses the given string into a sequence of Tokens
*/
nsresult
txExprLexer::parse(const nsASingleFragmentString& aPattern)
txExprLexer::parse(const nsAString& aPattern)
{
iterator start, end;
start = aPattern.BeginReading(mPosition);

View File

@ -88,7 +88,7 @@ public:
/**
* Constructors
*/
typedef nsASingleFragmentString::const_char_iterator iterator;
typedef nsAString::const_char_iterator iterator;
Token(iterator aStart, iterator aEnd, Type aType)
: mStart(aStart),
@ -136,9 +136,9 @@ public:
* generated Tokens point to Substrings of it.
* mPosition points to the offending location in case of an error.
*/
nsresult parse(const nsASingleFragmentString& aPattern);
nsresult parse(const nsAString& aPattern);
typedef nsASingleFragmentString::const_char_iterator iterator;
typedef nsAString::const_char_iterator iterator;
iterator mPosition;
/**

View File

@ -155,7 +155,7 @@ txExprParser::createExprInternal(const nsSubstring& aExpression,
txExprLexer lexer;
nsresult rv = lexer.parse(aExpression);
if (NS_FAILED(rv)) {
nsASingleFragmentString::const_char_iterator start;
nsAString::const_char_iterator start;
aExpression.BeginReading(start);
aContext->SetErrorOffset(lexer.mPosition - start + aSubStringPos);
return rv;
@ -166,7 +166,7 @@ txExprParser::createExprInternal(const nsSubstring& aExpression,
rv = NS_ERROR_XPATH_BINARY_EXPECTED;
}
if (NS_FAILED(rv)) {
nsASingleFragmentString::const_char_iterator start;
nsAString::const_char_iterator start;
aExpression.BeginReading(start);
aContext->SetErrorOffset(lexer.peek()->mStart - start + aSubStringPos);

View File

@ -1012,7 +1012,7 @@ txFnStartStripSpace(int32_t aNamespaceID,
nsAutoPtr<txStripSpaceItem> stripItem(new txStripSpaceItem);
nsWhitespaceTokenizer tokenizer(attr->mValue);
while (tokenizer.hasMoreTokens()) {
const nsASingleFragmentString& name = tokenizer.nextToken();
const nsAString& name = tokenizer.nextToken();
int32_t ns = kNameSpaceID_None;
nsCOMPtr<nsIAtom> prefix, localName;
rv = XMLUtils::splitQName(name, getter_AddRefs(prefix),

View File

@ -355,8 +355,7 @@ inCSSValueSearch::SearchStyleValue(const nsAFlatString& aValue, nsIURI* aBaseURL
{
if (StringBeginsWith(aValue, NS_LITERAL_STRING("url(")) &&
StringEndsWith(aValue, NS_LITERAL_STRING(")"))) {
const nsASingleFragmentString &url =
Substring(aValue, 4, aValue.Length() - 5);
const nsAString& url = Substring(aValue, 4, aValue.Length() - 5);
// XXXldb Need to do more with |mReturnRelativeURLs|, perhaps?
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), url, nullptr, aBaseURL);

View File

@ -260,7 +260,7 @@ nsSegmentEncoder::EncodeSegmentCount(const char *str,
}
const nsACString &nsStandardURL::
nsSegmentEncoder::EncodeSegment(const nsASingleFragmentCString &str,
nsSegmentEncoder::EncodeSegment(const nsACString& str,
int16_t mask,
nsAFlatCString &result)
{

View File

@ -137,7 +137,7 @@ public: /* internal -- HPUX compiler can't handle this being private */
// Encode the given string if necessary, and return a reference to
// the encoded string. Returns a reference to |buf| if encoding
// is required. Otherwise, a reference to |str| is returned.
const nsACString &EncodeSegment(const nsASingleFragmentCString &str,
const nsACString& EncodeSegment(const nsACString& str,
int16_t mask,
nsAFlatCString &buf);
private:

View File

@ -3023,7 +3023,7 @@ nsCookieService::ImportCookies(nsIFile *aCookieFile)
nsAutoCString buffer, baseDomain;
bool isMore = true;
int32_t hostIndex, isDomainIndex, pathIndex, secureIndex, expiresIndex, nameIndex, cookieIndex;
nsASingleFragmentCString::char_iterator iter;
nsACString::char_iterator iter;
int32_t numInts;
int64_t expires;
bool isDomain, isHttpOnly = false;
@ -3099,7 +3099,7 @@ nsCookieService::ImportCookies(nsIFile *aCookieFile)
}
isDomain = Substring(buffer, isDomainIndex, pathIndex - isDomainIndex - 1).EqualsLiteral(kTrue);
const nsASingleFragmentCString &host = Substring(buffer, hostIndex, isDomainIndex - hostIndex - 1);
const nsACString& host = Substring(buffer, hostIndex, isDomainIndex - hostIndex - 1);
// check for bad legacy cookies (domain not starting with a dot, or containing a port),
// and discard
if ((isDomain && !host.IsEmpty() && host.First() != '.') ||
@ -3866,13 +3866,13 @@ static inline bool istokenseparator (char c) { return isvalueseparator(c) || c =
// Parse a single token/value pair.
// Returns true if a cookie terminator is found, so caller can parse new cookie.
bool
nsCookieService::GetTokenValue(nsASingleFragmentCString::const_char_iterator &aIter,
nsASingleFragmentCString::const_char_iterator &aEndIter,
nsCookieService::GetTokenValue(nsACString::const_char_iterator &aIter,
nsACString::const_char_iterator &aEndIter,
nsDependentCSubstring &aTokenString,
nsDependentCSubstring &aTokenValue,
bool &aEqualsFound)
{
nsASingleFragmentCString::const_char_iterator start, lastSpace;
nsACString::const_char_iterator start, lastSpace;
// initialize value string to clear garbage
aTokenValue.Rebind(aIter, aIter);
@ -3941,8 +3941,8 @@ nsCookieService::ParseAttributes(nsDependentCString &aCookieHeader,
static const char kSecure[] = "secure";
static const char kHttpOnly[] = "httponly";
nsASingleFragmentCString::const_char_iterator tempBegin, tempEnd;
nsASingleFragmentCString::const_char_iterator cookieStart, cookieEnd;
nsACString::const_char_iterator tempBegin, tempEnd;
nsACString::const_char_iterator cookieStart, cookieEnd;
aCookieHeader.BeginReading(cookieStart);
aCookieHeader.EndReading(cookieEnd);

View File

@ -302,7 +302,7 @@ class nsCookieService final : public nsICookieService
void RemoveCookieFromList(const nsListIter &aIter, mozIStorageBindingParamsArray *aParamsArray = nullptr);
void AddCookieToList(const nsCookieKey& aKey, nsCookie *aCookie, DBState *aDBState, mozIStorageBindingParamsArray *aParamsArray, bool aWriteToDB = true);
void UpdateCookieInList(nsCookie *aCookie, int64_t aLastAccessed, mozIStorageBindingParamsArray *aParamsArray);
static bool GetTokenValue(nsASingleFragmentCString::const_char_iterator &aIter, nsASingleFragmentCString::const_char_iterator &aEndIter, nsDependentCSubstring &aTokenString, nsDependentCSubstring &aTokenValue, bool &aEqualsFound);
static bool GetTokenValue(nsACString::const_char_iterator &aIter, nsACString::const_char_iterator &aEndIter, nsDependentCSubstring &aTokenString, nsDependentCSubstring &aTokenValue, bool &aEqualsFound);
static bool ParseAttributes(nsDependentCString &aCookieHeader, nsCookieAttributes &aCookie);
bool RequireThirdPartyCheck();
CookieStatus CheckPrefs(nsIURI *aHostURI, bool aIsForeign, const char *aCookieHeader);

View File

@ -228,11 +228,11 @@ nsCertOverrideService::Read(const MutexAutoLock& aProofOfLock)
continue;
}
const nsASingleFragmentCString &tmp = Substring(buffer, hostIndex, algoIndex - hostIndex - 1);
const nsASingleFragmentCString &algo_string = Substring(buffer, algoIndex, fingerprintIndex - algoIndex - 1);
const nsASingleFragmentCString &fingerprint = Substring(buffer, fingerprintIndex, overrideBitsIndex - fingerprintIndex - 1);
const nsASingleFragmentCString &bits_string = Substring(buffer, overrideBitsIndex, dbKeyIndex - overrideBitsIndex - 1);
const nsASingleFragmentCString &db_key = Substring(buffer, dbKeyIndex, buffer.Length() - dbKeyIndex);
const nsACString& tmp = Substring(buffer, hostIndex, algoIndex - hostIndex - 1);
const nsACString& algo_string = Substring(buffer, algoIndex, fingerprintIndex - algoIndex - 1);
const nsACString& fingerprint = Substring(buffer, fingerprintIndex, overrideBitsIndex - fingerprintIndex - 1);
const nsACString& bits_string = Substring(buffer, overrideBitsIndex, dbKeyIndex - overrideBitsIndex - 1);
const nsACString& db_key = Substring(buffer, dbKeyIndex, buffer.Length() - dbKeyIndex);
nsAutoCString host(tmp);
nsCertOverride::OverrideBits bits;

View File

@ -323,8 +323,8 @@ UTF8InputStream::Fill(nsresult* aErrorCode)
ConvertUTF8toUTF16 converter(mUnicharData.Elements());
nsASingleFragmentCString::const_char_iterator start = mByteData.Elements();
nsASingleFragmentCString::const_char_iterator end = mByteData.Elements() + srcLen;
nsACString::const_char_iterator start = mByteData.Elements();
nsACString::const_char_iterator end = mByteData.Elements() + srcLen;
copy_string(start, end, converter);
if (converter.Length() != dstLen) {

View File

@ -1292,8 +1292,8 @@ NullCString()
}
int32_t
CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
const nsASingleFragmentString& aUTF16String)
CompareUTF8toUTF16(const nsACString& aUTF8String,
const nsAString& aUTF16String)
{
static const uint32_t NOT_ASCII = uint32_t(~0x7F);

View File

@ -414,8 +414,8 @@ const nsAFlatCString& NullCString();
* error (eg the strings are not valid UTF8 and UTF16 respectively),
* this method will return INT32_MIN.
*/
int32_t CompareUTF8toUTF16(const nsASingleFragmentCString& aUTF8String,
const nsASingleFragmentString& aUTF16String);
int32_t CompareUTF8toUTF16(const nsACString& aUTF8String,
const nsAString& aUTF16String);
void AppendUCS4ToUTF16(const uint32_t aSource, nsAString& aDest);

View File

@ -64,10 +64,8 @@ typedef nsAString nsSubstring;
typedef nsACString nsCSubstring;
typedef nsString nsAFlatString;
typedef nsSubstring nsASingleFragmentString;
typedef nsCString nsAFlatCString;
typedef nsCSubstring nsASingleFragmentCString;
#endif /* !defined(nsStringFwd_h___) */