Skip to content

Const correctness of some functions' arguments #16

@GoogleCodeExporter

Description

@GoogleCodeExporter
What steps will reproduce the problem?

1. const char * mimeDescription = NP_GetMIMEDescription();
2. ...
3. NPP_New(mime, ...)

What is the expected output? What do you see instead?

I expect the code to compile. Instead, I see an error "cannot convert from 
'const char *' to 'char *'". Using non-const char* means that plugin can modify 
its mimetype at any time. I don't see this requirement anywhere. So I think 
plugin would only modify its local copy and shouldn't impact the browser.

What operating system are you compiling on?

Doesn't matter.

Please provide any additional information below.

This is actually a general issue with all readonly data passed as pointers. I 
think headers should clearly state which parameters are intended for output and 
which aren't.

actual: NPP_NewProcPtr (NPMIMEType pluginType, ...)
expected: NPP_NewProcPtr (const NPMIMEType pluginType, ...)

actual: NPP_NewStreamProcPtr(..., NPMIMEType type, ...)
expected: NPP_NewStreamProcPtr(..., const NPMIMEType type, ...)

actual: NPP_WriteProcPtr(..., void* buffer)
expected: NPP_WriteProcPtr(..., const void* buffer)

actual: NPP_SetValueProcPtr(..., void *value);
expected: NPP_SetValueProcPtr(..., const void *value);


Original issue reported on code.google.com by Van...@gmail.com on 23 Feb 2012 at 10:17

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions