dst = Substring(dst, 0, len);
dst = Substring(src, 0, len);
static PRUint32 DecodeArrayDimensions(const nsAString& src, PRInt32* aDimensionSizes, nsAString & dst){  dst.Assign(src);  nsReadingIterator < PRUnichar > i1;  nsReadingIterator < PRUnichar > i2;  src.BeginReading(i1);  src.EndReading(i2);  if (src.IsEmpty()) return 0;  while (i1 != i2      //  Loop past white space    && *(--i2) <= ' ') //  In XML, all valid characters <= space are the only whitespace    ;  if (*i2 != ']') {                  //  In this case, not an array dimension    PRInt32 len = Distance(i1, i2) - 1;  //  This is the size to truncate to at the end.    dst = Substring(src, 0, len);              //  Truncate the string.    return 0;                       //  Eliminated white space.  }  PRInt32 dimensionCount = 1;    //  Counting the dimensions  for (;;) {        //  First look for the matching bracket from reverse and commas.    if (i1 == i2) {                  //  No matching bracket.      return 0;    }    PRUnichar c = *(--i2);    if (c == '[') {                  //  Matching bracket found!      break;    }    if (c == ',') {      dimensionCount++;    }  }  PRInt32 len;  {    nsReadingIterator < PRUnichar > i3 = i2++;  //  Cover any extra white space    while (i1 != i3) {      //  Loop past white space      if (*(--i3) > ' ') { //  In XML, all valid characters <= space are the only whitespace        i3++;        break;      }    }    len = Distance(i1, i3);        //  Length remaining in string after operation  }  if (dimensionCount > MAX_ARRAY_DIMENSIONS) {  //  Completely ignore it if too many dimensions.    return 0;  }  i1 = i2;  src.EndReading(i2);  while (*(--i2) != ']')           //  Find end bracket again    ;  dimensionCount = 0;                           //  Start with first dimension.  aDimensionSizes[dimensionCount] = -1;  PRBool finished = PR_FALSE;      //  Disallow space within numbers  while (i1 != i2) {    PRUnichar c = *(i1++);    if (c < '0' || c > '9') {//  There may be slightly more to do here if alternative radixes are supported.      if (c <= ' ') {              //  In XML, all valid characters <= space are the only whitespace        if (aDimensionSizes[dimensionCount] >= 0) {          finished = PR_TRUE;        }      }      else if (c == ',') {         //  Introducing new dimension        aDimensionSizes[++dimensionCount] = -1;             //  Restarting it at -1        finished = PR_FALSE;      }      else        return 0;                 //  Unrecognized character    } else {      if (finished) {        return 0;                 //  Numbers not allowed after white space      }      if (aDimensionSizes[dimensionCount] == -1)        aDimensionSizes[dimensionCount] = 0;      if (aDimensionSizes[dimensionCount] < 214748364) {        aDimensionSizes[dimensionCount] = aDimensionSizes[dimensionCount] * 10 + c - '0';      }      else {        return 0;                 //  Number got too big.      }    }  }  dst = Substring(dst, 0, len);              //  Truncate the string.  return dimensionCount + 1;                    //  Return the number of dimensions}