]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rocksdb/port/win/xpress_win.cc
import quincy beta 17.1.0
[ceph.git] / ceph / src / rocksdb / port / win / xpress_win.cc
index bcc106534d7ebee141635613f01a82e51cab116c..9039ec89b5f58062cacf8ecc758f3274db57d599 100644 (file)
@@ -7,6 +7,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file. See the AUTHORS file for names of contributors.
 
+#if defined(OS_WIN)
+
 #include "port/win/xpress_win.h"
 #include <windows.h>
 
@@ -127,10 +129,9 @@ bool Compress(const char* input, size_t length, std::string* output) {
 }
 
 char* Decompress(const char* input_data, size_t input_length,
-  int* decompress_size) {
-
+                 size_t* uncompressed_size) {
   assert(input_data != nullptr);
-  assert(decompress_size != nullptr);
+  assert(uncompressed_size != nullptr);
 
   if (input_length == 0) {
     return nullptr;
@@ -183,14 +184,6 @@ char* Decompress(const char* input_data, size_t input_length,
 
   assert(decompressedBufferSize > 0);
 
-  // On Windows we are limited to a 32-bit int for the
-  // output data size argument
-  // so we hopefully never get here
-  if (decompressedBufferSize > std::numeric_limits<int>::max()) {
-    assert(false);
-    return nullptr;
-  }
-
   // The callers are deallocating using delete[]
   // thus we must allocate with new[]
   std::unique_ptr<char[]> outputBuffer(new char[decompressedBufferSize]);
@@ -214,7 +207,7 @@ char* Decompress(const char* input_data, size_t input_length,
     return nullptr;
   }
 
-  *decompress_size = static_cast<int>(decompressedDataSize);
+  *uncompressed_size = decompressedDataSize;
 
   // Return the raw buffer to the caller supporting the tradition
   return outputBuffer.release();
@@ -224,3 +217,5 @@ char* Decompress(const char* input_data, size_t input_length,
 }  // namespace ROCKSDB_NAMESPACE
 
 #endif
+
+#endif