Bug 22243

Summary: WebScriptDebugDelegate should use intptr_t for sourceId, not int
Product: WebKit Reporter: Geoffrey Garen <ggaren>
Component: WebKit APIAssignee: Geoffrey Garen <ggaren>
Status: RESOLVED FIXED    
Severity: Normal CC: mrowe
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
patch darin: review+

Geoffrey Garen
Reported 2008-11-13 16:05:05 PST
Patch coming. <rdar://problem/6263293>
Attachments
patch (12.54 KB, patch)
2008-11-13 16:05 PST, Geoffrey Garen
darin: review+
Geoffrey Garen
Comment 1 2008-11-13 16:05:32 PST
Darin Adler
Comment 2 2008-11-13 16:32:12 PST
Comment on attachment 25140 [details] patch > +#define WebSourceId int > +#ifndef BUILDING_ON_TIGER > +#ifndef BUILDING_ON_LEOPARD > +#if 0 // FIXME <rdar://problem/6263293>: Remove this "#if 0" once <rdar://problem/6263297> is fixed. > +#undef WebSourceId > +#define WebSourceId intptr_t > +#endif > +#endif > +#endif You can do this without #undef very easily, and I think it might read better. #if defined BUILDING_ON_TIGER || defined BUILDING_ON_LEOPARD #define WebSourceId int #else #define WebSourceId int /* FIXME <rdar://problem/6263293>: Change this to intptr_t once <rdar://problem/6263297> is fixed. */ #endif I think that's slightly nicer. But also, I suggest using a typedef rather than a define. For WebNSUInteger we wanted to avoid having a named type that was just our WebKit copy of NSUInteger, especially since some day we hope to just switch to using NSUInteger directly. But in this case I think a real typedef would be appropriate. You could avoid having to define the macro three different places that way too. I'm going to say review+ because the patch is OK as is too.
Mark Rowe (bdash)
Comment 3 2008-11-13 23:12:45 PST
Why is using intptr_t for source IDs a good thing? Surely an int is large enough, even in 64-bit.
Geoffrey Garen
Comment 4 2008-11-15 14:37:07 PST
Because the sourceID is a pointer, so on 64-bit converting to int will truncate.
Geoffrey Garen
Comment 5 2008-11-19 14:00:18 PST
Committed revision 38604. Switched to the better macro and a typedef.
Note You need to log in before you can comment on or make changes to this bug.