diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-01-27 15:39:34 +0100 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2012-01-27 15:39:34 +0100 |
commit | 3024396f3a6f5e8444f5d16ecd85c56c32ceb8bd (patch) | |
tree | 707ec7b8bffe6b6fb2ad3d69742dd5eb8fe04252 /SpiceXPI | |
parent | 8d91018450eb01fcce0155be72815b80b9dbd5ae (diff) |
build: deal with non-const return values of NPP_GetMIMEDescription()
Deal with const and non-const return value of NPP_GetMIMEDescription().
Although it is hard to find evidences of how this value is used, I
think the non-const value could return a static string. But I prefer
being on the safe side and return a strdup() to the risk of leaking
that string on older versions.
Fixes the build on RHEL6 with xulrunner-1.9.2.24-2.el6.
Diffstat (limited to 'SpiceXPI')
-rw-r--r-- | SpiceXPI/src/plugin/np_entry.cpp | 7 | ||||
-rw-r--r-- | SpiceXPI/src/plugin/plugin.cpp | 7 |
2 files changed, 14 insertions, 0 deletions
diff --git a/SpiceXPI/src/plugin/np_entry.cpp b/SpiceXPI/src/plugin/np_entry.cpp index 021694c..4eba645 100644 --- a/SpiceXPI/src/plugin/np_entry.cpp +++ b/SpiceXPI/src/plugin/np_entry.cpp @@ -209,10 +209,17 @@ NPError NP_Initialize(NPNetscapeFuncs *aNPNFuncs, NPPluginFuncs *aNPPFuncs) return NS_PluginInitialize(); } +#ifdef NPAPI_USE_CONSTCHARS const char *NP_GetMIMEDescription() { return NPP_GetMIMEDescription(); } +#else +char *NP_GetMIMEDescription() +{ + return NPP_GetMIMEDescription(); +} +#endif NPError NP_GetValue(void *future, NPPVariable aVariable, void *aValue) { diff --git a/SpiceXPI/src/plugin/plugin.cpp b/SpiceXPI/src/plugin/plugin.cpp index 2dada12..816ac63 100644 --- a/SpiceXPI/src/plugin/plugin.cpp +++ b/SpiceXPI/src/plugin/plugin.cpp @@ -106,10 +106,17 @@ namespace { } } +#ifdef NPAPI_USE_CONSTCHARS const char *NPP_GetMIMEDescription(void) { return const_cast<char *>(MIME_TYPES_DESCRIPTION.c_str()); } +#else +char *NPP_GetMIMEDescription(void) +{ + return strdup(MIME_TYPES_DESCRIPTION.c_str()); +} +#endif ////////////////////////////////////// // |