diff --git a/src/utils/SkFloatToDecimal.cpp b/src/utils/SkFloatToDecimal.cpp
index ead72de..4bfcdad 100644
--- a/src/utils/SkFloatToDecimal.cpp
+++ b/src/utils/SkFloatToDecimal.cpp
@@ -58,16 +58,16 @@
     }
 }
 
-/** Write a string into result, includeing a terminating '\0' (for
-    unit testing).  Return strlen(result) (for SkWStream::write) The
+/** Write a string into output, including a terminating '\0' (for
+    unit testing).  Return strlen(output) (for SkWStream::write) The
     resulting string will be in the form /[-]?([0-9]*.)?[0-9]+/ and
-    sscanf(result, "%f", &x) will return the original value iff the
+    sscanf(output, "%f", &x) will return the original value iff the
     value is finite. This function accepts all possible input values.
 
     Motivation: "PDF does not support [numbers] in exponential format
     (such as 6.02e23)."  Otherwise, this function would rely on a
     sprintf-type function from the standard library. */
-unsigned SkFloatToDecimal(float value, char result[kMaximumSkFloatToDecimalLength]) {
+unsigned SkFloatToDecimal(float value, char output[kMaximumSkFloatToDecimalLength]) {
     /* The longest result is -FLT_MIN.
        We serialize it as "-.0000000000000000000000000000000000000117549435"
        which has 48 characters plus a terminating '\0'. */
@@ -87,13 +87,13 @@
        Experimentally, rasterizers such as pdfium do seem to benefit
        from this.  Rasterizers that rely on fixed-point scalars should
        gracefully ignore these values that they can not parse. */
-    char* output = &result[0];
-    const char* const end = &result[kMaximumSkFloatToDecimalLength - 1];
+    char* output_ptr = &output[0];
+    const char* const end = &output[kMaximumSkFloatToDecimalLength - 1];
     // subtract one to leave space for '\0'.
 
     /* This function is written to accept any possible input value,
        including non-finite values such as INF and NAN.  In that case,
-       we ignore value-correctness and and output a syntacticly-valid
+       we ignore value-correctness and output a syntacticly-valid
        number. */
     if (value == INFINITY) {
         value = FLT_MAX;  // nearest finite float.
@@ -104,12 +104,12 @@
     if (!std::isfinite(value) || value == 0.0f) {
         // NAN is unsupported in PDF.  Always output a valid number.
         // Also catch zero here, as a special case.
-        *output++ = '0';
-        *output = '\0';
-        return static_cast<unsigned>(output - result);
+        *output_ptr++ = '0';
+        *output_ptr = '\0';
+        return static_cast<unsigned>(output_ptr - output);
     }
     if (value < 0.0) {
-        *output++ = '-';
+        *output_ptr++ = '-';
         value = -value;
     }
     SkASSERT(value >= 0.0f);
@@ -148,37 +148,37 @@
     if (decimalShift >= 0) {
         do {
             --bufferIndex;
-            *output++ = '0' + buffer[bufferIndex];
+            *output_ptr++ = '0' + buffer[bufferIndex];
         } while (bufferIndex);
         for (int i = 0; i < decimalShift; ++i) {
-            *output++ = '0';
+            *output_ptr++ = '0';
         }
     } else {
         int placesBeforeDecimal = bufferIndex + decimalShift;
         if (placesBeforeDecimal > 0) {
             while (placesBeforeDecimal-- > 0) {
                 --bufferIndex;
-                *output++ = '0' + buffer[bufferIndex];
+                *output_ptr++ = '0' + buffer[bufferIndex];
             }
-            *output++ = '.';
+            *output_ptr++ = '.';
         } else {
-            *output++ = '.';
+            *output_ptr++ = '.';
             int placesAfterDecimal = -placesBeforeDecimal;
             while (placesAfterDecimal-- > 0) {
-                *output++ = '0';
+                *output_ptr++ = '0';
             }
         }
         while (bufferIndex > 0) {
             --bufferIndex;
-            *output++ = '0' + buffer[bufferIndex];
-            if (output == end) {
+            *output_ptr++ = '0' + buffer[bufferIndex];
+            if (output_ptr == end) {
                 break;  // denormalized: don't need extra precision.
                 // Note: denormalized numbers will not have the same number of
                 // significantDigits, but do not need them to round-trip.
             }
         }
     }
-    SkASSERT(output <= end);
-    *output = '\0';
-    return static_cast<unsigned>(output - result);
+    SkASSERT(output_ptr <= end);
+    *output_ptr = '\0';
+    return static_cast<unsigned>(output_ptr - output);
 }
