Closed Bug 1121970 Opened 9 years ago Closed 9 years ago

debug output from printf_stderr gets clipped on Windows

Categories

(Core :: General, defect)

x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38

People

(Reporter: jimm, Assigned: jimm)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch patch (obsolete) — Splinter Review
Attachment #8550255 - Flags: review?(benjamin)
Comment on attachment 8550255 [details] [diff] [review]
patch

Please at least use nsAutoArrayPtr<char> instead of the manual new/delete. I feel like there has to be a better way here, but I'm not thinking of it offhand.
Attachment #8550255 - Flags: review?(benjamin) → review?(nfroyd)
Comment on attachment 8550255 [details] [diff] [review]
patch

Review of attachment 8550255 [details] [diff] [review]:
-----------------------------------------------------------------

r=me with the changes below.

::: xpcom/glue/nsCRTGlue.cpp
@@ +340,5 @@
>    if (IsDebuggerPresent()) {
> +    int lengthNeeded = _vscprintf(aFmt, aArgs);
> +    if (lengthNeeded) {
> +      lengthNeeded++;
> +      char* buf = new char[lengthNeeded];

Please use mozilla::UniquePtr (mozilla/UniquePtr.h) here.  Bonus points if you use MakeUnique:

auto buf = MakeUnique<char[]>(lengthNeeded);

@@ +348,5 @@
> +        vsnprintf(buf, lengthNeeded, aFmt, argsCpy);
> +        buf[lengthNeeded - 1] = '\0';
> +        va_end(argsCpy);
> +        OutputDebugStringA(buf);
> +        delete [] buf;

...and then you don't need this.

@@ +350,5 @@
> +        va_end(argsCpy);
> +        OutputDebugStringA(buf);
> +        delete [] buf;
> +      }
> +    } 

Nit: trailing whitespace.
Attachment #8550255 - Flags: review?(nfroyd) → review+
Attached patch patchSplinter Review
Attachment #8550255 - Attachment is obsolete: true
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/768f1c9ea4a1
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.