Browse Source

version issues with xulrunner api

David Rose 13 years ago
parent
commit
adf5131190
2 changed files with 13 additions and 3 deletions
  1. 6 2
      direct/src/plugin_npapi/startup.cxx
  2. 7 1
      direct/src/plugin_npapi/startup.h

+ 6 - 2
direct/src/plugin_npapi/startup.cxx

@@ -116,9 +116,13 @@ open_logfile() {
 //               get the mimetypes and extensions this plugin is
 //               supposed to handle.
 ////////////////////////////////////////////////////////////////////
-const char*
+#if NP_VERSION_MAJOR == 0 && NP_VERSION_MINOR <= 22
+char *
+#else
+const char *
+#endif
 NP_GetMIMEDescription(void) {
-  return (const char*) "application/x-panda3d:p3d:Panda3D applet;";
+  return "application/x-panda3d:p3d:Panda3D applet;";
 }
 
 ////////////////////////////////////////////////////////////////////

+ 7 - 1
direct/src/plugin_npapi/startup.h

@@ -29,7 +29,13 @@ extern "C" {
                                NPPluginFuncs *pluginFuncs);
 #endif
 
-  const char* NP_GetMIMEDescription(void);
+#if NP_VERSION_MAJOR == 0 && NP_VERSION_MINOR <= 22
+  // Until at least 0.22, this function was declared to return a char *.
+  char *NP_GetMIMEDescription(void);
+#else
+  // At some point after 0.22, it was corrected to return a const char *.
+  const char *NP_GetMIMEDescription(void);
+#endif
   NPError NP_GetValue(void*, NPPVariable variable, void* value);
   NPError OSCALL NP_GetEntryPoints(NPPluginFuncs *pluginFuncs);
   NPError OSCALL NP_Shutdown(void);