From 902f5fd107a1e7fceeb24bebfe85713bd36f2dd5 Mon Sep 17 00:00:00 2001 From: JiaShuo Date: Wed, 1 Apr 2020 15:14:18 +0800 Subject: [PATCH 1/4] fix --- src/shell/commands/disk_rebalance.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shell/commands/disk_rebalance.cpp b/src/shell/commands/disk_rebalance.cpp index a62de9df5b..97462c9f8e 100644 --- a/src/shell/commands/disk_rebalance.cpp +++ b/src/shell/commands/disk_rebalance.cpp @@ -247,9 +247,8 @@ bool query_disk_replica(command_executor *e, shell_context *sc, arguments args) disk_printer.append_data(primary_count); disk_printer.append_data(secondary_count); disk_printer.append_data(primary_count + secondary_count); - - multi_printer.add(std::move(disk_printer)); } + multi_printer.add(std::move(disk_printer)); } multi_printer.output( *out.stream(), format_to_json ? tp_output_format::kJsonPretty : tp_output_format::kTabular); From 7cff24d2ef20b94c06970ee4b2f31ad524a67072 Mon Sep 17 00:00:00 2001 From: JiaShuo Date: Wed, 1 Apr 2020 22:14:38 +0800 Subject: [PATCH 2/4] fix --- src/shell/commands/data_operations.cpp | 3 ++- src/shell/commands/disk_rebalance.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shell/commands/data_operations.cpp b/src/shell/commands/data_operations.cpp index b9dad86f38..1ac66e8c1b 100644 --- a/src/shell/commands/data_operations.cpp +++ b/src/shell/commands/data_operations.cpp @@ -2430,7 +2430,8 @@ void escape_sds_argv(int argc, sds *argv) { for (int i = 0; i < argc; i++) { const size_t dest_len = sdslen(argv[i]) * 4 + 1; // Maximum possible expansion - sds new_arg = sdsnewlen("", dest_len); + std::string str = std::string(dest_len,' '); + sds new_arg = sdsnewlen(str.c_str(), dest_len); pegasus::utils::c_escape_string(argv[i], sdslen(argv[i]), new_arg, dest_len); sdsfree(argv[i]); argv[i] = new_arg; diff --git a/src/shell/commands/disk_rebalance.cpp b/src/shell/commands/disk_rebalance.cpp index 97462c9f8e..a62de9df5b 100644 --- a/src/shell/commands/disk_rebalance.cpp +++ b/src/shell/commands/disk_rebalance.cpp @@ -247,8 +247,9 @@ bool query_disk_replica(command_executor *e, shell_context *sc, arguments args) disk_printer.append_data(primary_count); disk_printer.append_data(secondary_count); disk_printer.append_data(primary_count + secondary_count); + + multi_printer.add(std::move(disk_printer)); } - multi_printer.add(std::move(disk_printer)); } multi_printer.output( *out.stream(), format_to_json ? tp_output_format::kJsonPretty : tp_output_format::kTabular); From 2fe40468fdc3d6c86ef9d28dafdb6d7a24835608 Mon Sep 17 00:00:00 2001 From: JiaShuo Date: Wed, 1 Apr 2020 22:15:30 +0800 Subject: [PATCH 3/4] fix --- src/shell/commands/data_operations.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell/commands/data_operations.cpp b/src/shell/commands/data_operations.cpp index 1ac66e8c1b..63537b8954 100644 --- a/src/shell/commands/data_operations.cpp +++ b/src/shell/commands/data_operations.cpp @@ -2430,7 +2430,7 @@ void escape_sds_argv(int argc, sds *argv) { for (int i = 0; i < argc; i++) { const size_t dest_len = sdslen(argv[i]) * 4 + 1; // Maximum possible expansion - std::string str = std::string(dest_len,' '); + std::string str = std::string(dest_len, ' '); sds new_arg = sdsnewlen(str.c_str(), dest_len); pegasus::utils::c_escape_string(argv[i], sdslen(argv[i]), new_arg, dest_len); sdsfree(argv[i]); From a3c9dc47ce58647b6831c8b5153b2b05ec3085c8 Mon Sep 17 00:00:00 2001 From: JiaShuo Date: Thu, 2 Apr 2020 10:46:42 +0800 Subject: [PATCH 4/4] fix --- src/shell/commands/data_operations.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/shell/commands/data_operations.cpp b/src/shell/commands/data_operations.cpp index 63537b8954..3ce7540ecd 100644 --- a/src/shell/commands/data_operations.cpp +++ b/src/shell/commands/data_operations.cpp @@ -2430,8 +2430,7 @@ void escape_sds_argv(int argc, sds *argv) { for (int i = 0; i < argc; i++) { const size_t dest_len = sdslen(argv[i]) * 4 + 1; // Maximum possible expansion - std::string str = std::string(dest_len, ' '); - sds new_arg = sdsnewlen(str.c_str(), dest_len); + sds new_arg = sdsnewlen(NULL, dest_len); pegasus::utils::c_escape_string(argv[i], sdslen(argv[i]), new_arg, dest_len); sdsfree(argv[i]); argv[i] = new_arg;