Closed Bug 10508 Opened 25 years ago Closed 25 years ago

nsTarget::HashCode() attempts invalid assignment

Categories

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

Sun
Solaris
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: tor, Assigned: arielb)

Details

nsTarget::HashCode(void) (in caps/src/nsTarget.cpp) attempts an
assignment of "itsPrincipal->HashCode(&code) = 0".  Since
nsIPrincipal::HashCode returns an unsigned long, this doesn't
make a lot of sense.  I'm not sure why other compilers are
letting this pass, but it does trip up the Sun native compilers.

BTW: caps/include/nsPrincipalTools.h needs a newline at the
end of the file.
It looks like you might have wanted that line (928) to be parsed
"a?b:(c=0)" instead of the "(a?b:c)=0" indicated by the associativity
rules.  An extra set of parens helps it figure out the correct meaning:

===================================================================
RCS file: /cvsroot/mozilla/caps/src/nsTarget.cpp,v
retrieving revision 1.12
diff -u -r1.12 nsTarget.cpp
--- nsTarget.cpp        1999/07/24 03:58:19     1.12
+++ nsTarget.cpp        1999/07/26 17:47:33
@@ -925,7 +925,7 @@
 PRInt32
 nsTarget::HashCode(void)
 {      PRUint32 code;
-       (itsPrincipal != NULL) ? itsPrincipal->HashCode(& code) : code = 0;
+       (itsPrincipal != NULL) ? itsPrincipal->HashCode(& code) : (code = 0);
        return PL_HashString(itsName) + code;
 }
Assignee: norris → arielb
Could you take a look at this, ariel?
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Fix already in mozilla.org tree - resolving bug.
Status: RESOLVED → VERIFIED
Reporter satisfied.
Fix checked in.
Setting verified to complete bug cycle.
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.