changeset 98:baf715163ca1

simplification
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 25 Mar 2016 18:05:00 +0100
parents cb186b8bf94f
children db42bf101349
files Core/PostgreSQLConnection.h Core/PostgreSQLResult.cpp Core/PostgreSQLStatement.cpp Orthanc/Core/Endianness.h Orthanc/Resources/CMake/BoostConfiguration.cmake Resources/SyncOrthancFolder.py
diffstat 6 files changed, 115 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/Core/PostgreSQLConnection.h	Fri Feb 12 17:27:37 2016 +0100
+++ b/Core/PostgreSQLConnection.h	Fri Mar 25 18:05:00 2016 +0100
@@ -20,18 +20,6 @@
 
 #pragma once
 
-#if defined(_WIN32)
-#include <winsock2.h>
-#  if defined(_MSC_VER)   // In Windows, "host" can only be little-endian
-//   http://msdn.microsoft.com/en-us/library/a3140177.aspx
-#    define htobe32(x) _byteswap_ulong(x)
-#    define htobe64(x) _byteswap_uint64(x)
-#  else   // MinGW
-#    define htobe32(x) __builtin_bswap32(x)
-#    define htobe64(x) __builtin_bswap64(x)
-#  endif
-#endif
-
 #include <string>
 #include <boost/noncopyable.hpp>
 #include <stdint.h>
--- a/Core/PostgreSQLResult.cpp	Fri Feb 12 17:27:37 2016 +0100
+++ b/Core/PostgreSQLResult.cpp	Fri Mar 25 18:05:00 2016 +0100
@@ -30,13 +30,7 @@
 #include <c.h>
 #include <catalog/pg_type.h>
 
-#if defined(__FreeBSD__)
-#  include <arpa/inet.h>    // ntohl()
-#elif defined(__APPLE__)
-#  include <libkern/OSByteOrder.h>
-#  define htobe32(x) OSSwapHostToBigInt32(x)
-#  define htobe64(x) OSSwapHostToBigInt64(x)
-#endif
+#include "../Orthanc/Core/Endianness.h"
 
 
 namespace OrthancPlugins
--- a/Core/PostgreSQLStatement.cpp	Fri Feb 12 17:27:37 2016 +0100
+++ b/Core/PostgreSQLStatement.cpp	Fri Mar 25 18:05:00 2016 +0100
@@ -30,11 +30,7 @@
 #include <c.h>
 #include <catalog/pg_type.h>
 
