This file is part of MXE. See index.html for further information. From 5c1a9928d925dacebb56f191fec349077c750dbf Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Fri, 23 Nov 2012 08:41:43 +0100 Subject: [PATCH 1/2] build as static lib taken from: http://sourceforge.net/mailarchive/forum.php?thread_name=4E1DBC0D.10000%40jrit.at&forum_name=qjson-devel diff --git a/CMakeLists.txt b/CMakeLists.txt index 07d84c6..3aee52d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,13 @@ SET(FRAMEWORK_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/Library/Frameworks" # (This will have no effect with CMake < 2.8) SET(QT_USE_IMPORTED_TARGETS TRUE) +# For Static builds +IF(LIBTYPE STREQUAL "STATIC") + ADD_DEFINITIONS("-DQJSON_STATIC") + ADD_DEFINITIONS("-DQT_NODLL") + SET(PKG_CONFIG_CFLAGS -DQJSON_STATIC ${PKG_CONFIG_CFLAGS}) +endif() + # Find Qt4 FIND_PACKAGE( Qt4 REQUIRED ) diff --git a/QJson.pc.in b/QJson.pc.in index e4704bd..bf5fd01 100644 --- a/QJson.pc.in +++ b/QJson.pc.in @@ -8,4 +8,4 @@ Description: QJson is a qt-based library that maps JSON data to QVariant objects Version: @QJSON_LIB_MAJOR_VERSION@.@QJSON_LIB_MINOR_VERSION@.@QJSON_LIB_PATCH_VERSION@ Requires: QtCore Libs: -L${libdir} -lqjson -Cflags: -I${includedir} \ No newline at end of file +Cflags: -I${includedir} @PKG_CONFIG_CFLAGS@ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e2e8a13..c164b04 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,7 +15,12 @@ qt4_wrap_cpp(qjson_MOC_SRCS ${qjson_MOC_HDRS}) set (qjson_SRCS parser.cpp qobjecthelper.cpp json_scanner.cpp json_parser.cc parserrunnable.cpp serializer.cpp serializerrunnable.cpp) set (qjson_HEADERS parser.h parserrunnable.h qobjecthelper.h serializer.h serializerrunnable.h qjson_export.h) -add_library (qjson SHARED ${qjson_SRCS} ${qjson_MOC_SRCS} ${qjson_HEADERS}) +IF(LIBTYPE STREQUAL "STATIC") + add_library (qjson STATIC ${qjson_SRCS} ${qjson_MOC_SRCS} ${qjson_HEADERS}) +else() + add_library (qjson SHARED ${qjson_SRCS} ${qjson_MOC_SRCS} ${qjson_HEADERS}) +endif() + target_link_libraries( qjson ${QT_LIBRARIES}) if(NOT android) diff --git a/src/qjson_export.h b/src/qjson_export.h index 9a807b9..7e6646a 100644 --- a/src/qjson_export.h +++ b/src/qjson_export.h @@ -23,7 +23,9 @@ #include #ifndef QJSON_EXPORT -# if defined(QJSON_MAKEDLL) +# ifdef QJSON_STATIC +# define QJSON_EXPORT +# elif defined(QJSON_MAKEDLL) /* We are building this library */ # define QJSON_EXPORT Q_DECL_EXPORT # else -- 1.7.10.4 From dbe71952b8b91359172f7f253a7cc07c1e746443 Mon Sep 17 00:00:00 2001 From: Flavio Castelli Date: Thu, 22 Nov 2012 21:19:15 +0100 Subject: [PATCH 2/2] Fix unsafe pointer usage in Serializer::serialize(). This fixes issue #3. (cherry picked from commit 56701d72da8a57a64522ff455d7aa460033398a9) diff --git a/ChangeLog b/ChangeLog index fa16030..6ae4d9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Nov 22 21:20:11 CET 2012 Flavio Castelli + + * Fix unsafe pointer usage in Serializer::serialize() + ---------------------------------------------------------------------- Wed Nov 21 22:01:51 CET 2012 Flavio Castelli diff --git a/src/serializer.cpp b/src/serializer.cpp index 4ff3d54..b88827d 100644 --- a/src/serializer.cpp +++ b/src/serializer.cpp @@ -368,12 +368,12 @@ void Serializer::serialize( const QVariant& v, QIODevice* io, bool* ok) QByteArray Serializer::serialize( const QVariant &v, bool *ok) { + bool _ok = true; d->errorMessage.clear(); if (ok) { *ok = true; } else { - bool _ok = true; ok = &_ok; } -- 1.7.10.4