Closed
Bug 282672
Opened 20 years ago
Closed 20 years ago
nsSchemaValidator::IsValidSchemaFloat needs fixed
Categories
(Core Graveyard :: Web Services, defect)
Core Graveyard
Web Services
Tracking
(Not tracked)
RESOLVED
FIXED
People
(Reporter: jwatt, Assigned: jwatt)
References
()
Details
Attachments
(1 file, 1 obsolete file)
1.35 KB,
patch
|
Details | Diff | Splinter Review |
As noted by bz, PR_snprintf is locale-sensitive. After converting from a string
to a float and back to a string, the resulting string may contain a different
decimal separator from the original. Also the comparison should be
if(strcmp()!=0) and not if(strcmp()==0).
![]() |
Assignee | |
Comment 1•20 years ago
|
||
Any reason(s) why we can't just do this?
Comment 2•20 years ago
|
||
Actually, my new code (being reviewed) does do this :) But its a good idea to
fix the existing code.
Comment 3•20 years ago
|
||
Comment on attachment 174654 [details] [diff] [review]
perhaps this?
I'll check it in when I get into work (no need for sr, this is
nont-built-by-default code :)
Attachment #174654 -
Flags: review+
![]() |
Assignee | |
Comment 4•20 years ago
|
||
I can check in my own patches -- unless you have a really strong preference for
doing it yourself. ;-)
I presume you noticed that this patch will allow leading and trailing whitespace
around the value. Also, it seems to me that the way things are currently done
should return false for numbers with more decimal digits than can be stored in a
float.
Where is the code that's being reviewed BTW?
![]() |
Assignee | |
Comment 5•20 years ago
|
||
(In reply to comment #4)
> I can check in my own patches
Although I should point out that it was bz that suggested that ToFloat could be
used.
![]() |
||
Comment 6•20 years ago
|
||
Is there a reason that patch is still converting the string to UTF8?
![]() |
Assignee | |
Comment 7•20 years ago
|
||
Hmm, no, good point. But why isn't ToFloat in nsAString?
![]() |
||
Comment 8•20 years ago
|
||
Because it was only implemented for nsString/nsCString.... But you could use an
nsAutoString here.
Comment 9•20 years ago
|
||
bug 223097 has the new, nsAutoString using version of the code. Actually, it
seems I never got around to changing Float to using what you are, thought I had.
![]() |
Assignee | |
Comment 10•20 years ago
|
||
Good point. Here's a new patch.
Attachment #174654 -
Attachment is obsolete: true
![]() |
Assignee | |
Comment 11•20 years ago
|
||
doron: I notice that you took out the "#ifdef DEBUG" code from your new patch.
Do you want that here too?
Comment 12•20 years ago
|
||
no need
![]() |
Assignee | |
Comment 13•20 years ago
|
||
Marking FIXED.
Checking in mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp;
/cvsroot/mozilla/extensions/schema-validation/src/nsSchemaValidator.cpp,v <--
nsSchemaValidator.cpp
new revision: 1.9; previous revision: 1.8
done
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Updated•7 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•