RESOLVED FIXED 12022
typo in SVGTransformable.cpp introduce in r18440
https://bugs.webkit.org/show_bug.cgi?id=12022
Summary typo in SVGTransformable.cpp introduce in r18440
Geoffrey Garen
Reported 2006-12-28 17:46:38 PST
18440 rwlbuis if (!(end - currTransform) > 5) should be if (!((end - currTransform) > 5)) instead. Also, why so much ! > instead of <= or just < (x + 1)?
Attachments
First attempt (4.91 KB, patch)
2006-12-29 04:07 PST, Rob Buis
sam: review+
Geoffrey Garen
Comment 1 2006-12-28 17:47:31 PST
Eric Seidel suggested moving much of the code into inline functions, which would have prevented this kind of error.
Eric Seidel (no email)
Comment 2 2006-12-28 18:09:04 PST
One way to do this would be to replace the current check system with this inline: static inline bool checkString(const UChar*& currTransform, const UChar*& end, const UChar* name, int length) { if ((end - currTransform) < length) return false; if (!memcmp(name, currTransform, sizeof(UChar) * length)) return false; currTransform += length; } which would be called like this: if (checkString(currTransform, end, {'s','c','a','l','e'}, 5)) { required = 1; optional = 1; type = SVGTransform::SVG_TRANSFORM_SCALE; } else if ()... I'm not sure that's the most elegant system, but it does at least make the code smaller and less error-prone.
Rob Buis
Comment 3 2006-12-29 04:07:43 PST
Created attachment 12101 [details] First attempt I like the suggestion, IMHO this code is cleaner. Cheers, Rob.
Sam Weinig
Comment 4 2006-12-29 07:17:18 PST
This looks like a good change but instead of doing + } else if (checkString(currTransform, end, skewYDesc, 5)) { perhaps doing something like + } else if (checkString(currTransform, end, skewYDesc, sizeof(skewYDesc) / sizeof(UChar))) { could prevent error?
Sam Weinig
Comment 5 2006-12-29 13:13:05 PST
Comment on attachment 12101 [details] First attempt r+ if you make the changes above.
Rob Buis
Comment 6 2006-12-29 13:16:36 PST
Landed in r18479.
Note You need to log in before you can comment on or make changes to this bug.