You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by we...@apache.org on 2018/09/17 22:17:35 UTC

[arrow] branch master updated: ARROW-3251: [C++] Fix conversion warnings in cast.cc

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

wesm 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 f9e88e5  ARROW-3251: [C++] Fix conversion warnings in cast.cc
f9e88e5 is described below

commit f9e88e53295f35444d45dd8f8905bb406462980e
Author: Antoine Pitrou <an...@python.org>
AuthorDate: Mon Sep 17 18:17:23 2018 -0400

    ARROW-3251: [C++] Fix conversion warnings in cast.cc
    
    Author: Antoine Pitrou <an...@python.org>
    
    Closes #2575 from pitrou/ARROW-3251-cast-conversion-warnings and squashes the following commits:
    
    4efb82565 <Antoine Pitrou> ARROW-3251:  Fix conversion warnings in cast.cc
---
 cpp/src/arrow/compute/kernels/cast.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpp/src/arrow/compute/kernels/cast.cc b/cpp/src/arrow/compute/kernels/cast.cc
index 369ebb9..639f3f8 100644
--- a/cpp/src/arrow/compute/kernels/cast.cc
+++ b/cpp/src/arrow/compute/kernels/cast.cc
@@ -288,7 +288,7 @@ struct CastFunctor<O, I, typename std::enable_if<is_float_truncate<O, I>::value>
                                                input.length);
         for (int64_t i = 0; i < input.length; ++i) {
           auto out_value = static_cast<out_type>(*in_data);
-          if (ARROW_PREDICT_FALSE(out_value != *in_data)) {
+          if (ARROW_PREDICT_FALSE(static_cast<in_type>(out_value) != *in_data)) {
             ctx->SetStatus(Status::Invalid("Floating point value truncated"));
           }
           *out_data++ = out_value;
@@ -298,7 +298,7 @@ struct CastFunctor<O, I, typename std::enable_if<is_float_truncate<O, I>::value>
       } else {
         for (int64_t i = 0; i < input.length; ++i) {
           auto out_value = static_cast<out_type>(*in_data);
-          if (ARROW_PREDICT_FALSE(out_value != *in_data)) {
+          if (ARROW_PREDICT_FALSE(static_cast<in_type>(out_value) != *in_data)) {
             ctx->SetStatus(Status::Invalid("Floating point value truncated"));
           }
           *out_data++ = out_value;