Closed Bug 98213 Opened 23 years ago Closed 23 years ago

Make data members of nsStr protected and clean up code

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla0.9.7

People

(Reporter: jag+mozilla, Assigned: jag+mozilla)

References

Details

Attachments

(1 file, 4 obsolete files)

More code cleanup.
Needs SubsumeStr patch in bug 98153.
Status: NEW → ASSIGNED
Depends on: 98153
Target Milestone: --- → mozilla0.9.5
Is the comment in nsDirectoryViewer.cpp no longer true? If so, take it out. If not, could you find a way to do what the original code did?
Attachment #48189 - Attachment is obsolete: true
Attached patch Updated per dbaron's comment (obsolete) — Splinter Review
Could you explain why the SetLength calls still do what the old code did even though SetLength does stuff other than set mLength?
Sure. SetLength will grow the string if you're setting it to a length greater than its current capacity. In this case it's a no-op since the code already did that directly through SetCapacity a few lines up.
Mass-moving lower-priority 0.9.5 bugs off to 0.9.6 to make way for remaining 0.9.4/eMojo bugs, and MachV planning, performance and feature work. If you disagree with any of these targets, please let me know.
Target Milestone: mozilla0.9.5 → mozilla0.9.6
-> 0.9.7
Target Milestone: mozilla0.9.6 → mozilla0.9.7
I've got similar work over in bug 108962.. jag and I discussed that he would try to get the best of both worlds landed for this bug first, then I would submit new patches for that bug.
Blocks: 108962
Comment on attachment 48687 [details] [diff] [review] Updated per dbaron's comment that said, sr=alecf
Attachment #48687 - Flags: superreview+
Is there a better solution for the MathML change? I prefer Truncate(0) (or Truncate()) over SetLength(0), etc (when it is a truncation). What's the ToNewUTF8String doing there?
I could remove the Operator constructor since no one uses it ;-) Other than that, I could maybe convert this to use nsDependentString, let me look at that if you think it's really an issue. SetLength(0) fixed, and removed the explicit 0 terminations right above them (and other SetLength calls in the same file) since SetLength takes care of that. ToNewUTF8String pulls some tricks to avoid an extra copy if the NS_ConvertUCS2toUTF8 allocated memory to do the conversion: http://lxr.mozilla.org/seamonkey/source/string/src/nsReadableUtils.cpp#214
alecf, sorry about not having it in yet.
Attachment #48687 - Attachment is obsolete: true
Attachment #57453 - Attachment is obsolete: true
Attachment #57464 - Attachment is obsolete: true
Comment on attachment 57573 [details] [diff] [review] Above + removing the unused constructor of OperatorData. so awesome. sr=alecf Oh well, I was out of town for the sr= anyway :)
Attachment #57573 - Flags: superreview+
Comment on attachment 57573 [details] [diff] [review] Above + removing the unused constructor of OperatorData. r=dbaron
Attachment #57573 - Flags: review+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: