Closed Bug 58258 Opened 24 years ago Closed 24 years ago

warnings in nsNetUtil.h

Categories

(Core :: Networking, defect, P3)

x86
Linux
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: blizzard, Assigned: blizzard)

Details

There are warnings that are generated by any file that includes nsNetUtil.h.
According to scc it's because default values are assigned from an enum which is
an anonymous type.  Casting them fixes it.

Index: nsNetUtil.h
===================================================================
RCS file: /cvsroot/mozilla/netwerk/base/public/nsNetUtil.h,v
retrieving revision 1.24
diff -u -r1.24 nsNetUtil.h
--- nsNetUtil.h 2000/09/21 05:01:11     1.24
+++ nsNetUtil.h 2000/10/27 21:29:16
@@ -89,7 +89,7 @@
            nsIIOService* ioService = nsnull,    // pass in nsIIOService to
optimize callers
            nsILoadGroup* loadGroup = nsnull,
            nsIInterfaceRequestor* notificationCallbacks = nsnull,
-           nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
+           nsLoadFlags loadAttributes = nsLoadFlags(nsIChannel::LOAD_NORMAL),
            PRUint32 bufferSegmentSize = 0,
            PRUint32 bufferMaxSize = 0)
 {
@@ -143,7 +143,7 @@
            nsIIOService* ioService = nsnull,     // pass in nsIIOService to
optimize callers
            nsILoadGroup* loadGroup = nsnull,
            nsIInterfaceRequestor* notificationCallbacks = nsnull,
-           nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
+           nsLoadFlags loadAttributes = nsLoadFlags(nsIChannel::LOAD_NORMAL),
            PRUint32 bufferSegmentSize = 0,
            PRUint32 bufferMaxSize = 0)
 {
@@ -170,7 +170,7 @@
            nsIIOService* ioService = nsnull,     // pass in nsIIOService to
optimize callers
            nsILoadGroup* loadGroup = nsnull,
            nsIInterfaceRequestor* notificationCallbacks = nsnull,
-           nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
+           nsLoadFlags loadAttributes = nsLoadFlags(nsIChannel::LOAD_NORMAL),
            PRUint32 bufferSegmentSize = 0,
            PRUint32 bufferMaxSize = 0)
 {
@@ -321,7 +321,7 @@
                    PRBool synchronous = PR_FALSE,
                    nsILoadGroup* loadGroup = nsnull,
                    nsIInterfaceRequestor* notificationCallbacks = nsnull,
-                   nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
+                   nsLoadFlags loadAttributes =
nsLoadFlags(nsIChannel::LOAD_NORMAL),
                    PRUint32 bufferSegmentSize = 0,
                    PRUint32 bufferMaxSize = 0)
 {
@@ -348,7 +348,7 @@
                    nsISupports* context = nsnull,
                    nsILoadGroup* loadGroup = nsnull,
                    nsIInterfaceRequestor* notificationCallbacks = nsnull,
-                   nsLoadFlags loadAttributes = nsIChannel::LOAD_NORMAL,
+                   nsLoadFlags loadAttributes =
nsLoadFlags(nsIChannel::LOAD_NORMAL),
                    PRUint32 bufferSegmentSize = 0,
                    PRUint32 bufferMaxSize = 0)
 {
r=scc
seem ok to me. r=gagan
sr=mscott
-> blizzard@mozilla.org
Assignee: gagan → blizzard
I hope mscott won't mind if I sr= it, as it seems you're looking for a weekend 
approval and I'm here watching the tree get timewarped back to a non-red state.
sr=brendan@mozilla.org, hope you can check in some time today or tomorrow!

/be
Checked in.
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Oops.  This didn't work on win32 at all.  Here's the errors from tinderbox.

..\..\..\dist\include\nsNetUtil.h(92) : error C2321: syntax error : unexpected
'nsIChannel::LOAD_NORMAL' ..\..\..\dist\include\nsNetUtil.h(92) : error C2062:
type 'unsigned int (__cdecl *)(void)' unexpected
..\..\..\dist\include\nsNetUtil.h(146) : error C2321: syntax error : unexpected
'nsIChannel::LOAD_NORMAL'
..\..\..\dist\include\nsNetUtil.h(146) : error C2062: type 'unsigned int
(__cdecl *)(void)' unexpected
..\..\..\dist\include\nsNetUtil.h(173) : error C2321: syntax error : unexpected
'nsIChannel::LOAD_NORMAL'
..\..\..\dist\include\nsNetUtil.h(173) : error C2062: type 'unsigned int
(__cdecl *)(void)' unexpected
..\..\..\dist\include\nsNetUtil.h(324) : error C2321: syntax error : unexpected
'nsIChannel::LOAD_NORMAL'
..\..\..\dist\include\nsNetUtil.h(324) : error C2062: type 'unsigned int
(__cdecl *)(void)' unexpected
..\..\..\dist\include\nsNetUtil.h(351) : error C2321: syntax error : unexpected
'nsIChannel::LOAD_NORMAL'
..\..\..\dist\include\nsNetUtil.h(351) : error C2062: type 'unsigned int
(__cdecl *)(void)' unexpected
NMAKE : fatal error U1077: 'cl' : return code '0x2'
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual
Studio\VC98\bin\NMAKE.EXE"' : return code '0x2' NMAKE : fatal error U1077:
'"C:\Program Files\Microsoft Visual Studio\VC98\bin\NMAKE.EXE"' : return code
'0x2' NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual
Studio\VC98\bin\NMAKE.EXE"' : return code '0x2' NMAKE : fatal error U1077:
'"C:\Program Files\Microsoft Visual Studio\VC98\bin\NMAKE.EXE"' : return code
'0x2' NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual
Studio\VC98\bin\NMAKE.EXE"' : return code '0x2'

Can someone with a win32 build box check this?  I don't have access to one at
the moment.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Status: REOPENED → ASSIGNED
waterson, this patch didn't work on win32 and I don't have a box to test on.
Can you try this out on your win32 box?  Trying one of the casts should be
enough to break/test it.  I'm really wondering why this didn't work.
Using NS_STATIC_CAST(nsLoadFlags, nsIChannel::LOAD_NORMAL) seems to compile fine
on both Windows and Linux, with no warnings.
Interesting... a construction `cast' is the moral equivalent of a |static_cast|.
 It is supposed to succeed in exactly the same cases that a |static_cast| could
succeed.  In any case, |NS_STATIC_CAST| is an acceptable fix, I'd be happy to
sr= that change.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago24 years ago
Resolution: --- → FIXED
Checked in.
verified
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.