changeset 85:581937911d14

merge
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 13 Oct 2015 17:51:49 +0200
parents 02708dbbe449 (current diff) 16e247e407d9 (diff)
children c44ab3266343
files Orthanc/Core/Enumerations.cpp Orthanc/Core/Enumerations.h Orthanc/Core/SQLite/Connection.h Resources/SyncOrthancFolder.py
diffstat 5 files changed, 62 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Orthanc/Core/Enumerations.cpp	Tue Oct 13 17:49:27 2015 +0200
+++ b/Orthanc/Core/Enumerations.cpp	Tue Oct 13 17:51:49 2015 +0200
@@ -313,8 +313,21 @@
       case ErrorCode_DatabaseNotInitialized:
         return "Plugin trying to call the database during its initialization";
 
+      case ErrorCode_SslDisabled:
+        return "Orthanc has been built without SSL support";
+
+      case ErrorCode_CannotOrderSlices:
+        return "Unable to order the slices of the series";
+
       default:
-        return "Unknown error code";
+        if (error >= ErrorCode_START_PLUGINS)
+        {
+          return "Error encountered within some plugin";
+        }
+        else
+        {
+          return "Unknown error code";
+        }
     }
   }
 
--- a/Orthanc/Core/Enumerations.h	Tue Oct 13 17:49:27 2015 +0200
+++ b/Orthanc/Core/Enumerations.h	Tue Oct 13 17:51:49 2015 +0200
@@ -134,6 +134,8 @@
     ErrorCode_StorageAreaAlreadyRegistered = 2036    /*!< Another plugin has already registered a custom storage area */,
     ErrorCode_DatabaseBackendAlreadyRegistered = 2037    /*!< Another plugin has already registered a custom database back-end */,
     ErrorCode_DatabaseNotInitialized = 2038    /*!< Plugin trying to call the database during its initialization */,
+    ErrorCode_SslDisabled = 2039    /*!< Orthanc has been built without SSL support */,
+    ErrorCode_CannotOrderSlices = 2040    /*!< Unable to order the slices of the series */,
     ErrorCode_START_PLUGINS = 1000000
   };
 
--- a/Orthanc/Core/SQLite/Connection.h	Tue Oct 13 17:49:27 2015 +0200
+++ b/Orthanc/Core/SQLite/Connection.h	Tue Oct 13 17:51:49 2015 +0200
@@ -46,7 +46,7 @@
 struct sqlite3;
 struct sqlite3_stmt;
 
-#define SQLITE_FROM_HERE SQLite::StatementId(__FILE__, __LINE__)
+#define SQLITE_FROM_HERE ::Orthanc::SQLite::StatementId(__FILE__, __LINE__)
 
 namespace Orthanc
 {
--- a/Orthanc/Core/Toolbox.cpp	Tue Oct 13 17:49:27 2015 +0200
+++ b/Orthanc/Core/Toolbox.cpp	Tue Oct 13 17:51:49 2015 +0200
@@ -468,9 +468,13 @@
     assert(value < 16);
 
     if (value < 10)
+    {
       return value + '0';
+    }
     else
+    {
       return (value - 10) + 'a';
+    }
   }
 
 
@@ -508,8 +512,8 @@
     result.resize(32);
     for (unsigned int i = 0; i < 16; i++)
     {
-      result[2 * i] = GetHexadecimalCharacter(actualHash[i] / 16);
-      result[2 * i + 1] = GetHexadecimalCharacter(actualHash[i] % 16);
+      result[2 * i] = GetHexadecimalCharacter(static_cast<uint8_t>(actualHash[i] / 16));
+      result[2 * i + 1] = GetHexadecimalCharacter(static_cast<uint8_t>(actualHash[i] % 16));
     }
   }
 #endif
--- a/Resources/SyncOrthancFolder.py	Tue Oct 13 17:49:27 2015 +0200
+++ b/Resources/SyncOrthancFolder.py	Tue Oct 13 17:51:49 2015 +0200
@@ -5,15 +5,14 @@
 # to match the latest version of the Orthanc source code.
 #
 
+import multiprocessing
 import os
-import shutil
+import stat
 import urllib2
 
+TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc')
 PLUGIN_SDK_VERSION = '0.9.4'
-
-SOURCE = '/home/jodogne/Subversion/orthanc'
-TARGET = os.path.join(os.path.dirname(__file__), '..', 'Orthanc')
-REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw/Orthanc-%s/Plugins/Include' % PLUGIN_SDK_VERSION
+REPOSITORY = 'https://bitbucket.org/sjodogne/orthanc/raw'
 
 FILES = [
     'Core/ChunkedBuffer.cpp',
@@ -80,23 +79,46 @@
     'orthanc/OrthancCPlugin.h',
 ]   
 
-for f in FILES:
-    source = os.path.join(SOURCE, f)
-    target = os.path.join(TARGET, f)
+EXE = [
+    'Resources/EmbedResources.py',
+    'Resources/WindowsResources.py',
+]
+
+
+def Download(x):
+    branch = x[0]
+    source = x[1]
+    target = os.path.join(TARGET, x[2])
+    print target
+
     try:
         os.makedirs(os.path.dirname(target))
     except:
         pass
 
-    shutil.copy(source, target)
+    url = '%s/%s/%s' % (REPOSITORY, branch, source)
+
+    with open(target, 'w') as f:
+        f.write(urllib2.urlopen(url).read())
+
+
+commands = []
+
+for f in FILES:
+    commands.append([ 'default', f, f ])
 
 for f in SDK:
-    source = '%s/%s' % (REPOSITORY, f)
-    target = os.path.join(TARGET, 'Sdk-%s' % PLUGIN_SDK_VERSION, f)
-    try:
-        os.makedirs(os.path.dirname(target))
-    except:
-        pass
+    commands.append([ 'Orthanc-%s' % PLUGIN_SDK_VERSION, 
+                      'Plugins/Include/%s' % f,
+                      'Sdk-%s/%s' % (PLUGIN_SDK_VERSION, f) ])
+
 
-    with open(target, 'w') as g:
-        g.write(urllib2.urlopen(source).read())
+pool = multiprocessing.Pool(10)  # simultaneous downloads
+pool.map(Download, commands)
+
+
+for exe in EXE:
+    path = os.path.join(TARGET, exe)
+    st = os.stat(path)
+    os.chmod(path, st.st_mode | stat.S_IEXEC)
+