[vlc-commits] npapi: Changed files to be compilable by VC.

Sergey Radionov git at videolan.org
Mon Nov 21 18:27:23 CET 2011


npapi-vlc | branch: master | Sergey Radionov <RSATom at gmail.com> | Fri Nov 18 09:19:38 2011 +0700| [4b619ef462ded4ee55b0c1b05493bf12576c74f7] | committer: Rafaël Carré

npapi: Changed files to be compilable by VC.

Signed-off-by: Rafaël Carré <funman at videolan.org>

> http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=4b619ef462ded4ee55b0c1b05493bf12576c74f7
---

 npapi/control/npolibvlc.cpp |    5 +++--
 npapi/control/nporuntime.h  |    6 +++++-
 npapi/control/position.h    |    4 ++++
 npapi/support/npwin.cpp     |    5 +----
 npapi/vlcplugin.cpp         |    8 ++++++++
 npapi/vlcplugin.h           |   10 +++++++++-
 6 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/npapi/control/npolibvlc.cpp b/npapi/control/npolibvlc.cpp
index 515c459..a8a94f6 100644
--- a/npapi/control/npolibvlc.cpp
+++ b/npapi/control/npolibvlc.cpp
@@ -1871,12 +1871,13 @@ LibvlcLogoNPObject::invoke(int index, const NPVariant *args,
     return INVOKERESULT_NO_ERROR;
 }
 
-
+// MSVC++ doesn't support zero length arrays, so insert dummy "0"
 const NPUTF8 * const LibvlcDeinterlaceNPObject::propertyNames[] = {
+    0
 };
 enum LibvlcDeinterlaceNPObjectPropertyIds {
 };
-COUNTNAMES(LibvlcDeinterlaceNPObject,propertyCount,propertyNames);
+const int LibvlcDeinterlaceNPObject::propertyCount=0;
 
 RuntimeNPObject::InvokeResult
 LibvlcDeinterlaceNPObject::getProperty(int index, NPVariant &result)
diff --git a/npapi/control/nporuntime.h b/npapi/control/nporuntime.h
index fe9bfc6..799111a 100644
--- a/npapi/control/nporuntime.h
+++ b/npapi/control/nporuntime.h
@@ -29,7 +29,11 @@
 ** support framework for runtime script objects
 */
 
-#include <npapi.h>
+//on windows, to avoid including <npapi.h> 
+//from Microsoft SDK (rather then from Mozilla SDK),
+//#include it indirectly via <npfunctions.h>
+#include <npfunctions.h>
+
 #include <npruntime.h>
 
 static void RuntimeNPClassDeallocate(NPObject *npobj);
diff --git a/npapi/control/position.h b/npapi/control/position.h
index ec1c7f8..1081830 100644
--- a/npapi/control/position.h
+++ b/npapi/control/position.h
@@ -22,6 +22,10 @@
 #ifndef POSITION_H
 #define POSITION_H
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 struct posidx_s { const char *n; size_t i; };
 static const posidx_s posidx[] = {
     { "center",        0 },
diff --git a/npapi/support/npwin.cpp b/npapi/support/npwin.cpp
index 7fe6d31..a189cc1 100644
--- a/npapi/support/npwin.cpp
+++ b/npapi/support/npwin.cpp
@@ -34,13 +34,10 @@
 
 #include "../vlcplugin.h"
 
-#ifndef _NPAPI_H_
-#   include "npapi.h"
-#endif
 #if (((NP_VERSION_MAJOR << 8) + NP_VERSION_MINOR) < 20)
 #include "npupp.h"
 #else
-#include "npfunctions.h"
+#include <npfunctions.h>
 #endif
 
 #include "../vlcshell.h"
diff --git a/npapi/vlcplugin.cpp b/npapi/vlcplugin.cpp
index 41c5e83..b27f97c 100644
--- a/npapi/vlcplugin.cpp
+++ b/npapi/vlcplugin.cpp
@@ -26,6 +26,10 @@
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include "vlcplugin.h"
 
 #include "control/npolibvlc.h"
@@ -443,7 +447,11 @@ void VlcPlugin::event_callback(const libvlc_event_t* event,
     plugin->events.callback(event, npparams, npcount);
     NPN_PluginThreadAsyncCall(plugin->getBrowser(), eventAsync, plugin);
 #else
+#ifdef _MSC_VER
+#pragma message("NPN_PluginThreadAsyncCall not implemented yet.")
+#else
 #warning NPN_PluginThreadAsyncCall not implemented yet.
+#endif //_MSC_VER
     printf("No NPN_PluginThreadAsyncCall(), doing nothing.\n");
 #endif
 }
diff --git a/npapi/vlcplugin.h b/npapi/vlcplugin.h
index 8b4a566..4e80603 100644
--- a/npapi/vlcplugin.h
+++ b/npapi/vlcplugin.h
@@ -29,6 +29,10 @@
 #ifndef __VLCPLUGIN_H__
 #define __VLCPLUGIN_H__
 
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 
 // Setup XP_MACOSX, XP_UNIX, XP_WIN
@@ -80,7 +84,11 @@
 
 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
 
-#include <npapi.h>
+//on windows, to avoid including <npapi.h> 
+//from Microsoft SDK (rather then from Mozilla SDK),
+//#include it indirectly via <npfunctions.h>
+#include <npfunctions.h>
+
 #include <vector>
 #include <assert.h>
 



More information about the vlc-commits mailing list