Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bazel compile failed #34

Merged
merged 1 commit into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
module(
name = "hessian2-codec",
repo_name = "com_alibaba_hessian2_codec",
)
module(name = "hessian2-codec")

bazel_dep(
name = "bazel_skylib",
Expand Down
2 changes: 1 addition & 1 deletion demo/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cc_binary(
srcs = [
"demo.cc",
],
copts = ABSL_GCC_FLAGS + ["-std=c++14"],
copts = ABSL_GCC_FLAGS + ["-std=c++17"],
deps = [
"@com_alibaba_hessian2_codec//hessian2:codec_impl_lib",
"@com_alibaba_hessian2_codec//hessian2/basic_codec:basic_codec_lib",
Expand Down
2 changes: 1 addition & 1 deletion demo/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
name = "com_alibaba_hessian2_codec",
commit = "acab3fdcfe1f645729578949f61252353174a8c1",
commit = "05e29382e6c63f77d4cf84e212613b528ba98e0a",
remote = "https://github.com/alibaba/hessian2-codec.git",
)

Expand Down
8 changes: 6 additions & 2 deletions hessian2/basic_codec/string_codec.cc
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,9 @@ bool finalReadUtf8String(std::string &output, bool &has_surrogate,

output.resize(current_pos + length);
// Read the 'length' bytes from the reader buffer to the output.
reader.readNBytes(output.data() + current_pos, length);
reader.readNBytes(
static_cast<void *>(const_cast<char *>(output.data() + current_pos)),
length);

const auto result = getUtf8StringLength(
absl::string_view(output).substr(current_pos), has_surrogate);
Expand All @@ -286,7 +288,9 @@ bool finalReadUtf8String(std::string &output, bool &has_surrogate,
}
output.resize(current_pos + raw_bytes_length);
// Read the 'padding_size' bytes from the reader buffer to the output.
reader.readNBytes(output.data() + current_pos + length, padding_size);
reader.readNBytes(static_cast<void *>(const_cast<char *>(
output.data() + current_pos + length)),
padding_size);
}

length -= utf8_length;
Expand Down
9 changes: 6 additions & 3 deletions hessian2/basic_codec/string_codec_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,12 @@ std::string GenerateComplexString() {

std::string GenerateSuperComplexString() {
return "킐\u0088中国你好!"
"\u0088\u0088\u0088\u0088\u0088\u0088✅❓☑️😊🤔👀🫅🔒🗝️🧫🛹🚅🧻🪞🪞🪞🪞"
"🪞🪞🪞🪞🪞🕟🕟🕟🕟🕟🕟🕟🔅🔅🔅🔅🔅🔅🤍🤍🤍🤍🤍🤍🌈🌈🌈🌈🌈🌈🏦🏦🏦🏦"
"🏦🏦🚎🚎🚎🚎🚎🚎🚎⏰⏰⏰⏰⏰⏲️⏲️⏲️🗄️abcdefghijklmnopqrstuvwxyz1234567@#$"
"\u0088\u0088\u0088\u0088\u0088\u0088✅❓☑️😊🤔👀🫅🔒🗝️🧫🛹🚅"
"🧻🪞🪞🪞🪞"
"🪞🪞🪞🪞🪞🕟🕟🕟🕟🕟🕟🕟🔅🔅🔅🔅🔅🔅🤍🤍🤍🤍🤍🤍🌈🌈🌈🌈🌈🌈🏦🏦🏦"
"🏦"
"🏦🏦🚎🚎🚎🚎🚎🚎🚎⏰⏰⏰⏰⏰⏲️⏲️⏲️🗄️abcdefghijklmnopqrstuvwxyz1234567@#"
"$"
"%^&*()_+⏲️⏲️⏲️⏲️🐪🐫c⏰";
}

Expand Down
Loading