tokenizer_useInSVGAndSMIL: use parameter instead of template to choose SeparatorChar
authorDaniel Holbert <dholbert@cs.stanford.edu>
Sun, 02 May 2010 22:42:29 -0700
changeset 1550 b830b28b1f12270efc5393672f249decbd76f717
parent 1549 d7586d01c70260b1a48876a0a399f9c7d89a5b49
child 1551 c2571d7665212f2aab6fc500a7b3fbeccf7119e4
push id1249
push userdholbert@mozilla.com
push dateMon, 03 May 2010 05:42:33 +0000
tokenizer_useInSVGAndSMIL: use parameter instead of template to choose SeparatorChar
tokenizer_useInSVGAndSMIL
--- a/tokenizer_useInSVGAndSMIL
+++ b/tokenizer_useInSVGAndSMIL
@@ -62,17 +62,17 @@ diff --git a/content/smil/nsSMILParserUt
 -    while (substrEnd != start && NS_IS_SPACE(*(substrEnd-1)))
 -      --substrEnd;
 -
 -    rv = aParser.Parse(Substring(start, substrEnd));
 -    if (NS_FAILED(rv))
 -      break;
 -
 -    start = next;
-+  nsCharSeparatedTokenizer<';'> tokenizer(aSpec, PR_TRUE);
++  nsCharSeparatedTokenizer tokenizer(aSpec, ';', PR_TRUE);
 +  if (!tokenizer.hasMoreTokens()) { // Empty list
 +    return NS_ERROR_FAILURE;
    }
  
 -  return rv;
 +  while (tokenizer.hasMoreTokens()) {
 +    nsresult rv = aParser.Parse(tokenizer.nextToken());
 +    if (NS_FAILED(rv)) {
@@ -261,17 +261,17 @@ diff --git a/content/svg/content/src/SVG
    ParseCoordinatePair(const nsAString& aCoordPairStr,
                        float& aXVal, float& aYVal)
  {
 -  nsSVGLength2 xLength, yLength;
 -  
 -  char* str = ToNewCString(aCoordPairStr);
 -  char* rest = str;
 -  PRBool success = PR_FALSE;
-+  nsCharSeparatedTokenizer<','> tokenizer(aCoordPairStr, PR_FALSE);
++  nsCharSeparatedTokenizer tokenizer(aCoordPairStr, ',', PR_FALSE);
 +  nsSVGLength2 x, y;
 +  nsresult rv;
  
 -  if (ParseOneCoordinate(&rest, xLength) &&
 -      ParseOneCoordinate(&rest, yLength)) {
 +  if (!tokenizer.hasMoreTokens()) { // No 1st token
 +    return PR_FALSE;
 +  }
@@ -369,17 +369,17 @@ diff --git a/content/svg/content/src/nsS
  
  //----------------------------------------------------------------------
  // nsISVGValue methods:
  
  NS_IMETHODIMP
  nsSVGPointList::SetValueString(const nsAString& aValue)
  {
 -  nsresult rv = NS_OK;
-+  nsCharSeparatedTokenizer<','> tokenizer(aValue, PR_FALSE);
++  nsCharSeparatedTokenizer tokenizer(aValue, ',', PR_FALSE);
 +  nsCOMArray<nsIDOMSVGPoint> points;
  
 -  char* str = ToNewCString(aValue);
 -  
 -  char* rest = str;
 -  char* token1;
 -  char* token2;
 -  nsCOMArray<nsIDOMSVGPoint> points;
@@ -502,17 +502,17 @@ diff --git a/content/svg/content/src/nsS
 -  nsresult rv = NS_OK;
 -
 -  char *str = ToNewUTF8String(aStr);
 -
 -  char *rest = str;
 -  char *token;
 -
 -  float vals[4];
-+  nsCharSeparatedTokenizer<','> tokenizer(aStr, PR_FALSE);
++  nsCharSeparatedTokenizer tokenizer(aStr, ',', PR_FALSE);
 +  float vals[NUM_VIEWBOX_COMPONENTS];
    PRUint32 i;
 -  for (i = 0; i < 4; ++i) {
 -    if (!(token = nsCRT::strtok(rest, SVG_COMMA_WSP_DELIM, &rest)))
 -      break; // parse error
 +  for (i = 0; i < NUM_VIEWBOX_COMPONENTS && tokenizer.hasMoreTokens(); ++i) {
 +    NS_ConvertUTF16toUTF8 utf8Token(tokenizer.nextToken());
 +    const char *token = utf8Token.get();