-#if defined(__APPLE__)
-#  include <libkern/OSByteOrder.h>
-#  define htobe32(x) OSSwapHostToBigInt32(x)
-#  define htobe64(x) OSSwapHostToBigInt64(x)
-#endif
+#include "../Orthanc/Core/Endianness.h"
 
 
 namespace OrthancPlugins
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Orthanc/Core/Endianness.h	Fri Mar 25 18:05:00 2016 +0100
@@ -0,0 +1,107 @@
+/**
+ * Orthanc - A Lightweight, RESTful DICOM Store
+ * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
+ * Department, University Hospital of Liege, Belgium
+ *
+ * This program is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * In addition, as a special exception, the copyright holders of this
+ * program give permission to link the code of its release with the
+ * OpenSSL project's "OpenSSL" library (or with modified versions of it
+ * that use the same license as the "OpenSSL" library), and distribute
+ * the linked executables. You must obey the GNU General Public License
+ * in all respects for all of the code used other than "OpenSSL". If you
+ * modify file(s) with this exception, you may extend this exception to
+ * your version of the file(s), but you are not obligated to do so. If
+ * you do not wish to do so, delete this exception statement from your
+ * version. If you delete this exception statement from all source files
+ * in the program, then also delete it here.
+ * 
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ **/
+
+
+#pragma once
+
+
+/********************************************************************
+ ** LINUX ARCHITECTURES
+ ********************************************************************/
+
+#if defined(__linux)
+#  include <endian.h>
+#endif
+
+
+/********************************************************************
+ ** WINDOWS ARCHITECTURES
+ **
+ ** On Windows, "host" will always be little-endian ("le").
+ ********************************************************************/
+
+#if defined(_WIN32)
+#  if defined(_MSC_VER)
+//   http://msdn.microsoft.com/en-us/library/a3140177.aspx
+#    define be16toh(x) _byteswap_ushort(x)
+#    define be32toh(x) _byteswap_ulong(x)
+#    define be64toh(x) _byteswap_uint64(x)
+#  else   // MinGW
+#    define be16toh(x) __builtin_bswap16(x)
+#    define be32toh(x) __builtin_bswap32(x)
+#    define be64toh(x) __builtin_bswap64(x)
+#  endif
+
+#  define htobe16(x) be16toh(x)
+#  define htobe32(x) be32toh(x)
+#  define htobe64(x) be64toh(x)
+
+#  define htole16(x) x
+#  define htole32(x) x
+#  define htole64(x) x
+
+#  define le16toh(x) x
+#  define le32toh(x) x
+#  define le64toh(x) x
+#endif
+
+
+/********************************************************************
+ ** FREEBSD ARCHITECTURES
+ ********************************************************************/
+
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+#  include <arpa/inet.h>
+#endif
+
+
+/********************************************************************
+ ** APPLE ARCHITECTURES (including OS X)
+ ********************************************************************/
+
+#if defined(__APPLE__)
+#  include <libkern/OSByteOrder.h>
+#  define be16toh(x) OSSwapBigToHostInt16(x)
+#  define be32toh(x) OSSwapBigToHostInt32(x)
+#  define be64toh(x) OSSwapBigToHostInt64(x)
+
+#  define htobe16(x) OSSwapHostToBigInt16(x)
+#  define htobe32(x) OSSwapHostToBigInt32(x)
+#  define htobe64(x) OSSwapHostToBigInt64(x)
+
+#  define htole16(x) OSSwapHostToLittleInt16(x)
+#  define htole32(x) OSSwapHostToLittleInt32(x)
+#  define htole64(x) OSSwapHostToLittleInt64(x)
+
+#  define le16toh(x) OSSwapLittleToHostInt16(x)
+#  define le32toh(x) OSSwapLittleToHostInt32(x)
+#  define le64toh(x) OSSwapLittleToHostInt64(x)
+#endif
--- a/Orthanc/Resources/CMake/BoostConfiguration.cmake	Fri Feb 12 17:27:37 2016 +0100
+++ b/Orthanc/Resources/CMake/BoostConfiguration.cmake	Fri Mar 25 18:05:00 2016 +0100
@@ -8,7 +8,7 @@
   #set(Boost_USE_STATIC_LIBS ON)
 
   find_package(Boost
-    COMPONENTS filesystem thread system date_time regex locale)
+    COMPONENTS filesystem thread system date_time regex locale ${ORTHANC_BOOST_COMPONENTS})
 
   if (NOT Boost_FOUND)
     message(FATAL_ERROR "Unable to locate Boost on this system")
@@ -39,10 +39,10 @@
 
 
 if (BOOST_STATIC)
-  # Parameters for Boost 1.59.0
-  set(BOOST_NAME boost_1_59_0)
-  set(BOOST_BCP_SUFFIX bcpdigest-0.9.5)
-  set(BOOST_MD5 "08abb7cdbea0b380f9ab0d5cce476f12")
+  # Parameters for Boost 1.60.0
+  set(BOOST_NAME boost_1_60_0)
+  set(BOOST_BCP_SUFFIX bcpdigest-1.0.1)
+  set(BOOST_MD5 "0646971514a1e012fbe382c5662a8605")
   set(BOOST_URL "http://www.montefiore.ulg.ac.be/~jodogne/Orthanc/ThirdPartyDownloads/${BOOST_NAME}_${BOOST_BCP_SUFFIX}.tar.gz")
   set(BOOST_FILESYSTEM_SOURCES_DIR "${BOOST_NAME}/libs/filesystem/src") 
   set(BOOST_SOURCES_DIR ${CMAKE_BINARY_DIR}/${BOOST_NAME})
--- a/Resources/SyncOrthancFolder.py	Fri Feb 12 17:27:37 2016 +0100
+++ b/Resources/SyncOrthancFolder.py	Fri Mar 25 18:05:00 2016 +0100
@@ -15,6 +15,7 @@
 REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw'
 
 FILES = [
+    'Core/Endianness.h',
     'Plugins/Samples/Common/ExportedSymbols.list',
     'Plugins/Samples/Common/VersionScript.map',
     'Resources/CMake/AutoGeneratedCode.cmake',