You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by sp...@apache.org on 2026/05/31 03:45:31 UTC
(iotdb) 03/04: Append big-endian bytes in MyStringBuffer instead of overwriting
This is an automated email from the ASF dual-hosted git repository.
SpriCoder pushed a commit to branch cPerformance
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 0dbcdd16ae0bcf17d790271b45f83ee5b2266d50
Author: spricoder <sp...@qq.com>
AuthorDate: Sun May 31 11:43:29 2026 +0800
Append big-endian bytes in MyStringBuffer instead of overwriting
On big-endian hosts MyStringBuffer::putOrderedByte used str.assign, which
replaced the whole buffer with each numeric write and corrupted previously
serialized content. Use str.append so bytes accumulate, matching the
little-endian path.
---
iotdb-client/client-cpp/src/main/Common.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/iotdb-client/client-cpp/src/main/Common.cpp b/iotdb-client/client-cpp/src/main/Common.cpp
index 38b913c2270..842150241da 100644
--- a/iotdb-client/client-cpp/src/main/Common.cpp
+++ b/iotdb-client/client-cpp/src/main/Common.cpp
@@ -418,7 +418,7 @@ const char* MyStringBuffer::getOrderedByte(size_t len) {
void MyStringBuffer::putOrderedByte(char* buf, int len) {
if (isBigEndian) {
- str.assign(buf, len);
+ str.append(buf, len);
} else {
for (int i = len - 1; i > -1; i--) {
str += buf[i];