Description: Replace macro "__linux" (now obsolete) with "__linux__"
Author: Sebastien Jodogne <s.jodogne@gmail.com>
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: Orthanc-1.0.0/Core/MultiThreading/Mutex.cpp
===================================================================
--- Orthanc-1.0.0.orig/Core/MultiThreading/Mutex.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/Core/MultiThreading/Mutex.cpp	2016-04-14 18:10:03.702461024 +0200
@@ -37,7 +37,7 @@
 
 #if defined(_WIN32)
 #include <windows.h>
-#elif defined(__linux) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__FreeBSD__)
 #include <pthread.h>
 #else
 #error Support your platform here
@@ -75,7 +75,7 @@
   }
 
 
-#elif defined(__linux) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__APPLE__) || defined(__FreeBSD__)
 
   struct Mutex::PImpl
   {
Index: Orthanc-1.0.0/Core/Toolbox.cpp
===================================================================
--- Orthanc-1.0.0.orig/Core/Toolbox.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/Core/Toolbox.cpp	2016-04-14 18:10:19.070461648 +0200
@@ -67,7 +67,7 @@
 #include <limits.h>      /* PATH_MAX */
 #endif
 
-#if defined(__linux) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
 #include <limits.h>      /* PATH_MAX */
 #include <signal.h>
 #include <unistd.h>
@@ -131,7 +131,7 @@
   {
 #if defined(_WIN32)
     ::Sleep(static_cast<DWORD>(microSeconds / static_cast<uint64_t>(1000)));
-#elif defined(__linux) || defined(__APPLE__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
     usleep(microSeconds);
 #else
 #error Support your platform here
@@ -576,7 +576,7 @@
     return std::string(&buffer[0]);
   }
 
-#elif defined(__linux) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
   static std::string GetPathToExecutableInternal()
   {
     std::vector<char> buffer(PATH_MAX + 1);
Index: Orthanc-1.0.0/OrthancServer/DicomProtocol/DicomServer.cpp
===================================================================
--- Orthanc-1.0.0.orig/OrthancServer/DicomProtocol/DicomServer.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/OrthancServer/DicomProtocol/DicomServer.cpp	2016-04-14 18:10:05.646461103 +0200
@@ -44,7 +44,7 @@
 
 #include <boost/thread.hpp>
 
-#if defined(__linux)
+#if defined(__linux__)
 #include <cstdlib>
 #endif
 
Index: Orthanc-1.0.0/OrthancServer/FromDcmtkBridge.cpp
===================================================================
--- Orthanc-1.0.0.orig/OrthancServer/FromDcmtkBridge.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/OrthancServer/FromDcmtkBridge.cpp	2016-04-14 18:09:53.798460621 +0200
@@ -208,7 +208,7 @@
       LoadEmbeddedDictionary(*locker, EmbeddedResources::DICTIONARY_DICOM);
       LoadEmbeddedDictionary(*locker, EmbeddedResources::DICTIONARY_PRIVATE);
 
-#elif defined(__linux) || defined(__FreeBSD_kernel__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__)
       std::string path = DCMTK_DICTIONARY_DIR;
 
       const char* env = std::getenv(DCM_DICT_ENVIRONMENT_VARIABLE);
Index: Orthanc-1.0.0/Plugins/Engine/PluginsManager.cpp
===================================================================
--- Orthanc-1.0.0.orig/Plugins/Engine/PluginsManager.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/Plugins/Engine/PluginsManager.cpp	2016-04-14 18:10:07.934461196 +0200
@@ -48,7 +48,7 @@
 
 #ifdef WIN32
 #define PLUGIN_EXTENSION ".dll"
-#elif defined(__linux) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
 #define PLUGIN_EXTENSION ".so"
 #elif defined(__APPLE__) && defined(__MACH__)
 #define PLUGIN_EXTENSION ".dylib"
Index: Orthanc-1.0.0/Plugins/Engine/SharedLibrary.cpp
===================================================================
--- Orthanc-1.0.0.orig/Plugins/Engine/SharedLibrary.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/Plugins/Engine/SharedLibrary.cpp	2016-04-14 18:09:57.666460778 +0200
@@ -45,7 +45,7 @@
 
 #if defined(_WIN32)
 #include <windows.h>
-#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
 #include <dlfcn.h>
 #else
 #error Support your platform here
@@ -65,7 +65,7 @@
       throw OrthancException(ErrorCode_SharedLibrary);
     }
 
-#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
     handle_ = ::dlopen(path_.c_str(), RTLD_NOW);
     if (handle_ == NULL) 
     {
@@ -91,7 +91,7 @@
     {
 #if defined(_WIN32)
       ::FreeLibrary((HMODULE)handle_);
-#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
       ::dlclose(handle_);
 #else
 #error Support your platform here
@@ -109,7 +109,7 @@
 
 #if defined(_WIN32)
     return ::GetProcAddress((HMODULE)handle_, name.c_str());
-#elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
+#elif defined(__linux__) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
     return ::dlsym(handle_, name.c_str());
 #else
 #error Support your platform here
Index: Orthanc-1.0.0/Resources/Patches/mongoose-3.1-patch.diff
===================================================================
--- Orthanc-1.0.0.orig/Resources/Patches/mongoose-3.1-patch.diff	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/Resources/Patches/mongoose-3.1-patch.diff	2016-04-14 18:10:01.286460925 +0200
@@ -42,7 +42,7 @@
  
    // Wait until mg_fini() stops
    while (ctx->stop_flag != 2) {
-+#if defined(__linux)
++#if defined(__linux__)
 +    usleep(100000);
 +#elif defined(_WIN32)
 +    Sleep(100);
Index: Orthanc-1.0.0/UnitTestsSources/PluginsTests.cpp
===================================================================
--- Orthanc-1.0.0.orig/UnitTestsSources/PluginsTests.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/UnitTestsSources/PluginsTests.cpp	2016-04-14 18:09:59.746460863 +0200
@@ -57,7 +57,7 @@
   ASSERT_TRUE(l.HasFunction("GetVersionExW"));
   ASSERT_FALSE(l.HasFunction("world"));
 
-#elif defined(__linux) || defined(__FreeBSD_kernel__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__)
   SharedLibrary l("libdl.so");
   ASSERT_THROW(l.GetFunction("world"), OrthancException);
   ASSERT_TRUE(l.GetFunction("dlopen") != NULL);
Index: Orthanc-1.0.0/UnitTestsSources/UnitTestsMain.cpp
===================================================================
--- Orthanc-1.0.0.orig/UnitTestsSources/UnitTestsMain.cpp	2015-12-15 17:49:02.000000000 +0100
+++ Orthanc-1.0.0/UnitTestsSources/UnitTestsMain.cpp	2016-04-14 18:10:12.014461361 +0200
@@ -458,7 +458,7 @@
 }
 
 
-#if defined(__linux)
+#if defined(__linux__)
 TEST(OrthancInitialization, AbsoluteDirectory)
 {
   ASSERT_EQ("/tmp/hello", Configuration::InterpretRelativePath("/tmp", "hello"));
@@ -622,7 +622,7 @@
 
 
 
-#if defined(__linux)
+#if defined(__linux__)
 #include <endian.h>
 #elif defined(__FreeBSD__)
 #include <machine/endian.h>
@@ -647,7 +647,7 @@
    * Linux.
    **/
   
-#elif defined(__linux) || defined(__FreeBSD_kernel__)
+#elif defined(__linux__) || defined(__FreeBSD_kernel__)
 
 #if !defined(__BYTE_ORDER)
 #  error Support your platform here
