changeset 4441:453cd3a5a0da

better warning about no support of file ranges in storage area
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 09 Jan 2021 13:13:06 +0100
parents eddb212b2df9
children f77ee6e6cf47
files OrthancServer/Plugins/Engine/OrthancPlugins.cpp
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Fri Jan 08 18:53:33 2021 +0100
+++ b/OrthancServer/Plugins/Engine/OrthancPlugins.cpp	Sat Jan 09 13:13:06 2021 +0100
@@ -369,10 +369,6 @@
         readWhole_(callbacks.readWhole),
         readRange_(callbacks.readRange)
       {
-        if (readRange_)
-        {
-          LOG(WARNING) << "Performance warning: The storage area plugin doesn't implement reading of file ranges";
-        }
       }
 
       virtual void Read(std::string& content,
@@ -410,6 +406,11 @@
       _OrthancPluginRegisterStorageArea2  callbacks2_;
       PluginsErrorDictionary&             errorDictionary_;
 
+      static void WarnNoReadRange()
+      {
+        LOG(WARNING) << "Performance warning: The storage area plugin doesn't implement reading of file ranges";
+      }
+      
     public:
       StorageAreaFactory(SharedLibrary& sharedLibrary,
                          const _OrthancPluginRegisterStorageArea& callbacks,
@@ -419,8 +420,7 @@
         callbacks_(callbacks),
         errorDictionary_(errorDictionary)
       {
-        LOG(WARNING) << "Performance warning: The storage area plugin doesn't "
-                     << "use OrthancPluginRegisterStorageArea2()";
+        WarnNoReadRange();
       }
 
       StorageAreaFactory(SharedLibrary& sharedLibrary,
@@ -431,6 +431,10 @@
         callbacks2_(callbacks),
         errorDictionary_(errorDictionary)
       {
+        if (callbacks.readRange == NULL)
+        {
+          WarnNoReadRange();
+        }
       }
 
       SharedLibrary&  GetSharedLibrary()