Closed
Bug 397850
Opened 17 years ago
Closed 17 years ago
Make NS_ReadLine() not lie about having more data when the stream ends in \r\n
Categories
(Core :: Networking, defect, P3)
Tracking
()
RESOLVED
FIXED
mozilla1.9beta3
People
(Reporter: MatsPalmgren_bugz, Assigned: MatsPalmgren_bugz)
Details
(Keywords: perf)
Attachments
(3 files, 1 obsolete file)
8.15 KB,
patch
|
Biesinger
:
review+
Biesinger
:
superreview+
|
Details | Diff | Splinter Review |
38.88 KB,
patch
|
Details | Diff | Splinter Review | |
3.08 KB,
patch
|
Biesinger
:
review+
Biesinger
:
superreview+
|
Details | Diff | Splinter Review |
Make NS_ReadLine() not lie about having more data when the stream ends in \r\n.
Follow up from bug 397768 comment 8.
Patch coming up...
Assignee | ||
Comment 1•17 years ago
|
||
This is hopefully easier to understand than the old code. I removed
"aBuffer->empty" and replaced it with "aBuffer->start == aBuffer->end" as
the empty buffer condition and "aBuffer->current" isn't needed between calls
so I made it local, and "eolStarted" is redundant since we have "eolchar".
It's 2-22% faster than the old code (the lower figure for "normal"
content and the higher figure for the edge case of a file filled with \n).
It's possible to make the function slightly shorter, by just having
one for-loop with the "if (eolchar ...)" tests inside it, but by
splitting the loop in two "eolchar" became a loop invariant so it's
faster. It's also clearer I think.
Attachment #282971 -
Flags: superreview?(cbiesinger)
Attachment #282971 -
Flags: review?(cbiesinger)
Assignee | ||
Comment 2•17 years ago
|
||
Comment 3•17 years ago
|
||
We want this for bug 410264 ?
Comment 4•17 years ago
|
||
Comment on attachment 282972 [details] [diff] [review]
xpcshell regression tests
should probably make the entries in the test_array strings instead of numbers, because that's what readLine returns
can you put your txt files into a data subdirectory of test/unit, so that they don't clutter the directory with the tests?
Updated•17 years ago
|
Attachment #282971 -
Flags: superreview?(cbiesinger)
Attachment #282971 -
Flags: superreview+
Attachment #282971 -
Flags: review?(cbiesinger)
Attachment #282971 -
Flags: review+
Updated•17 years ago
|
Flags: blocking1.9? → blocking1.9+
Priority: -- → P3
Comment 5•17 years ago
|
||
Did this get resolved?
Comment 6•17 years ago
|
||
if there are no objections i'll just land this sometime in the next few days.
Assignee | ||
Comment 7•17 years ago
|
||
Mike, Dan, sorry for the delay. I'm landing some other stuff today so I'll
fix Christian's nits and land this today also...
Assignee | ||
Comment 8•17 years ago
|
||
'kLineBufferSize' has been changed from 1024 to 4096 since the last time,
so I had to rewrite a few of the tests to trigger the end-of-buffer
condition as intended.
(I will add a code comment next to the #define to point out that the
tests should be updated if the value is changed.)
(In reply to comment #4)
> should probably make the entries in the test_array strings ...
Did so.
> can you put your txt files into a data subdirectory of test/unit,
That too.
Attachment #282972 -
Attachment is obsolete: true
Assignee | ||
Comment 9•17 years ago
|
||
There are a couple of uses of the old line buffer fields that I missed,
so we need this patch too. Sorry for missing this the first time.
Attachment #296479 -
Flags: superreview?(cbiesinger)
Attachment #296479 -
Flags: review?(cbiesinger)
Updated•17 years ago
|
Attachment #296479 -
Flags: superreview?(cbiesinger)
Attachment #296479 -
Flags: superreview+
Attachment #296479 -
Flags: review?(cbiesinger)
Attachment #296479 -
Flags: review+
Assignee | ||
Comment 10•17 years ago
|
||
I had to do a minor tweak in one of the unit tests for passwordmgr
that depended on this bug. Filed bug 412440 on that.
mozilla/netwerk/test/unit/test_readline.js 1.1
mozilla/netwerk/test/unit/data/test_readline1.txt 1.1
mozilla/netwerk/test/unit/data/test_readline2.txt 1.1
mozilla/netwerk/test/unit/data/test_readline3.txt 1.1
mozilla/netwerk/test/unit/data/test_readline4.txt 1.1
mozilla/netwerk/test/unit/data/test_readline5.txt 1.1
mozilla/netwerk/test/unit/data/test_readline6.txt 1.1
mozilla/netwerk/test/unit/data/test_readline7.txt 1.1
mozilla/netwerk/test/unit/data/test_readline8.txt 1.1
mozilla/netwerk/base/public/nsReadLine.h 1.12
mozilla/mailnews/compose/src/nsMsgSendPart.cpp 1.64
mozilla/mailnews/local/src/nsLocalMailFolder.cpp 1.568
-> FIXED
Status: NEW → RESOLVED
Closed: 17 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9 M11
You need to log in
before you can comment on or make changes to this bug.
Description
•