You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ko...@apache.org on 2019/03/03 06:00:46 UTC

[arrow] branch master updated: ARROW-4744: [C++][CI] Change mingw builds back to debug. Cleanup up some version warnings

This is an automated email from the ASF dual-hosted git repository.

kou pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new b1edd3e  ARROW-4744: [C++][CI] Change mingw builds back to debug.  Cleanup up some version warnings
b1edd3e is described below

commit b1edd3ed172ca13898a58ff71cdf6e714ac249b1
Author: Micah Kornfield <em...@gmail.com>
AuthorDate: Sun Mar 3 15:00:35 2019 +0900

    ARROW-4744: [C++][CI] Change mingw builds back to debug.  Cleanup up some version warnings
    
    Author: Micah Kornfield <em...@gmail.com>
    
    Closes #3793 from emkornfield/fix_ci and squashes the following commits:
    
    0dd4e6f5 <Micah Kornfield> Change mingw back to release.  Cleanup some more conversion errors
    6b7c1f4e <Micah Kornfield> more brotli fixes
    96e127e1 <Micah Kornfield> Fix other places where cast was happening
    86d16937 <Micah Kornfield> ARROW-4744:  Add static cast to input_len to avoid warning
---
 ci/appveyor-cpp-build-mingw.bat          |  4 ++--
 cpp/src/arrow/type_traits.h              | 14 +++++++-------
 cpp/src/arrow/util/compression_brotli.cc | 19 ++++++++++++-------
 cpp/src/arrow/util/compression_snappy.cc |  4 +++-
 cpp/src/arrow/util/compression_zstd.cc   |  3 ++-
 5 files changed, 26 insertions(+), 18 deletions(-)

diff --git a/ci/appveyor-cpp-build-mingw.bat b/ci/appveyor-cpp-build-mingw.bat
index 249ea1a..bdd3b14 100644
--- a/ci/appveyor-cpp-build-mingw.bat
+++ b/ci/appveyor-cpp-build-mingw.bat
@@ -17,8 +17,8 @@
 
 @echo on
 
-set CMAKE_BUILD_TYPE=debug
-set MESON_BUILD_TYPE=debug
+set CMAKE_BUILD_TYPE=release
+set MESON_BUILD_TYPE=release
 
 set INSTALL_DIR=%HOMEDRIVE%%HOMEPATH%\install
 set PATH=%INSTALL_DIR%\bin;%PATH%
