changeset 72:f2f8f8714dcc

sync
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 13 Aug 2015 12:53:41 +0200
parents 9bb7caee0509
children 465bed3c5c81
files Orthanc/Core/Enumerations.h Orthanc/Core/Logging.h
diffstat 2 files changed, 41 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/Orthanc/Core/Enumerations.h	Sat Aug 08 11:23:39 2015 +0200
+++ b/Orthanc/Core/Enumerations.h	Thu Aug 13 12:53:41 2015 +0200
@@ -239,6 +239,15 @@
   };
 
 
+  // https://en.wikipedia.org/wiki/HTTP_compression
+  enum HttpCompression
+  {
+    HttpCompression_None,
+    HttpCompression_Deflate,
+    HttpCompression_Gzip
+  };
+
+
   // http://www.dabsoft.ch/dicom/3/C.12.1.1.2/
   enum Encoding
   {
@@ -300,8 +309,23 @@
 
   enum CompressionType
   {
+    /**
+     * Buffer/file that is stored as-is, in a raw fashion, without
+     * compression.
+     **/
     CompressionType_None = 1,
-    CompressionType_Zlib = 2
+
+    /**
+     * Buffer that is compressed using the "deflate" algorithm (RFC
+     * 1951), wrapped inside the zlib data format (RFC 1950), prefixed
+     * with a "uint64_t" (8 bytes) that encodes the size of the
+     * uncompressed buffer. If the compressed buffer is empty, its
+     * represents an empty uncompressed buffer. This format is
+     * internal to Orthanc. If the 8 first bytes are skipped AND the
+     * buffer is non-empty, the buffer is compatible with the
+     * "deflate" HTTP compression.
+     **/
+    CompressionType_ZlibWithSize = 2
   };
 
   enum FileContentType
--- a/Orthanc/Core/Logging.h	Sat Aug 08 11:23:39 2015 +0200
+++ b/Orthanc/Core/Logging.h	Thu Aug 13 12:53:41 2015 +0200
@@ -35,12 +35,12 @@
 #if ORTHANC_ENABLE_LOGGING == 1
 
 #if ORTHANC_ENABLE_GOOGLE_LOG == 1
-#  include <stdlib.h>  // This fixes a problem in glog for recent releases of MinGW
+#  include <stdlib.h>  // Including this fixes a problem in glog for recent releases of MinGW
 #  include <glog/logging.h>
 #else
 #  include <iostream>
 #  include <boost/thread/mutex.hpp>
-#  define LOG(level)  ::Orthanc::Logging::InternalLogger(#level, __FILE__, __LINE__)
+#  define LOG(level)  ::Orthanc::Logging::InternalLogger(#level,  __FILE__, __LINE__)
 #  define VLOG(level) ::Orthanc::Logging::InternalLogger("TRACE", __FILE__, __LINE__)
 #endif
 
@@ -59,28 +59,30 @@
 
     void SetTargetFolder(const std::string& path);
 
+#if ORTHANC_ENABLE_GOOGLE_LOG != 1
+    struct NullStream : public std::ostream 
+    {
+      NullStream() : 
+        std::ios(0), 
+        std::ostream(0)
+      {
+      }
+    };
 
-#if ORTHANC_ENABLE_GOOGLE_LOG != 1
     class InternalLogger
     {
     private:
-      boost::mutex::scoped_lock  lock_;
-      std::ostream*              stream_;
+      boost::mutex::scoped_lock lock_;
+      NullStream                null_;
+      std::ostream*             stream_;
 
     public:
       InternalLogger(const char* level,
                      const char* file,
                      int line);
 
-      ~InternalLogger()
-      {
-#if defined(_WIN32)
-        *stream_ << "\r\n";
-#else
-        *stream_ << "\n";
-#endif
-      }
-
+      ~InternalLogger();
+      
       std::ostream& operator<< (const std::string& message)
       {
         return (*stream_) << message;