From 99d67df700326d3583c5824c3e5c444c4ae2d900 Mon Sep 17 00:00:00 2001 From: ana Date: Wed, 25 Nov 2015 15:09:22 +0300 Subject: [PATCH] Windows porting and compatibility --- src/Plugins/CMakeLists.txt | 7 ------- src/Plugins/JSONReader/JSONParser/vtkJSONParser.cxx | 11 ++++++++--- src/Plugins/JSONReader/JSONParser/vtkJSONParser.h | 4 ++-- test/standalone/simple/CMakeLists.txt | 2 +- test/standalone/simple/PyInterp.h | 12 ------------ test/standalone/simple/PyInterp_Utils.h | 4 ++-- 6 files changed, 13 insertions(+), 27 deletions(-) diff --git a/src/Plugins/CMakeLists.txt b/src/Plugins/CMakeLists.txt index 20310a07..2a5d8349 100755 --- a/src/Plugins/CMakeLists.txt +++ b/src/Plugins/CMakeLists.txt @@ -19,13 +19,6 @@ INCLUDE(${PARAVIEW_USE_FILE}) -IF(WIN32) - REMOVE_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0) - IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release") - REMOVE_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0) - ENDIF() -ENDIF() - SET(_subdirs MEDReader # TableReader diff --git a/src/Plugins/JSONReader/JSONParser/vtkJSONParser.cxx b/src/Plugins/JSONReader/JSONParser/vtkJSONParser.cxx index 6a88dd9a..7211fdb0 100644 --- a/src/Plugins/JSONReader/JSONParser/vtkJSONParser.cxx +++ b/src/Plugins/JSONReader/JSONParser/vtkJSONParser.cxx @@ -33,6 +33,11 @@ //DEBUG macro //#define __DEBUG +#ifdef WIN32 +#include +#define NAN std::numeric_limits::quiet_NaN() +#define isnan _isnan +#endif // Key words #define MD "_metadata" @@ -319,9 +324,9 @@ void vtkJSONParser::finalize( vtkTable *t ) { vtkJSONMap::iterator mit = vl.find(this->ShortNames[col]); if(mit != vl.end()) { newCol->SetValue(row, mit->second); - vl.erase(mit); - delete mit->first; const char* c = mit->first; + vl.erase(mit); + delete c; c = 0; row++; } else { @@ -723,7 +728,7 @@ char* vtkJSONParser::getString(long b, long e) { long old_pos = ftell(this->File); fseek(this->File, b, SEEK_SET); long data_s = e - b; - result = new char[data_s]; + result = new char[data_s + 1]; // + 1 for the '\0' symbol result[0] = 0; size_t nb_read = fread(result, sizeof(char), data_s, this->File); result[nb_read] = '\0'; diff --git a/src/Plugins/JSONReader/JSONParser/vtkJSONParser.h b/src/Plugins/JSONReader/JSONParser/vtkJSONParser.h index 9ebe61ed..71b00c68 100644 --- a/src/Plugins/JSONReader/JSONParser/vtkJSONParser.h +++ b/src/Plugins/JSONReader/JSONParser/vtkJSONParser.h @@ -34,7 +34,7 @@ class vtkJSONMetaNode; class vtkJSONInfoNode; //--------------------------------------------------- -class vtkJSONException : public std::exception { +class VTK_EXPORT vtkJSONException : public std::exception { public: vtkJSONException(const char *reason); ~vtkJSONException() throw (); @@ -43,7 +43,7 @@ class vtkJSONException : public std::exception { std::string Reason; }; -class vtkJSONParser : public vtkObject +class VTK_EXPORT vtkJSONParser : public vtkObject { public: static vtkJSONParser* New(); diff --git a/test/standalone/simple/CMakeLists.txt b/test/standalone/simple/CMakeLists.txt index 3ae3cecb..9fba773f 100644 --- a/test/standalone/simple/CMakeLists.txt +++ b/test/standalone/simple/CMakeLists.txt @@ -32,5 +32,5 @@ INCLUDE_DIRECTORIES( ) ADD_EXECUTABLE(paraCmdLine ${pl_SOURCES}) -TARGET_LINK_LIBRARIES(paraCmdLine ${PYTHON_LIBRARIES} ${QT_LIBRARIES} pqApplicationComponents) +TARGET_LINK_LIBRARIES(paraCmdLine ${PYTHON_LIBRARIES} ${QT_LIBRARIES} pqApplicationComponents vtkRenderingFreeTypeOpenGL) diff --git a/test/standalone/simple/PyInterp.h b/test/standalone/simple/PyInterp.h index 5bfedf34..7bf63df2 100755 --- a/test/standalone/simple/PyInterp.h +++ b/test/standalone/simple/PyInterp.h @@ -26,18 +26,6 @@ #if !defined ( PYINTERP_H ) #define PYINTERP_H -// ======================================================== -// set dllexport type for Win platform -#ifdef WIN32 -# if defined PYINTERP_EXPORTS || defined PyInterp_EXPORTS -# define PYINTERP_EXPORT __declspec(dllexport) -# else -# define PYINTERP_EXPORT __declspec(dllimport) -# endif -#else // WIN32 -# define PYINTERP_EXPORT -#endif // WIN32 - // ======================================================== // little trick - if we do not have debug python libraries #ifdef _DEBUG diff --git a/test/standalone/simple/PyInterp_Utils.h b/test/standalone/simple/PyInterp_Utils.h index 31bbd9f1..039c1857 100644 --- a/test/standalone/simple/PyInterp_Utils.h +++ b/test/standalone/simple/PyInterp_Utils.h @@ -41,7 +41,7 @@ * When the class is instanciated the lock is acquired. It is released at destruction time. * Copy construction (and hence assignation) is forbidden. */ -class PYINTERP_EXPORT PyLockWrapper +class PyLockWrapper { public: @@ -85,7 +85,7 @@ private: * \class PyObjWrapper * \brief Utility class to properly handle the reference counting required on Python objects. */ -class PYINTERP_EXPORT PyObjWrapper +class PyObjWrapper { PyObject* myObject; public: -- 2.39.2