diff --git a/cpp/src/arrow/type_traits.h b/cpp/src/arrow/type_traits.h
index df2cd09..5d3fed3 100644
--- a/cpp/src/arrow/type_traits.h
+++ b/cpp/src/arrow/type_traits.h
@@ -75,7 +75,7 @@ struct CTypeTraits<bool> : public TypeTraits<BooleanType> {
     using TensorType = ArrowTensorType;                                                  \
     using CType = CType_;                                                                \
     static constexpr int64_t bytes_required(int64_t elements) {                          \
-      return elements * sizeof(CType_);                                                  \
+      return elements * static_cast<int64_t>(sizeof(CType_));                            \
     }                                                                                    \
     constexpr static bool is_parameter_free = true;                                      \
     static inline std::shared_ptr<DataType> type_singleton() { return SingletonFn(); }   \
@@ -113,7 +113,7 @@ struct TypeTraits<Date64Type> {
   using ScalarType = Date64Scalar;
 
   static constexpr int64_t bytes_required(int64_t elements) {
-    return elements * sizeof(int64_t);
+    return elements * static_cast<int64_t>(sizeof(int64_t));
   }
   constexpr static bool is_parameter_free = true;
   static inline std::shared_ptr<DataType> type_singleton() { return date64(); }
@@ -126,7 +126,7 @@ struct TypeTraits<Date32Type> {
   using ScalarType = Date32Scalar;
 
   static constexpr int64_t bytes_required(int64_t elements) {
-    return elements * sizeof(int32_t);
+    return elements * static_cast<int64_t>(sizeof(int32_t));
   }
   constexpr static bool is_parameter_free = true;
   static inline std::shared_ptr<DataType> type_singleton() { return date32(); }
@@ -139,7 +139,7 @@ struct TypeTraits<TimestampType> {
   using ScalarType = TimestampScalar;
 
   static constexpr int64_t bytes_required(int64_t elements) {
-    return elements * sizeof(int64_t);
+    return elements * static_cast<int64_t>(sizeof(int64_t));
   }
   constexpr static bool is_parameter_free = false;
 };
@@ -151,7 +151,7 @@ struct TypeTraits<Time32Type> {
   using ScalarType = Time32Scalar;
 
   static constexpr int64_t bytes_required(int64_t elements) {
-    return elements * sizeof(int32_t);
+    return elements * static_cast<int64_t>(sizeof(int32_t));
   }
   constexpr static bool is_parameter_free = false;
 };
@@ -163,7 +163,7 @@ struct TypeTraits<Time64Type> {
   using ScalarType = Time64Scalar;
 
   static constexpr int64_t bytes_required(int64_t elements) {
-    return elements * sizeof(int64_t);
+    return elements * static_cast<int64_t>(sizeof(int64_t));
   }
   constexpr static bool is_parameter_free = false;
 };
@@ -176,7 +176,7 @@ struct TypeTraits<HalfFloatType> {
   using TensorType = HalfFloatTensor;
 
   static constexpr int64_t bytes_required(int64_t elements) {
-    return elements * sizeof(uint16_t);
+    return elements * static_cast<int64_t>(sizeof(uint16_t));
   }
   constexpr static bool is_parameter_free = true;
   static inline std::shared_ptr<DataType> type_singleton() { return float16(); }
diff --git a/cpp/src/arrow/util/compression_brotli.cc b/cpp/src/arrow/util/compression_brotli.cc
index 3d75253..8a9beb6 100644
--- a/cpp/src/arrow/util/compression_brotli.cc
+++ b/cpp/src/arrow/util/compression_brotli.cc
@@ -204,9 +204,11 @@ Status BrotliCodec::Decompress(int64_t input_len, const uint8_t* input,
 Status BrotliCodec::Decompress(int64_t input_len, const uint8_t* input,
                                int64_t output_buffer_len, uint8_t* output_buffer,
                                int64_t* output_len) {
-  std::size_t output_size = output_buffer_len;
-  if (BrotliDecoderDecompress(input_len, input, &output_size, output_buffer) !=
-      BROTLI_DECODER_RESULT_SUCCESS) {
+  DCHECK_GE(input_len, 0);
+  DCHECK_GE(output_buffer_len, 0);
+  std::size_t output_size = static_cast<size_t>(output_buffer_len);
+  if (BrotliDecoderDecompress(static_cast<size_t>(input_len), input, &output_size,
+                              output_buffer) != BROTLI_DECODER_RESULT_SUCCESS) {
     return Status::IOError("Corrupt brotli compressed data.");
   }
   if (output_len) {
@@ -217,16 +219,19 @@ Status BrotliCodec::Decompress(int64_t input_len, const uint8_t* input,
 
 int64_t BrotliCodec::MaxCompressedLen(int64_t input_len,
                                       const uint8_t* ARROW_ARG_UNUSED(input)) {
-  return BrotliEncoderMaxCompressedSize(input_len);
+  DCHECK_GE(input_len, 0);
+  return BrotliEncoderMaxCompressedSize(static_cast<size_t>(input_len));
 }
 
 Status BrotliCodec::Compress(int64_t input_len, const uint8_t* input,
                              int64_t output_buffer_len, uint8_t* output_buffer,
                              int64_t* output_len) {
-  std::size_t output_size = output_buffer_len;
+  DCHECK_GE(input_len, 0);
+  DCHECK_GE(output_buffer_len, 0);
+  std::size_t output_size = static_cast<size_t>(output_buffer_len);
   if (BrotliEncoderCompress(kBrotliDefaultCompressionLevel, BROTLI_DEFAULT_WINDOW,
-                            BROTLI_DEFAULT_MODE, input_len, input, &output_size,
-                            output_buffer) == BROTLI_FALSE) {
+                            BROTLI_DEFAULT_MODE, static_cast<size_t>(input_len), input,
+                            &output_size, output_buffer) == BROTLI_FALSE) {
     return Status::IOError("Brotli compression failure.");
   }
   *output_len = output_size;
diff --git a/cpp/src/arrow/util/compression_snappy.cc b/cpp/src/arrow/util/compression_snappy.cc
index 058593f..2113f98 100644
--- a/cpp/src/arrow/util/compression_snappy.cc
+++ b/cpp/src/arrow/util/compression_snappy.cc
@@ -24,6 +24,7 @@
 #include <snappy.h>
 
 #include "arrow/status.h"
+#include "arrow/util/logging.h"
 #include "arrow/util/macros.h"
 
 using std::size_t;
@@ -73,7 +74,8 @@ Status SnappyCodec::Decompress(int64_t input_len, const uint8_t* input,
 
 int64_t SnappyCodec::MaxCompressedLen(int64_t input_len,
                                       const uint8_t* ARROW_ARG_UNUSED(input)) {
-  return snappy::MaxCompressedLength(input_len);
+  DCHECK_GE(input_len, 0);
+  return snappy::MaxCompressedLength(static_cast<size_t>(input_len));
 }
 
 Status SnappyCodec::Compress(int64_t input_len, const uint8_t* input,
diff --git a/cpp/src/arrow/util/compression_zstd.cc b/cpp/src/arrow/util/compression_zstd.cc
index de9df8f..4972f43 100644
--- a/cpp/src/arrow/util/compression_zstd.cc
+++ b/cpp/src/arrow/util/compression_zstd.cc
@@ -229,7 +229,8 @@ Status ZSTDCodec::Decompress(int64_t input_len, const uint8_t* input,
 
 int64_t ZSTDCodec::MaxCompressedLen(int64_t input_len,
                                     const uint8_t* ARROW_ARG_UNUSED(input)) {
-  return ZSTD_compressBound(input_len);
+  DCHECK_GE(input_len, 0);
+  return ZSTD_compressBound(static_cast<size_t>(input_len));
 }
 
 Status ZSTDCodec::Compress(int64_t input_len, const uint8_t* input,