Potential fix for array bounds warning.
BUG=skia:2123
R=caryclark@google.com
Author: jvanverth@google.com
Review URL: https://codereview.chromium.org/164753003
git-svn-id: http://skia.googlecode.com/svn/trunk@13531 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pathops/SkDCubicToQuads.cpp b/src/pathops/SkDCubicToQuads.cpp
index 3cf63f3..705320d 100644
--- a/src/pathops/SkDCubicToQuads.cpp
+++ b/src/pathops/SkDCubicToQuads.cpp
@@ -136,17 +136,16 @@
memmove(inflectT, &inflectT[1], sizeof(inflectT[0]) * --inflections);
}
int start = 0;
- do {
- int next = start + 1;
- if (next >= inflections) {
- break;
- }
+ int next = 1;
+ while (next < inflections) {
if (!approximately_equal(inflectT[start], inflectT[next])) {
++start;
+ ++next;
continue;
}
memmove(&inflectT[start], &inflectT[next], sizeof(inflectT[0]) * (--inflections - start));
- } while (true);
+ }
+
while (inflections && approximately_greater_than_one(inflectT[inflections - 1])) {
--inflections;
}