diff --git a/MODULE.bazel b/MODULE.bazel index 5609c16..01ca276 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -1,7 +1,4 @@ -module( - name = "hessian2-codec", - repo_name = "com_alibaba_hessian2_codec", -) +module(name = "hessian2-codec") bazel_dep( name = "bazel_skylib", diff --git a/demo/BUILD b/demo/BUILD index 3abbd57..65f9ec1 100644 --- a/demo/BUILD +++ b/demo/BUILD @@ -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", diff --git a/demo/WORKSPACE b/demo/WORKSPACE index fc5c537..0a67a60 100644 --- a/demo/WORKSPACE +++ b/demo/WORKSPACE @@ -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", ) diff --git a/hessian2/basic_codec/string_codec.cc b/hessian2/basic_codec/string_codec.cc index 06ddba2..acb5136 100644 --- a/hessian2/basic_codec/string_codec.cc +++ b/hessian2/basic_codec/string_codec.cc @@ -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(const_cast(output.data() + current_pos)), + length); const auto result = getUtf8StringLength( absl::string_view(output).substr(current_pos), has_surrogate); @@ -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(const_cast( + output.data() + current_pos + length)), + padding_size); } length -= utf8_length; diff --git a/hessian2/basic_codec/string_codec_unittests.cc b/hessian2/basic_codec/string_codec_unittests.cc index 8b93f05..3438517 100644 --- a/hessian2/basic_codec/string_codec_unittests.cc +++ b/hessian2/basic_codec/string_codec_unittests.cc @@ -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⏰"; }