Closed Bug 18635 Opened 25 years ago Closed 25 years ago

nsBasePrincipal.cpp attempts illegal cast

Categories

(Core :: Security: CAPS, defect, P3)

Sun
Solaris
defect

Tracking

()

VERIFIED DUPLICATE of bug 18640

People

(Reporter: tor, Assigned: norrisboyd)

Details

The SUNWspro 4.2 compilers don't like casting directly from a void* to a short:

"/cs/src/mozilla/mozilla/caps/src/nsBasePrincipal.cpp", line 64: Error: Cannot
cast from void* to short.

Casting through an intermediate long makes the compiler happy:

Index: nsBasePrincipal.cpp
===================================================================
RCS file: /cvsroot/mozilla/caps/src/nsBasePrincipal.cpp,v
retrieving revision 1.1
diff -u -r1.1 nsBasePrincipal.cpp
--- nsBasePrincipal.cpp 1999/11/11 22:10:34     1.1
+++ nsBasePrincipal.cpp 1999/11/12 01:25:53
@@ -61,7 +61,7 @@
         return NS_OK;
     }
     nsStringKey key(capability);
-    *result = (PRInt16) mCapabilities->Get(&key);
+    *result = (PRInt16)(long)mCapabilities->Get(&key);
     if (!*result)
         *result = nsIPrincipal::ENABLE_UNKNOWN;
     return NS_OK;
What about casting through an int instead? Casting through a long seems odd for
machines where long is 64 bits but void * is 32.
It's happy with that as well.
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → DUPLICATE
Checked in fix.

*** This bug has been marked as a duplicate of 18640 ***
Status: RESOLVED → VERIFIED
[bugday] verified dupe. different compilers but same bug.
Moving all CAPS bugs to Security: CAPS component.  CAPS component will be 
deleted.
Component: CAPS → Security: CAPS
You need to log in before you can comment on or make changes to this bug.