Closed
Bug 132141
Opened 23 years ago
Closed 21 years ago
Occurences of uninitialized variables being used before being set (in content/xul and layout/xul)
Categories
(Core :: XUL, defect)
Tracking
()
People
(Reporter: mozilla-bugs, Assigned: hyatt)
Details
Attachments
(1 obsolete file)
This bug is just for the "xxx might be used uninitialized" warnings in various
source files in content/xul and layout/xul directories.
Currently (http://tinderbox.mozilla.org/SeaMonkey/warn1016552220.1515.html -
Tue, 19 Mar 2002 10:37 EST) TBox shows the following warnings:
content/xul/templates/src/nsTemplateMatchSet.cpp:257
`class nsTemplateMatch ** last' might be used uninitialized in this function
layout/xul/base/src/nsBoxFrame.cpp:1715
`nscoord onePixel' might be used uninitialized in this function
layout/xul/base/src/nsBoxToBlockAdaptor.cpp:598
`nsresult rv' might be used uninitialized in this function
layout/xul/base/src/nsTextBoxFrame.cpp:355
`nscolor overColor' might be used uninitialized in this function
layout/xul/base/src/nsTextBoxFrame.cpp:356
`nscolor underColor' might be used uninitialized in this function
layout/xul/base/src/nsTextBoxFrame.cpp:357
`nscolor strikeColor' might be used uninitialized in this function
Reporter | ||
Comment 1•23 years ago
|
||
Bug 59652 is the meta-bug tracking the fight against these (potentially very
nasty) warnings; bug 59675 is for warning in layout and bug 126457 is for
warnings in content.
Updated•22 years ago
|
Summary: Occurances of uninitialized variables being used before being set (in content/xul and layout/xul) → Occurences of uninitialized variables being used before being set (in content/xul and layout/xul)
Of the warnings stated in comment 0, the following doesn't exist anymore
layout/xul/base/src/nsBoxToBlockAdaptor.cpp:598
`nsresult rv' might be used uninitialized in this function
A simple patch to address the remaining warnings coming up.
Attachment #110589 -
Flags: superreview?(dbaron)
Attachment #110589 -
Flags: review?(caillon)
Comment 4•22 years ago
|
||
Comment on attachment 110589 [details] [diff] [review]
patch to get rid of the warnings, v1
>Index: content/xul/templates/src/nsTemplateMatchSet.cpp
>- nsTemplateMatch** last;
>+ nsTemplateMatch** last = nsnull;
Maybe I'm missing something, but why is this variable even needed?
>Index: layout/xul/base/src/nsBoxFrame.cpp
>- nscoord onePixel;
>+ nscoord onePixel = NSIntPointsToTwips(0);
It seems strange to store what equates to 0 pixels into a variable named
onePixel. Rather than initialize it here, why not move the declaration and
initialization to the block where it's actually used? E.g. change:
nscoord onePixel;
if (foo) {
...
onePixel = NSIntPixelsToTwips(1, p2t);
...
}
...
if (foo) {
y = cr.y + onePixel;
...
}
to:
if (foo) {
...
}
...
if (foo) {
nscoord onePixel = ...
y = cr.y + onePixel;
...
}
Attachment #110589 -
Flags: review?(caillon) → review-
I think I already have the latter change in my patch to bug 186953, at least if
we're talking about the same file.
Attachment #110589 -
Flags: superreview?(dbaron)
Updated•21 years ago
|
Updated•21 years ago
|
No longer blocks: buildwarning
Updated•21 years ago
|
Attachment #110589 -
Attachment is obsolete: true
Comment 6•21 years ago
|
||
(In reply to comment #5)
> I think I already have the latter change in my patch to bug 186953, at least if
Verified: <layout/xul/base/src/nsBoxFrame.cpp>, comment 4 |onePixel| fix was
checked in in bug 186953 :-)
Obsoleted r- patch v1: <nsTemplateMatchSet.cpp> and <nsTextBoxFrame.cpp>
warnings still exist: moving their fixes to bug 126457 and bug 59675 respectively.
*** This bug has been marked as a duplicate of 59652 ***
Component: XP Toolkit/Widgets: XUL → XUL
QA Contact: shrir → xptoolkit.widgets
You need to log in
before you can comment on or make changes to this bug.
Description
•