From 3f9afd7db73f4c4b49dded7b6cf32f863d441456 Mon Sep 17 00:00:00 2001 From: Maxim Mishchenko Date: Fri, 20 Dec 2024 16:31:29 +0100 Subject: [PATCH] SNOW-1865097 use explicit casts to compare doubles against integer limits (#802) --- cpp/lib/ArrowChunkIterator.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpp/lib/ArrowChunkIterator.cpp b/cpp/lib/ArrowChunkIterator.cpp index 8aa72de39f..8282698e17 100644 --- a/cpp/lib/ArrowChunkIterator.cpp +++ b/cpp/lib/ArrowChunkIterator.cpp @@ -361,7 +361,7 @@ ArrowChunkIterator::getCellAsInt64(size_t colIdx, int64 * out_data, bool rawData return status; } - if ((floatData > SF_INT64_MAX) || (floatData < SF_INT64_MIN)) + if (floatData > static_cast(SF_INT64_MAX) || floatData < static_cast(SF_INT64_MIN)) { m_parent->setError(SF_STATUS_ERROR_OUT_OF_RANGE, "Value out of range for int64."); @@ -408,7 +408,7 @@ ArrowChunkIterator::getCellAsInt64(size_t colIdx, int64 * out_data, bool rawData case arrow::Type::type::DOUBLE: { double dblData = m_columns[colIdx].arrowDouble->Value(m_currRowIndexInBatch); - if ((dblData > SF_INT64_MAX) || (dblData < SF_INT64_MIN)) + if (dblData > static_cast(SF_INT64_MAX) || dblData < static_cast(SF_INT64_MIN)) { m_parent->setError(SF_STATUS_ERROR_OUT_OF_RANGE, "Value out of range for int64."); @@ -542,7 +542,7 @@ ArrowChunkIterator::getCellAsUint64(size_t colIdx, uint64 * out_data) case arrow::Type::type::DOUBLE: { double dblData = m_columns[colIdx].arrowDouble->Value(m_currRowIndexInBatch); - if ((dblData > SF_UINT64_MAX) || (dblData < SF_INT64_MIN)) + if (dblData > static_cast(SF_UINT64_MAX) || dblData < static_cast(SF_INT64_MIN)) { m_parent->setError(SF_STATUS_ERROR_OUT_OF_RANGE, "Value out of range for uint64.");