Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Sep 1, 2015 · 3 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

-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
Copy link
Author

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
Copy link
Author

LGTM, I will land it soon.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant