Closed Bug 1238615 Opened 8 years ago Closed 8 years ago

Compiler warning: possibly uninitialized |rv| - mailnews/base/src/nsMsgPrintEngine.cpp

Categories

(Thunderbird :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 46.0

People

(Reporter: ishikawa, Assigned: ishikawa)

Details

Attachments

(1 file, 1 obsolete file)

Attached patch warning-nsMsgPrintEngine.patch (obsolete) — Splinter Review
During local testing of my new patches for C-C TB to make sure that my
patches do not introduce new warnings (at least under linux where I
compile and test), I noticed a compiler warning from
nsMsgPrintEngine.cpp.

As I looked, |rv| ought to be initialized during normal processing.
But the logic seems a little twisted (see the comment in the code),
and obscure.

So even if |rv| may be properly initialized during normal processing, try telling it to the compiler and future community maintainers.

I simply set a default error value and added an error case handling
although the error ought to be rare. (The code is much saner with the |else| part.)

This shuts up the compiler warning (e.g., gcc 5.3).
Attachment #8706430 - Flags: review?(bwinton)
Assignee: nobody → ishikawa
Comment on attachment 8706430 [details] [diff] [review]
warning-nsMsgPrintEngine.patch

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

rs=me with that fixed.

::: mailnews/base/src/nsMsgPrintEngine.cpp
@@ +494,5 @@
>                             nullptr,                            // Referring URI
>                             nullptr,                            // Post data
>                             nullptr);                           // Extra headers
> +    else // we should report the error (!)
> +       rv = NS_ERROR_FAILURE;

If we've already initialized it above, I don't think we need to re-set it here…
Attachment #8706430 - Flags: review?(bwinton) → review+
Blocks: 1232107
Component: Untriaged → General
No longer blocks: 1232107
Updated patch. Carrying over r=bwinton. I will put checkin-needed keyword.

TIA
Attachment #8706430 - Attachment is obsolete: true
Attachment #8710690 - Flags: review+
Keywords: checkin-needed
https://hg.mozilla.org/comm-central/rev/9974e710d039
Status: NEW → RESOLVED
Closed: 8 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 46.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: