Closed Bug 70337 Opened 23 years ago Closed 23 years ago

Append(char*,length) does not work if string contains nulls

Categories

(Core :: XPCOM, defect, P4)

defect

Tracking

()

RESOLVED FIXED
mozilla0.9

People

(Reporter: hjtoi-bugzilla, Assigned: scc)

References

Details

I am trying to use nsCString as a buffer for char* data which could contain
nulls in the middle. However, it appears that if I append such a buffer with
Append(char*,length), the length gets lost somewhere and it is set to 0. Later,
when I do Length() it also returns 0.

I have made my own buffer class for my purposes so this is not urgent for me,
but if this was fixed I could remove my class. See bug 49572.
Status: NEW → ASSIGNED
OS: Windows NT → All
Hardware: PC → All
Target Milestone: --- → mozilla0.8.1
Blocks: 70090
Priority: -- → P4
You may prefer to use one of the new string classes as your buffer, or directly
use the same buffer machinery that strings themselves use.  If this is the case,
then this bug will become invalid when the current implementation of |nsCString|
is retired.  See bug #70143 et al.  In the mean time, I'll look into it.
I believe I have fixed this on the STRING_081_BRANCH, though I'll need to add a
case for this to my string unit tests; when the branch is merged into the trunk,
I'll close this bug
(mass change) didn't get these in for target milestone mozilla0.8.1 but they are
very close.  Moving all to mozilla0.9.
Target Milestone: mozilla0.8.1 → mozilla0.9
Blocks: 73786
Removed |ns[C]String| speciallizations for |do_AppendFromReadable|, so this
should work again.
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.