Closed Bug 962821 Opened 10 years ago Closed 10 years ago

error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

Categories

(MailNews Core :: Build Config, defect)

x86_64
Linux
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 29.0

People

(Reporter: squib, Assigned: squib)

References

Details

(Keywords: regression)

Attachments

(1 file)

Bug 781552 broke us pretty badly, it seems. We're getting a bunch of compile failures on 64-bit now due to casting ints to pointers. It looks like it's mostly PL_HashTable* stuff.
Sorry about that. Let me know if I can help. 
FYI, here is the patch which had to be applied on trace-malloc (cf patch 944892)
https://hg.mozilla.org/mozilla-central/rev/a8d637b029a7 (which also uses a hashtable)
Yeah, we could definitely do the uintptr_t dance, although I'm not 100% sure it's actually what we want to do in all cases.
Keywords: regression
This is relevant to my interests, as i'm also hitting this (see http://buildbot.rhaalovely.net/builders/comm-central-amd64/builds/985):

/var/buildslave-mozilla/comm-central-amd64/build/mailnews/addrbook/src/nsAbLDIFService.cpp:100:38: error: cast to 'void *' from smaller integer type 'int32_t' (aka 'int') [-Werror,-Wint-to-pointer-cast]
          listPosArray.AppendElement((void*)savedStartPos);
                                     ^
/var/buildslave-mozilla/comm-central-amd64/build/mailnews/addrbook/src/nsAbLDIFService.cpp:101:39: error: cast to 'void *' from smaller integer type 'int' [-Werror,-Wint-to-pointer-cast]
          listSizeArray.AppendElement((void*)(filePos + startPos-savedStartPos));
                                      ^
Attached patch Fix itSplinter Review
Here we go. I used ptrdiff_t in calendar/ since that's what other parts of the file use. When in Rome...
Assignee: nobody → squibblyflabbetydoo
Status: NEW → ASSIGNED
Attachment #8364668 - Flags: review?(Pidgeot18)
Comment on attachment 8364668 [details] [diff] [review]
Fix it

Review of attachment 8364668 [details] [diff] [review]:
-----------------------------------------------------------------

I'm happy, so long as you replace the (intptr_t) casts with (uintptr_t).

And remove the #include "nsVoidArray.h" from nsAbLDIFService.cpp.
Attachment #8364668 - Flags: review?(Pidgeot18) → review+
Landed with comments addressed: https://hg.mozilla.org/comm-central/rev/507cf80a989e
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 29.0
You need to log in before you can comment on or make changes to this bug.