Closed Bug 705584 Opened 14 years ago Closed 12 years ago

Improve/increase use of nsCharSeparatedTokenizerTemplate in nsSMILParserUtils

Categories

(Core :: SVG, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla26

People

(Reporter: dholbert, Assigned: longsonr)

References

()

Details

Attachments

(1 file, 1 obsolete file)

I was just looking through nsSMILParserUtils, and I noticed a few things about its tokenizing: (1) nsSMILParserUtils::ParseValuesGeneric uses nsCharSeparatedTokenizer, when it should be using nsCharSeparatedTokenizerTemplate<IsSVGWhitespace> instead. (2) At first glance, it looks like nsSMILParserUtils::ParseSemicolonDelimitedProgressList does ad-hoc tokenizing, and it could benefit from using nsCharSeparatedTokenizerTemplate. (or if it can't for some reason, we should add a comment saying why it can't)
OS: Linux → All
Hardware: x86 → All
Summary: Improve/increase use of nsCharSeparatedTokenizer in nsSMILParserUtils → Improve/increase use of nsCharSeparatedTokenizerTemplate in nsSMILParserUtils
Attached patch token.txt (obsolete) — Splinter Review
Assignee: nobody → longsonr
Attachment #798267 - Flags: review?(dholbert)
Thanks for picking this up! > nsresult > nsSMILParserUtils::ParseSemicolonDelimitedProgressList(const nsAString& aSpec, > bool aNonDecreasing, > nsTArray<double>& aArray) > { > nsresult rv = NS_OK; This variable is now unused, after your patch, and it triggers a FAIL_ON_WARNINGS compile failure on my machine. (It should trigger a build error on MSVC, too, if you build with ac_add_options --enable-warnings-as-errors, which you proably want to add to your mozconfig if it's not there already.) So: remove that variable. More coming later; this is all I've got from my "does it build" and quick-skim sanity-check. :)
Attachment #798267 - Attachment is obsolete: true
Attachment #798267 - Flags: review?(dholbert)
Attachment #798444 - Flags: review?(dholbert)
Comment on attachment 798444 [details] [diff] [review] address review comment >diff --git a/content/smil/nsSMILParserUtils.cpp b/content/smil/nsSMILParserUtils.cpp > nsSMILParserUtils::ParseSemicolonDelimitedProgressList(const nsAString& aSpec, > bool aNonDecreasing, > nsTArray<double>& aArray) > { [...] >+ while (tokenizer.hasMoreTokens()) { >+ NS_ConvertUTF16toUTF8 utf8Token(tokenizer.nextToken()); >+ const char *token = utf8Token.get(); >+ if (*token == '\0') { >+ return NS_ERROR_FAILURE; >+ } Add a comment, for readability, like we have at http://mxr.mozilla.org/mozilla-central/source/content/svg/content/src/nsSVGIntegerPair.cpp#41 e.g. // empty string (e.g. two ';' in a row), (At first, I read this as checking whether we'd hit the end of the source-string; I didn't immediately know that each utf8Token was null-terminated. A comment clears this up and makes the check clearer.) r=me with that. Thanks!
Attachment #798444 - Flags: review?(dholbert) → review+
Status: NEW → ASSIGNED
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla26
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: