Closed
Bug 242350
Opened 21 years ago
Closed 20 years ago
LL_INIT(0, -1) is wrong
Categories
(Core :: Networking, defect)
Core
Networking
Tracking
()
RESOLVED
FIXED
mozilla1.8alpha6
People
(Reporter: Biesinger, Assigned: zbraniecki)
References
()
Details
Attachments
(1 file, 2 obsolete files)
2.97 KB,
patch
|
Details | Diff | Splinter Review |
In bug 240257 I added some usages of LL_INIT(0, -1).
wtc said in bug 123403 comment 6 that the right way is LL_INIT(0xFFFFFFFF,
0xFFFFFFFF).
Reporter | ||
Comment 3•20 years ago
|
||
fixed by bug 243974
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
REOPEN:
The checked-in usages of this code were not fixed w/ the depends bug.
If you look at LXR, the usages checked in from bug 240257 remain.
(The first patch of bug 243974 did use LL_INIT a lot, and the 2nd patch did
remove those usages, so that bug did not add further uses...)
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Reporter | ||
Comment 5•20 years ago
|
||
oops. well spotted, thanks benc!
Target Milestone: --- → mozilla1.8alpha5
Reporter | ||
Comment 6•20 years ago
|
||
gandalf, want to take this? a better way than comment 1 is probably to use
LL_MaxUint().
Assignee | ||
Comment 7•20 years ago
|
||
sure. taking
Status: REOPENED → ASSIGNED
Target Milestone: mozilla1.8alpha5 → mozilla1.8alpha6
Assignee | ||
Comment 8•20 years ago
|
||
I hate this. I hate that reassigning does not move owner to me
Assignee: cbiesinger → gandalf
Status: ASSIGNED → NEW
Assignee | ||
Comment 9•20 years ago
|
||
Assignee | ||
Updated•20 years ago
|
Attachment #167887 -
Flags: review?(cbiesinger)
Reporter | ||
Comment 10•20 years ago
|
||
Comment on attachment 167887 [details] [diff] [review]
patch
netwerk/streamconv/converters/nsDirIndexParser.cpp
- aIdx->SetSize(LL_INIT(0, -1)); // -1 means unknown
+ aIdx->SetSize(LL_MaxUint());
please don't remove the comment
netwerk/streamconv/converters/nsIndexedToHTML.cpp
+ if (LL_NE((PRUint64)size, LL_MaxUint()) &&
hm, I prefer PRUint64(size) instead of (PRUint64)size..
same in xpfe/components/directory/nsDirectoryViewer.cpp
r=me with those changes; please ask darin for sr
thanks for making this patch!
Attachment #167887 -
Flags: review?(cbiesinger) → review+
Assignee | ||
Comment 11•20 years ago
|
||
Attachment #167887 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #167893 -
Flags: superreview?(darin)
Attachment #167893 -
Flags: review?(cbiesinger)
Reporter | ||
Updated•20 years ago
|
Attachment #167893 -
Flags: review?(cbiesinger) → review+
Comment 12•20 years ago
|
||
Comment on attachment 167893 [details] [diff] [review]
updated patch
or maybe use LL_MAXUINT instead? (since this initializer really shouldn't
require a DSO function call on platforms where we have a native int64 type.
i know that LL_MAXUINT is just a macro for LL_MaxUint(), but I think it
should be changed.)
sr=darin with or without that change and a bug to fix LL_MAXUINT ;-)
Attachment #167893 -
Flags: superreview?(darin) → superreview+
Assignee | ||
Comment 13•20 years ago
|
||
Updated patch. Biesi - could you check this in?
Attachment #167893 -
Attachment is obsolete: true
Reporter | ||
Comment 14•20 years ago
|
||
darin, gandalf: So if pruint64 is a struct (let's assume mozilla would compile
with that)... then LL_MAXUINT would be something like { PR_UINT32_MAX,
PR_UINT32_MAX }, right?
is such syntax allowed for LL_NE, member initialization in ctors, and function
arguments?
Comment 15•20 years ago
|
||
> darin, gandalf: So if pruint64 is a struct (let's assume mozilla would compile
> with that)... then LL_MAXUINT would be something like { PR_UINT32_MAX,
> PR_UINT32_MAX }, right?
no, it would not work to define LL_MAXUINT like that. in the case where
pruint64 is not supported natively, the function calls would probably be needed.
Assignee | ||
Comment 16•20 years ago
|
||
Comment on attachment 168573 [details] [diff] [review]
Use macro here
<biesi> but yeah. I think LL_MaxUint() is actually better here...
marking macro patch obsolate.
Attachment #168573 -
Attachment is obsolete: true
Assignee | ||
Updated•20 years ago
|
Attachment #167893 -
Attachment is obsolete: false
Comment 17•20 years ago
|
||
> <biesi> but yeah. I think LL_MaxUint() is actually better here...
>
> marking macro patch obsolate.
huh? how does that logically follow? today's macro is equivalent to
LL_MaxUint, but as i said, tomorrow's version of the macro could be optimized
for machines with a native 64-bit integer. for machines without a native 64-bit
integer, the macro could continue to expand to the function call.
Reporter | ||
Comment 18•20 years ago
|
||
darin: hm... it depends :) what is the purpose of this macro? maybe it's meant
for stuff like:
PRUint64 foo = LL_MAXUINT;
for which such a {} definition would work...
Comment 19•20 years ago
|
||
(In reply to comment #18)
> darin: hm... it depends :) what is the purpose of this macro? maybe it's meant
> for stuff like:
>
> PRUint64 foo = LL_MAXUINT;
>
> for which such a {} definition would work...
Sure, but you cannot tell how the macro will be used. Therefore, it is not
possible to implement the macro using {}. So, I would recommend that macro
expand to the function call on platforms without native 64-bit integer support.
On other platforms, it can expand to a numeric 64-bit literal. Make sense?
Reporter | ||
Comment 20•20 years ago
|
||
sure... fine with me; as long as wtc agrees with you ;)
Reporter | ||
Updated•20 years ago
|
Attachment #168573 -
Attachment is obsolete: false
Reporter | ||
Updated•20 years ago
|
Attachment #167893 -
Attachment is obsolete: true
Reporter | ||
Comment 21•20 years ago
|
||
I checked the LL_MAXUINT patch in.
Checking in netwerk/streamconv/converters/nsDirIndex.cpp;
/cvsroot/mozilla/netwerk/streamconv/converters/nsDirIndex.cpp,v <-- nsDirIndex.cpp
new revision: 1.10; previous revision: 1.9
done
Checking in netwerk/streamconv/converters/nsDirIndexParser.cpp;
/cvsroot/mozilla/netwerk/streamconv/converters/nsDirIndexParser.cpp,v <--
nsDirIndexParser.cpp
new revision: 1.18; previous revision: 1.17
done
Checking in netwerk/streamconv/converters/nsIndexedToHTML.cpp;
/cvsroot/mozilla/netwerk/streamconv/converters/nsIndexedToHTML.cpp,v <--
nsIndexedToHTML.cpp
new revision: 1.63; previous revision: 1.62
done
Checking in xpfe/components/directory/nsDirectoryViewer.cpp;
/cvsroot/mozilla/xpfe/components/directory/nsDirectoryViewer.cpp,v <--
nsDirectoryViewer.cpp
new revision: 1.117; previous revision: 1.116
done
Status: NEW → RESOLVED
Closed: 20 years ago → 20 years ago
Resolution: --- → FIXED
Reporter | ||
Comment 22•20 years ago
|
||
after having some fun with msvc6, I ended up with:
if (nsUint64(PRUint64(size)) != nsUint64(LL_MAXUINT) &&
instead of
if (LL_NE(PRUint64(size), LL_MAXUINT) &&
Reporter | ||
Comment 23•20 years ago
|
||
filed bug 277704 for eliminating the function call in LL_ZERO etc.
You need to log in
before you can comment on or make changes to this bug.
Description
•