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)

x86
Linux
defect
Not set
trivial

Tracking

()

RESOLVED DUPLICATE of bug 59652

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
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.
Blocks: 59652, 59675, 126457
Blocks: 52285
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 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.
No longer blocks: 52285
Blocks: buildwarning
No longer blocks: 179819
No longer blocks: buildwarning
Attachment #110589 - Attachment is obsolete: true
(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 ***
No longer blocks: 59652, 59675, 126457
Severity: normal → trivial
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → DUPLICATE
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.

Attachment

General

Creator:
Created:
Updated:
Size: