Skip to content

Commit 1bd0f68

Browse files
committed
Convert to ostringstream instead of std::to_string which had compiler errors.
1 parent 7ee414e commit 1bd0f68

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

cpp/src/gandiva/encrypt_utils.cc

+6-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717

1818
#include "gandiva/encrypt_utils.h"
19-
#include <string.h>
19+
#include <sstream>
2020

2121
#include <stdexcept>
2222

@@ -29,8 +29,11 @@ const EVP_CIPHER* get_cipher_algo(int32_t key_length) {
2929
return EVP_aes_192_ecb();
3030
case 32:
3131
return EVP_aes_256_ecb();
32-
default:
33-
throw std::runtime_error("unsupported key length: " + std::to_string(key_length));
32+
default: {
33+
std::ostringstream oss;
34+
oss << "unsupported key length: " << key_length;
35+
throw std::runtime_error(oss.str());
36+
}
3437
}
3538
}
3639
} // namespace

cpp/src/gandiva/gdv_function_stubs.cc

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <utf8proc.h>
2121

2222
#include <boost/crc.hpp>
23+
#include <sstream>
2324
#include <string>
2425
#include <vector>
2526

@@ -320,9 +321,11 @@ const char* gdv_fn_aes_encrypt(int64_t context, const char* data, int32_t data_l
320321
if (key_data_len == 16 || key_data_len == 24 || key_data_len == 32) {
321322
kAesBlockSize = static_cast<int64_t>(key_data_len);
322323
} else {
324+
std::ostringstream oss;
325+
oss << "invalid key length: " << key_data_len;
323326
gdv_fn_context_set_error_msg(
324327
context,
325-
(std::string("invalid key length: ") + std::to_string(key_data_len)).c_str());
328+
oss.str().c_str());
326329
*out_len = 0;
327330
return nullptr;
328331
}
@@ -364,9 +367,11 @@ const char* gdv_fn_aes_decrypt(int64_t context, const char* data, int32_t data_l
364367
if (key_data_len == 16 || key_data_len == 24 || key_data_len == 32) {
365368
kAesBlockSize = static_cast<int64_t>(key_data_len);
366369
} else {
370+
std::ostringstream oss;
371+
oss << "invalid key length: " << key_data_len;
367372
gdv_fn_context_set_error_msg(
368373
context,
369-
(std::string("invalid key length: ") + std::to_string(key_data_len)).c_str());
374+
oss.str().c_str());
370375
*out_len = 0;
371376
return nullptr;
372377
}

0 commit comments

Comments
 (0)