Skip to content

Commit 9e8d0be

Browse files
committed
Fix build warnings that get treated as error
1 parent 029cbbf commit 9e8d0be

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/binary_array_accessor_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ TEST(BinaryArrayAccessor, Test_CDataType_BINARY_Truncation) {
9696
// It's safe to create a std::string from this data because we know it's
9797
// ASCII, this doesn't work with arbitrary binary data.
9898
ss << std::string(buffer.data(), buffer.data() + chunk_length);
99-
} while (value_offset < values[0].length() && value_offset != -1);
99+
} while (value_offset < static_cast<int64_t>(values[0].length()) && value_offset != -1);
100100

101101
ASSERT_EQ(values[0], ss.str());
102102
}

cpp/src/arrow/flight/sql/odbc/flight_sql/accessors/string_array_accessor_test.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ TEST(StringArrayAccessor, Test_CDataType_CHAR_Truncation) {
8585
ASSERT_EQ(values[0].length() - original_value_offset, strlen_buffer[0]);
8686

8787
ss << buffer.data();
88-
} while (value_offset < values[0].length() && value_offset != -1);
88+
} while (value_offset < static_cast<int64_t>(values[0].length()) && value_offset != -1);
8989

9090
ASSERT_EQ(values[0], ss.str());
9191
}
@@ -154,7 +154,8 @@ TEST(StringArrayAccessor, Test_CDataType_WCHAR_Truncation) {
154154
length = buffer.size();
155155
}
156156
finalStr.insert(finalStr.end(), buffer.data(), buffer.data() + length);
157-
} while (value_offset < values[0].length() * GetSqlWCharSize() && value_offset != -1);
157+
} while (value_offset < static_cast<int64_t>(values[0].length() * GetSqlWCharSize()) &&
158+
value_offset != -1);
158159

159160
// Trim final null bytes
160161
finalStr.resize(values[0].length() * GetSqlWCharSize());

cpp/src/arrow/flight/sql/odbc/flight_sql/address_info.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ bool AddressInfo::GetAddressInfo(const std::string& host, char* host_name_info,
3434
}
3535

3636
error = getnameinfo(addrinfo_result_->ai_addr, addrinfo_result_->ai_addrlen,
37-
host_name_info, max_host, NULL, 0, 0);
37+
host_name_info, static_cast<DWORD>(max_host), NULL, 0, 0);
3838
return error == 0;
3939
}
4040

cpp/src/arrow/flight/sql/odbc/flight_sql/json_converter_test.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ TEST(ConvertToJson, Int16) {
6868

6969
TEST(ConvertToJson, Int32) {
7070
ASSERT_EQ("2147483647", ConvertToJson(arrow::Int32Scalar(2147483647)));
71-
ASSERT_EQ("-2147483648", ConvertToJson(arrow::Int32Scalar(-2147483648)));
71+
// 2147483648 is not valid as a signed int, using workaround
72+
ASSERT_EQ("-2147483648",
73+
ConvertToJson(arrow::Int32Scalar(static_cast<int32_t>(-2147483647 - 1))));
7274
}
7375

7476
TEST(ConvertToJson, Int64) {
7577
ASSERT_EQ("9223372036854775807",
7678
ConvertToJson(arrow::Int64Scalar(9223372036854775807LL)));
77-
ASSERT_EQ("-9223372036854775808",
78-
ConvertToJson(arrow::Int64Scalar(-9223372036854775808ULL)));
79+
// 9223372036854775808ULL is not valid as a signed int64, using workaround
80+
ASSERT_EQ("-9223372036854775808", ConvertToJson(arrow::Int64Scalar(static_cast<int64_t>(
81+
-9223372036854775807LL - 1))));
7982
}
8083

8184
TEST(ConvertToJson, UInt8) {

0 commit comments

Comments
 (0)