Closed Bug 191856 Opened 23 years ago Closed 23 years ago

txExpandedName::init, XMLUtils::isValidQName string do

Categories

(Core :: XSLT, defect)

defect
Not set
normal

Tracking

()

VERIFIED FIXED
mozilla1.4alpha

People

(Reporter: axel, Assigned: axel)

Details

Attachments

(2 files)

txExpandedName::init should share code with isValidQName to iterate over the string only once, and cheap.
Status: NEW → ASSIGNED
a mere charsink didn't do it, as I need the iterator for colon and copy_string drops the information which fragment I'm in. Everything else is pretty simple
Attachment #113520 - Flags: superreview?(peterv)
Attachment #113520 - Flags: review?(bugmail)
Comment on attachment 113520 [details] [diff] [review] fix string code for parsing QNames in XMLUtils >+/** >+ * Helper class for checkin and partioning of QNames Checking >+ */ >+class txQNameParser >+{ >+public: >+ enum QResult { >+ eBrokenName, >+ eOneName, >+ eTwoNames}; Closing brace on its own line please. >+ QResult parse(const nsAString::const_iterator& aStart, >+ const nsAString::const_iterator& aEnd); >+ >+ enum { >+ eInitial, >+ ePrefixNC, >+ eColon, >+ eNameNC, >+ eBroken} mState; Closing brace on its own line please. >+ nsAString::const_iterator mColon; >+}; >+ >+txQNameParser::QResult >+txQNameParser::parse(const nsAString::const_iterator& aStart, >+ const nsAString::const_iterator& aEnd) >+{ >+ nsAString::const_iterator chunk(aStart); >+ mState = eInitial; >+ >+ PRUint32 size, i; Don't you have to initialize size to 0? >+ for ( ; chunk != aEnd; chunk.advance(size)) { >+ const PRUnichar* buf = chunk.get(); >+ size = chunk.size_forward(); >+ >+ // fragment at 'buf' is 'size' characters long >+ for (i=0; i<size; i++) { Add spaces around operators and use ++i Looks good but I still need to review the parsing itself.
If you correct those I'll sr this.
Attachment #113520 - Flags: superreview?(peterv)
Attachment #113520 - Flags: review?(bugmail)
Attachment #113798 - Flags: superreview?(peterv)
Attachment #113798 - Flags: review?(bugmail)
Comment on attachment 113798 [details] [diff] [review] fix comments by peterv I prefer cases in a switch and one-line if's to have braces too but that's just personal preference. Up to you.
Attachment #113798 - Flags: superreview?(peterv) → superreview+
did the ifs, but not the cases. I insert braces into cases if I have local vars which this patch does not. nah, don't be consistent.
Comment on attachment 113798 [details] [diff] [review] fix comments by peterv nit: mState along with its enum could be private. You might want to add an empty |case eBroken:| or |default:| to the switch, i think some compiler warns when you're switching on an enum but don't show all cases. r=sicking
Attachment #113798 - Flags: review?(bugmail) → review+
Target Milestone: --- → mozilla1.4alpha
checked in
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
mass verifying
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: