Last Comment Bug 388118 - build error: 'DER_Lengths' : cannot convert parameter 3 from 'uint32 *' to 'PRUint32
: build error: 'DER_Lengths' : cannot convert parameter 3 from 'uint32 *' to 'P...
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: Security: PSM (show other bugs)
: Trunk
: x86 Windows XP
: -- normal (vote)
: ---
Assigned To: Kai Engert (:kaie)
:
Mentors:
Depends on:
Blocks: 397296
  Show dependency treegraph
 
Reported: 2007-07-13 21:24 PDT by alexander :surkov
Modified: 2007-10-11 20:10 PDT (History)
5 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (953 bytes, patch)
2007-07-13 21:24 PDT, alexander :surkov
rrelyea: review+
kaie: superreview+
Details | Diff | Splinter Review

Description alexander :surkov 2007-07-13 21:24:31 PDT
Created attachment 272281 [details] [diff] [review]
patch

http://lxr.mozilla.org/mozilla/source/security/manager/ssl/src/nsNSSIOLayer.cpp#1576
uses old version of DER_Lengths method with uint32 argument type (see bug 90426). I get the following compile error:

c:/Mozilla\mozilla\security\manager\ssl\src\nsNSSIOLayer.cpp(1576) : error
C2664: 'DER_Lengths' : cannot convert parameter 3 from 'uint32 *' to 'PRUint32
*'
        Types pointed to are unrelated; conversion requires reinterpret_cast,
C-style cast or function-style cast
make[6]: *** [nsNSSIOLayer.obj] Error 2
Comment 1 Kai Engert (:kaie) 2007-07-13 21:43:32 PDT
Alexander, can you please be more specific what combination of 
  PSM version (like Mozilla 1.8 branch or trunk) 
and
  NSS version (like 3.11 or 3.12)
you used when you ran into this build error?
Comment 2 alexander :surkov 2007-07-13 22:06:50 PDT
(In reply to comment #1)
> Alexander, can you please be more specific what combination of 
>   PSM version (like Mozilla 1.8 branch or trunk) 
> and
>   NSS version (like 3.11 or 3.12)
> you used when you ran into this build error?
> 

I have trunk sources that I got by cvs update (not by make checkout). So I assume PSM and NSS versions are latests. How can I ensure in versions of NSS/PSM?
Comment 3 Kai Engert (:kaie) 2007-07-20 03:37:56 PDT
If you checked out Mozilla trunk, then yes, the contents of mozilla/security/manager (PSM) should be trunk, too.

NSS_CO_TAG in mozilla/client.mk defines the version that you check out.
You can also look at mozilla/security/nss/lib/nss/nss.h


When I looked at this patch first, I assumed some kind of incompatibility.

Alexander, in your build, did you set warnings to be fatal and treated as errors?
Comment 4 Kai Engert (:kaie) 2007-07-20 03:38:17 PDT
I'm trying to understand why I don't get this error.
Comment 5 Robert Relyea 2007-07-20 16:21:50 PDT
Comment on attachment 272281 [details] [diff] [review]
patch

The patch looks fine to me (in fact seems more correct).

I've added kai in the review since he's already started looking at it and it's in PSM.
Comment 6 alexander :surkov 2007-07-20 23:51:43 PDT
(In reply to comment #3)
> If you checked out Mozilla trunk, then yes, the contents of
> mozilla/security/manager (PSM) should be trunk, too.
> NSS_CO_TAG in mozilla/client.mk defines the version that you check out.

NSS_3_11_7_WITH_CKBI_1_64_RTM

but I didn't use make checkout to check out sources.

> You can also look at mozilla/security/nss/lib/nss/nss.h

#define NSS_VERSION  "3.12" _NSS_ECC_STRING " Beta" _NSS_CUSTOMIZED
#define NSS_VMAJOR   3
#define NSS_VMINOR   12
#define NSS_VPATCH   0
#define NSS_BETA     PR_TRUE

Is it those you asked for?

> 
> When I looked at this patch first, I assumed some kind of incompatibility.
> 
> Alexander, in your build, did you set warnings to be fatal and treated as
> errors?
> 

I think no. How can I check this?
Comment 7 Kai Engert (:kaie) 2007-07-23 04:26:21 PDT
This still confuses me.
In both NSS 3.11 branch and NSS 3.12 function DER_Lengths is declared as:

mozilla/security/nss/lib/util/secder.h:
  extern SECStatus DER_Lengths(SECItem *item, 
                               int *header_len_p, 
                               uint32 *contents_len_p);

Both NSS and PSM use the same "type name" uint32 for parameter 3.
But the compiler complains there is a difference.

Why is it necessary to change PSM to use PRUint32?
Shouldn't uint32 and PRUint32 *always* be equivalent?

From the compiler error in comment 0 I conclude:

- while compiling the NSS header, 
    uint32 is equivalent to PRUint32

- while compiling the PSM source,
    uint32 is something else

I think that's a mistake. Why is that?
Comment 8 alexander :surkov 2007-07-24 01:22:37 PDT
(In reply to comment #7)
> This still confuses me.
> In both NSS 3.11 branch and NSS 3.12 function DER_Lengths is declared as:
> 
> mozilla/security/nss/lib/util/secder.h:
>   extern SECStatus DER_Lengths(SECItem *item, 
>                                int *header_len_p, 
>                                uint32 *contents_len_p);

It's that NSS version for that bug 90426 was checked in. There they use PRUint32 for third argument of DER_Lengths().

> Why is it necessary to change PSM to use PRUint32?
> Shouldn't uint32 and PRUint32 *always* be equivalent?

They are equivalent, but it seems uint32* and PRUint32* are different things.
Comment 9 Julien Pierre 2007-07-24 17:05:15 PDT
Alexander, what specific compiler version are you using ?
Comment 10 alexander :surkov 2007-07-24 18:51:36 PDT
(In reply to comment #9)
> Alexander, what specific compiler version are you using ?
> 

VC 7.1 (2003)
Comment 11 Kai Engert (:kaie) 2007-10-09 17:02:36 PDT
Comment on attachment 272281 [details] [diff] [review]
patch

This still confuses me, but I'm fine with this change.

On Linux, I do not get a warning or error, neither with uint32 nor with PRUint32
Comment 12 Robert Relyea 2007-10-10 17:55:46 PDT
    It looks like alexander is using the actual tip of NSS (this could happen by
    doing a cvs update -A in the mozilla/security tree).

    The NSS change was maked to rev 1.9 of mozilla/security/nss/lib/util/secder.h.
    This patch needs to land at the same time ans the NSS alpha 2 update.

    bob


Comment 13 Kai Engert (:kaie) 2007-10-11 12:04:59 PDT
Comment on attachment 272281 [details] [diff] [review]
patch

Removing approval request, this got approved and checked in with bug 397296
Comment 14 Kai Engert (:kaie) 2007-10-11 12:05:43 PDT
marking fixed with the check in from bug 397296
Comment 15 alexander :surkov 2007-10-11 20:10:51 PDT
thanks

Note You need to log in before you can comment on or make changes to this bug.