tokenizer_fixOldUses: use parameter instead of template to choose SeparatorChar
authorDaniel Holbert <dholbert@cs.stanford.edu>
Sun, 02 May 2010 22:37:16 -0700
changeset 1549 d7586d01c70260b1a48876a0a399f9c7d89a5b49
parent 1548 dbdedad4ba92918b6bc50dc593d576134da757d9
child 1550 b830b28b1f12270efc5393672f249decbd76f717
push id1249
push userdholbert@mozilla.com
push dateMon, 03 May 2010 05:42:33 +0000
tokenizer_fixOldUses: use parameter instead of template to choose SeparatorChar
tokenizer_fixOldUses
--- a/tokenizer_fixOldUses
+++ b/tokenizer_fixOldUses
@@ -9,17 +9,17 @@ diff --git a/content/html/content/src/ns
    if (NS_FAILED(rv))
      // Parameter not found or whatever
      return CANPLAY_MAYBE;
  
    CanPlayStatus result = CANPLAY_YES;
    // See http://www.rfc-editor.org/rfc/rfc4281.txt for the description
    // of the 'codecs' parameter
 -  nsCommaSeparatedTokenizer tokenizer(codecs);
-+  nsCharSeparatedTokenizer<','> tokenizer(codecs, PR_TRUE);
++  nsCharSeparatedTokenizer tokenizer(codecs, ',', PR_TRUE);
    PRBool expectMoreTokens = PR_FALSE;
    while (tokenizer.hasMoreTokens()) {
      const nsSubstring& token = tokenizer.nextToken();
  
      if (!CodecListContains(supportedCodecs, token)) {
        // Totally unsupported codec
        return CANPLAY_NO;
      }
@@ -31,22 +31,22 @@ diff --git a/content/svg/content/src/nsS
  
  /*static*/ PRBool
  nsSVGFeatures::MatchesLanguagePreferences(const nsSubstring& aAttribute,
                                            const nsSubstring& aAcceptLangs) 
  {
    const nsDefaultStringComparator defaultComparator;
  
 -  nsCommaSeparatedTokenizer attributeTokenizer(aAttribute);
-+  nsCharSeparatedTokenizer<','> attributeTokenizer(aAttribute, PR_TRUE);
++  nsCharSeparatedTokenizer attributeTokenizer(aAttribute, ',', PR_TRUE);
  
    while (attributeTokenizer.hasMoreTokens()) {
      const nsSubstring &attributeToken = attributeTokenizer.nextToken();
 -    nsCommaSeparatedTokenizer languageTokenizer(aAcceptLangs);
-+    nsCharSeparatedTokenizer<','> languageTokenizer(aAcceptLangs, PR_TRUE);
++    nsCharSeparatedTokenizer languageTokenizer(aAcceptLangs, ',', PR_TRUE);
      while (languageTokenizer.hasMoreTokens()) {
        if (nsStyleUtil::DashMatchCompare(attributeToken,
                                          languageTokenizer.nextToken(),
                                          defaultComparator)) {
          return PR_TRUE;
        }
      }
    }
@@ -55,48 +55,48 @@ diff --git a/content/svg/content/src/nsS
  
  /*static*/ PRInt32
  nsSVGFeatures::GetBestLanguagePreferenceRank(const nsSubstring& aAttribute,
                                               const nsSubstring& aAcceptLangs) 
  {
    const nsDefaultStringComparator defaultComparator;
  
 -  nsCommaSeparatedTokenizer attributeTokenizer(aAttribute);
-+  nsCharSeparatedTokenizer<','> attributeTokenizer(aAttribute, PR_TRUE);
++  nsCharSeparatedTokenizer attributeTokenizer(aAttribute, ',', PR_TRUE);
    PRInt32 lowestRank = -1;
  
    while (attributeTokenizer.hasMoreTokens()) {
      const nsSubstring &attributeToken = attributeTokenizer.nextToken();
 -    nsCommaSeparatedTokenizer languageTokenizer(aAcceptLangs);
-+    nsCharSeparatedTokenizer<','> languageTokenizer(aAcceptLangs, PR_TRUE);
++    nsCharSeparatedTokenizer languageTokenizer(aAcceptLangs, ',', PR_TRUE);
      PRInt32 index = 0;
      while (languageTokenizer.hasMoreTokens()) {
        const nsSubstring &languageToken = languageTokenizer.nextToken();
        PRBool exactMatch = (languageToken == attributeToken);
        PRBool prefixOnlyMatch =
          !exactMatch &&
          nsStyleUtil::DashMatchCompare(attributeToken,
                                        languageTokenizer.nextToken(),
 diff --git a/xpcom/ds/nsCharSeparatedTokenizer.h b/xpcom/ds/nsCharSeparatedTokenizer.h
 --- a/xpcom/ds/nsCharSeparatedTokenizer.h
 +++ b/xpcom/ds/nsCharSeparatedTokenizer.h
-@@ -149,24 +149,16 @@ private:
+@@ -151,24 +151,16 @@ private:
      PRBool isWhitespace(PRUnichar aChar)
      {
          return aChar <= ' ' &&
                 (aChar == ' ' || aChar == '\n' ||
                  aChar == '\r'|| aChar == '\t');
      }
  };
  
--class nsCommaSeparatedTokenizer : public nsCharSeparatedTokenizer<','>
+-class nsCommaSeparatedTokenizer : public nsCharSeparatedTokenizer
 -{
 -public:
 -    nsCommaSeparatedTokenizer(const nsSubstring& aSource)
--        : nsCharSeparatedTokenizer<','>(aSource, PR_TRUE) {}
+-        : nsCharSeparatedTokenizer(aSource, ',', PR_TRUE) {}
 -};
 -
 -
  class nsCCommaSeparatedTokenizer
  {
  public:
      nsCCommaSeparatedTokenizer(const nsCSubstring& aSource)
      {