behrooz1xX / npapi-sdk

Automatically exported from code.google.com/p/npapi-sdk
0 stars 0 forks source link

NP_* function declarations are declared with calling convention incompatible with NP_*Func types #18

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
See the attached patch. Eg. NP_Initialize uses OSCALL that specifies the 
calling convention, but NP_InitializeFunc does not. It means that if someone 
stores pointer to NP_Initialize in a variable of type NP_InitializeFunc and try 
to call it, the call will be done with wrong (platform default) calling 
convention. The attached patch fixes it.

The alternative fix would be to use:

typedef typeof(NP_Initialize) NP_InitializeFunc;

but that's less portable.

Original issue reported on code.google.com by cja...@gmail.com on 20 Apr 2012 at 3:00

Attachments:

GoogleCodeExporter commented 8 years ago
-typedef const char* (*NP_GetMIMEDescriptionFunc)(void);
+typedef const char* (OSCALL *NP_GetMIMEDescriptionFunc)(void);
 const char*         NP_GetMIMEDescription(void);

This particular function is not marked OSCALL. Why are you putting OSCALL in 
the typedef for NP_GetMIMEDescriptionFunc?

The others look fine to me.

Any thoughts on this Stuart?

Original comment by josh....@gmail.com on 24 Apr 2012 at 5:59

GoogleCodeExporter commented 8 years ago
NP_GetMIMEDescription was a typo, sorry about that. I'm attaching a fixed 
version.

Original comment by cja...@gmail.com on 25 Apr 2012 at 11:13

Attachments:

GoogleCodeExporter commented 8 years ago
LGTM, I will land it soon.

Original comment by josh....@gmail.com on 25 Apr 2012 at 12:48