Bug 51554 - Compiler warning in double->int conversion in TestNetscapePlugIn
Summary: Compiler warning in double->int conversion in TestNetscapePlugIn
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Evan Martin
URL:
Keywords:
Depends on:
Blocks: 51551
  Show dependency treegraph
 
Reported: 2010-12-23 12:38 PST by Evan Martin
Modified: 2011-06-18 13:10 PDT (History)
2 users (show)

See Also:


Attachments
Patch (1.65 KB, patch)
2010-12-23 12:39 PST, Evan Martin
no flags Details | Formatted Diff | Diff
Patch (1.69 KB, patch)
2010-12-23 12:43 PST, Evan Martin
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evan Martin 2010-12-23 12:38:48 PST
Compiler warning in double->int conversion in TestNetscapePlugIn
Comment 1 Evan Martin 2010-12-23 12:39:55 PST
Created attachment 77360 [details]
Patch
Comment 2 Evan Martin 2010-12-23 12:41:12 PST
I'm not sure this is correct, but the npruntime.h docs list JS to NPVariant type mappings, and it says:


        Number                          NPVariantType_Double or NPVariantType_Int32


Does that mean both the doubleValue and the intValue are filled in?

...wait a sec, it's a union, this can't be right.  Let me retry.
Comment 3 Evan Martin 2010-12-23 12:43:04 PST
Created attachment 77361 [details]
Patch
Comment 4 Darin Adler 2010-12-23 12:43:17 PST
Comment on attachment 77360 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=77360&action=review

This change is wrong. I have no idea why the test case works!

> Tools/DumpRenderTree/TestNetscapePlugIn/Tests/NPRuntimeRemoveProperty.cpp:66
> -                int32_t number = arguments[1].value.doubleValue;
> +                int32_t number = arguments[1].value.intValue;

This is incorrect. The code above checks for NPVARIANT_IS_DOUBLE, and it won’t work to just read intValue in that case. You can only read the union member that correctly corresponds to the variant that was used. For example, if you call NPVARIANT_IS_INT32 then you can read intValue.
Comment 5 Evan Martin 2010-12-23 12:45:26 PST
(I'm hoping the bots try this change for me, which is how I managed to upload the previous change which was totally wrong.)
Comment 6 Eric Seidel (no email) 2010-12-23 19:09:09 PST
You can force the bots to try a patch with queues.webkit.org/submit-to-ews
Comment 7 WebKit Review Bot 2011-06-18 13:10:27 PDT
Comment on attachment 77361 [details]
Patch

Clearing flags on attachment: 77361

Committed r89202: <http://trac.webkit.org/changeset/89202>
Comment 8 WebKit Review Bot 2011-06-18 13:10:32 PDT
All reviewed patches have been landed.  Closing bug.