Bug 574750: Use size_t for counter, in loops over contents of an nsCSSValue::Array. r=bz; a1.9.2.6=LegNeato
authorDaniel Holbert <dholbert@cs.stanford.edu>
Fri, 25 Jun 2010 12:38:57 -0700
changeset 34385 f2a4c8e82d16b20f380e65e90f6b924ba846507d
parent 34384 1fcff072ea163044f085200140e58ec29b21a634
child 34386 e4bf0cdd829ef577472bb7be1c340eef31ff7775
push id1431
push usereakhgari@mozilla.com
push dateFri, 25 Jun 2010 21:10:38 +0000
reviewersbz
bugs574750
milestone1.9.2.6pre
Bug 574750: Use size_t for counter, in loops over contents of an nsCSSValue::Array. r=bz; a1.9.2.6=LegNeato
layout/base/nsPresContext.cpp
layout/style/nsCSSDeclaration.cpp
layout/style/nsCSSRules.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -1701,19 +1701,19 @@ InsertFontFaceRule(nsCSSFontFaceRule *aR
 
   // set up src array
   nsTArray<gfxFontFaceSrc> srcArray;
 
   aRule->GetDesc(eCSSFontDesc_Src, val);
   unit = val.GetUnit();
   if (unit == eCSSUnit_Array) {
     nsCSSValue::Array *srcArr = val.GetArrayValue();
-    size_t i, numSrc = srcArr->Count();
+    size_t numSrc = srcArr->Count();
     
-    for (i = 0; i < numSrc; i++) {
+    for (size_t i = 0; i < numSrc; i++) {
       val = srcArr->Item(i);
       unit = val.GetUnit();
       gfxFontFaceSrc *face = srcArray.AppendElements(1);
       if (!face)
         return;
             
       switch (unit) {
        
--- a/layout/style/nsCSSDeclaration.cpp
+++ b/layout/style/nsCSSDeclaration.cpp
@@ -256,17 +256,17 @@ nsCSSDeclaration::AppendCSSValueToString
     switch (unit) {
       case eCSSUnit_Counter:  aResult.AppendLiteral("counter(");  break;
       case eCSSUnit_Counters: aResult.AppendLiteral("counters("); break;
       default: break;
     }
 
     nsCSSValue::Array *array = aValue.GetArrayValue();
     PRBool mark = PR_FALSE;
-    for (PRUint16 i = 0, i_end = array->Count(); i < i_end; ++i) {
+    for (size_t i = 0, i_end = array->Count(); i < i_end; ++i) {
       if (aProperty == eCSSProperty_border_image && i >= 5) {
         if (array->Item(i).GetUnit() == eCSSUnit_Null) {
           continue;
         }
         if (i == 5) {
           aResult.AppendLiteral(" /");
         }
       }
@@ -292,17 +292,17 @@ nsCSSDeclaration::AppendCSSValueToString
     const nsCSSValue::Array* array = aValue.GetArrayValue();
     NS_ASSERTION(array->Count() >= 1, "Functions must have at least one element for the name.");
 
     /* Append the function name. */
     AppendCSSValueToString(aProperty, array->Item(0), aResult);
     aResult.AppendLiteral("(");
 
     /* Now, step through the function contents, writing each of them as we go. */
-    for (PRUint16 index = 1; index < array->Count(); ++index) {
+    for (size_t index = 1; index < array->Count(); ++index) {
       AppendCSSValueToString(aProperty, array->Item(index), aResult);
 
       /* If we're not at the final element, append a comma. */
       if (index + 1 != array->Count())
         aResult.AppendLiteral(", ");
     }
 
     /* Finally, append the closing parenthesis. */
--- a/layout/style/nsCSSRules.cpp
+++ b/layout/style/nsCSSRules.cpp
@@ -1488,17 +1488,17 @@ CSSNameSpaceRuleImpl::GetParentRule(nsID
 // annotating URLs with formats, but we handle the general case.)
 static void
 AppendSerializedFontSrc(const nsCSSValue& src, nsAString & aResult NS_OUTPARAM)
 {
   NS_PRECONDITION(src.GetUnit() == eCSSUnit_Array,
                   "improper value unit for src:");
 
   const nsCSSValue::Array& sources = *src.GetArrayValue();
-  PRUint32 i = 0;
+  size_t i = 0;
 
   while (i < sources.Count()) {
     nsAutoString formats;
 
     if (sources[i].GetUnit() == eCSSUnit_URL) {
       aResult.AppendLiteral("url(");
       nsDependentString url(sources[i].GetOriginalURLValue());
       nsStyleUtil::AppendEscapedCSSString(url, aResult);