Closed
Bug 204503
Opened 22 years ago
Closed 22 years ago
Uninitialized variable in mozilla/netwerk/protocol/jar/src/nsJARChannel.cpp
Categories
(Core :: Networking, defect)
Tracking
()
VERIFIED
FIXED
mozilla1.6beta
People
(Reporter: tenthumbs, Assigned: darin.moz)
Details
Attachments
(2 files)
2.55 KB,
patch
|
Details | Diff | Splinter Review | |
2.50 KB,
patch
|
darin.moz
:
review+
|
Details | Diff | Splinter Review |
Gcc says:
nsJARChannel.cpp:465: warning: `nsresult rv' might be used \
uninitialized in this function
The relevant code is:
488 if (ext) {
489 nsIMIMEService *mimeServ = gJarHandler->MimeService();
490 if (mimeServ) {
491 nsXPIDLCString mimeType;
492 rv = mimeServ->GetTypeFromExtension(ext,
getter_Copies(mimeType));
493 if (NS_SUCCEEDED(rv))
494 mContentType = mimeType;
495 }
496 }
497 else
498 rv = NS_ERROR_NOT_AVAILABLE;
499
500 if (NS_FAILED(rv) || mContentType.IsEmpty())
501 mContentType = NS_LITERAL_CSTRING(UNKNOWN_CONTENT_TYPE);
Not that if (ext && !mimeServ) then rv is not set.
That should say: Note that if (ext && !mimeServ) the rv is not set.
![]() |
Assignee | |
Comment 2•22 years ago
|
||
pushing out since not critical that we run without a mime service...
Severity: normal → trivial
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla1.5alpha
Status: NEW → ASSIGNED
Target Milestone: mozilla1.5alpha → mozilla1.5beta
Comment 4•22 years ago
|
||
Make sure that rv is initialised ok, and
change flow in function so that it is more clear that mContentType is always
set:
if (mContentType is empty) {
// Try to set the mContentType
// If still empty or error set mContentType to 'UNKNOWN_CONTENT_TYPE'
}
return mContentType
This also saves a couple of code bytes
Updated•22 years ago
|
Attachment #135174 -
Flags: review?(darin)
Comment 5•22 years ago
|
||
if (mContentType is empty) {
// Try to set the mContentType
if (mContent is still empty) set mContentType to 'UNKNOWN_CONTENT_TYPE'
}
return mContentType
Attachment #135174 -
Attachment is obsolete: true
Updated•22 years ago
|
Attachment #135174 -
Attachment is obsolete: false
Attachment #135174 -
Flags: review?(darin)
Updated•22 years ago
|
Attachment #135175 -
Flags: review?(darin)
![]() |
Assignee | |
Comment 6•22 years ago
|
||
Comment on attachment 135175 [details] [diff] [review]
Even better, use only rv where needed
r=darin
Attachment #135175 -
Flags: review?(darin) → review+
![]() |
Assignee | |
Comment 7•22 years ago
|
||
-> me (for checkin)
Assignee: suresh → darin
Status: ASSIGNED → NEW
Target Milestone: mozilla1.5beta → mozilla1.6beta
![]() |
Assignee | |
Comment 8•22 years ago
|
||
fixed-on-trunk
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Status: RESOLVED → VERIFIED
You need to log in
before you can comment on or make changes to this bug.
Description
•