Closed Bug 557690 Opened 14 years ago Closed 14 years ago

nsEditor.cpp:2037: error: ‘result’ may be used uninitialized in this function

Categories

(Core :: DOM: Editor, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: dholbert, Assigned: craig.topper)

References

Details

Attachments

(1 file)

This changeset from bug 253889...
  http://hg.mozilla.org/mozilla-central/rev/c9f647e9d472
... removed the only line that set the return value |result| in nsEditor::QueryComposition, leaving that method with an uninitialized return value.

This is noted by this warning in opt builds:
{
> editor/libeditor/base/nsEditor.cpp:2037: error: ‘result’ may be used uninitialized in this function
> editor/libeditor/base/nsEditor.cpp:1975: note: ‘result’ was declared here
}

Link to code as it currently stands:
http://hg.mozilla.org/mozilla-central/annotate/64ebf70ed4a2/editor/libeditor/base/nsEditor.cpp#l1972

There are now only two mentions of the variable |result| in that method -- the declaration (which doesn't initialize it), and the return statement (where we return who-knows-what).

Craig, do you think you could investigate, since this was from your patch?  It might be that nsEditor::QueryComposition doesn't even need a return-value anymore, or maybe it can just return a PRBool or something simpler now -- I'm not sure.
Looks like it still returns NS_ERROR_NOT_INITIALIZED in two places. Probaby just need to remove the result and change to return NS_OK at the end.
Attachment #437476 - Flags: review?(roc)
Keywords: checkin-needed
Thanks for the quick fix! Landed:
http://hg.mozilla.org/mozilla-central/rev/076041952721
Assignee: nobody → craig.topper
Status: NEW → RESOLVED
Closed: 14 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: