Closed Bug 261145 Opened 20 years ago Closed 8 years ago

nsPrintfCString should not truncate long result strings

Categories

(Core :: XPCOM, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 743056

People

(Reporter: vlad, Unassigned)

Details

The (const char *format, ...) nsPrintfCString constructor is almost entirely
worthless -- it initializes the internal buffer to the default string size (16
bytes), and then calls PR_snprintf with that fixed size.  It would be much more
useful and would make more sense if it were to calculate the amount of space
needed for the formatted string and DTRT.
it would be nice if we could avoid heap allocations in every invocation, but
maybe that's just what we should do :-/

of course when given a size argument, it should continue to truncate.
Summary: nsPrintfCString constructor is useless → nsPrintfCString should not truncate long result strings
I thought I filed a bug somewhere on making it us PR_smprintf and having a
PrintfString that uses nsTextFormatter (not nsTextFormater! :-).
Assignee: string → nobody
QA Contact: string
IIUC, the landed patch in Bug 743056 should have fixed this.
Feel free to re-open if this is not the case.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
Component: String → XPCOM
You need to log in before you can comment on or make changes to this bug.