Skip to content

Commit 90942e3

Browse files
authored
Fixes for gcc 485 (#1151)
* Fixes for gcc 485 * Leftover line is remove. * Fix
1 parent c391ee1 commit 90942e3

File tree

3 files changed

+115
-80
lines changed

3 files changed

+115
-80
lines changed

hazelcast/src/hazelcast/client/compact.cpp

Lines changed: 60 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -3573,7 +3573,7 @@ default_schema_service::default_schema_service(spi::ClientContext& context)
35733573
context.get_client_properties().get_invocation_retry_pause_millis()) }
35743574
, max_put_retry_count_{ context.get_client_properties().get_integer(
35753575
client_property{ MAX_PUT_RETRY_COUNT, MAX_PUT_RETRY_COUNT_DEFAULT }) }
3576-
, context_{ context }
3576+
, context_(context)
35773577
{
35783578
}
35793579

@@ -3778,7 +3778,7 @@ default_schema_service::replicate_all_schemas()
37783778

37793779
compact_stream_serializer::compact_stream_serializer(
37803780
default_schema_service& service)
3781-
: schema_service{ service }
3781+
: schema_service(service)
37823782
{
37833783
}
37843784

@@ -3859,8 +3859,8 @@ field_operations::get(field_kind kind)
38593859
using util::Bits;
38603860
using namespace boost::property_tree;
38613861

3862-
static const char* NULL_STRING = "null";
3863-
static const char* BOOL_STRING[2] = { "true", "false" };
3862+
static const std::string NULL_STRING = "null";
3863+
static const std::string BOOL_STRING[2] = { "true", "false" };
38643864

38653865
static auto time_to_string = [](const local_time& lt) {
38663866
return boost::str(boost::format("%02d:%02d:%02d.%d") % int(lt.hours) %
@@ -3933,7 +3933,7 @@ field_operations::get(field_kind kind)
39333933

39343934
for (bool value : *values) {
39353935
array.push_back(
3936-
ptree::value_type("", BOOL_STRING[value]));
3936+
std::make_pair("", ptree(BOOL_STRING[value])));
39373937
}
39383938

39393939
parent.put_child(field_name, array);
@@ -3984,7 +3984,7 @@ field_operations::get(field_kind kind)
39843984

39853985
for (auto value : *values) {
39863986
array.push_back(
3987-
ptree::value_type("", std::to_string(value)));
3987+
std::make_pair("", ptree(std::to_string(value))));
39883988
}
39893989

39903990
parent.put_child(field_name, array);
@@ -4037,7 +4037,7 @@ field_operations::get(field_kind kind)
40374037

40384038
for (auto value : *values) {
40394039
array.push_back(
4040-
ptree::value_type("", std::to_string(value)));
4040+
std::make_pair("", ptree(std::to_string(value))));
40414041
}
40424042

40434043
parent.put_child(field_name, array);
@@ -4088,7 +4088,7 @@ field_operations::get(field_kind kind)
40884088

40894089
for (auto value : *values) {
40904090
array.push_back(
4091-
ptree::value_type("", std::to_string(value)));
4091+
std::make_pair("", ptree(std::to_string(value))));
40924092
}
40934093

40944094
parent.put_child(field_name, array);
@@ -4139,7 +4139,7 @@ field_operations::get(field_kind kind)
41394139

41404140
for (auto value : *values) {
41414141
array.push_back(
4142-
ptree::value_type("", std::to_string(value)));
4142+
std::make_pair("", ptree(std::to_string(value))));
41434143
}
41444144

41454145
parent.put_child(field_name, array);
@@ -4190,7 +4190,7 @@ field_operations::get(field_kind kind)
41904190

41914191
for (auto value : *values) {
41924192
array.push_back(
4193-
ptree::value_type("", std::to_string(value)));
4193+
std::make_pair("", ptree(std::to_string(value))));
41944194
}
41954195

41964196
parent.put_child(field_name, array);
@@ -4241,7 +4241,7 @@ field_operations::get(field_kind kind)
42414241

42424242
for (auto value : *values) {
42434243
array.push_back(
4244-
ptree::value_type("", std::to_string(value)));
4244+
std::make_pair("", ptree(std::to_string(value))));
42454245
}
42464246

42474247
parent.put_child(field_name, array);
@@ -4298,9 +4298,10 @@ field_operations::get(field_kind kind)
42984298

42994299
for (const auto& value : *values) {
43004300
if (!value) {
4301-
array.push_back(ptree::value_type("", NULL_STRING));
4301+
array.push_back(
4302+
std::make_pair("", ptree(NULL_STRING)));
43024303
} else {
4303-
array.push_back(ptree::value_type("", *value));
4304+
array.push_back(std::make_pair("", ptree(*value)));
43044305
}
43054306
}
43064307

@@ -4360,12 +4361,13 @@ field_operations::get(field_kind kind)
43604361

43614362
for (const auto& value : *values) {
43624363
if (!value) {
4363-
array.push_back(ptree::value_type("", NULL_STRING));
4364-
} else {
43654364
array.push_back(
4366-
ptree::value_type("",
4367-
value->unscaled.str() + "E" +
4368-
std::to_string(value->scale)));
4365+
std::make_pair("", ptree(NULL_STRING)));
4366+
} else {
4367+
array.push_back(std::make_pair(
4368+
"",
4369+
ptree(value->unscaled.str() + "E" +
4370+
std::to_string(value->scale))));
43694371
}
43704372
}
43714373

@@ -4423,10 +4425,11 @@ field_operations::get(field_kind kind)
44234425

44244426
for (const auto& value : *values) {
44254427
if (!value) {
4426-
array.push_back(ptree::value_type("", NULL_STRING));
4428+
array.push_back(
4429+
std::make_pair("", ptree(NULL_STRING)));
44274430
} else {
44284431
array.push_back(
4429-
ptree::value_type("", time_to_string(*value)));
4432+
std::make_pair("", ptree(time_to_string(*value))));
44304433
}
44314434
}
44324435

@@ -4484,10 +4487,11 @@ field_operations::get(field_kind kind)
44844487

44854488
for (const auto& value : *values) {
44864489
if (!value) {
4487-
array.push_back(ptree::value_type("", NULL_STRING));
4490+
array.push_back(
4491+
std::make_pair("", ptree(NULL_STRING)));
44884492
} else {
44894493
array.push_back(
4490-
ptree::value_type("", date_to_string(*value)));
4494+
std::make_pair("", ptree(date_to_string(*value))));
44914495
}
44924496
}
44934497

@@ -4545,10 +4549,11 @@ field_operations::get(field_kind kind)
45454549

45464550
for (const auto& value : *values) {
45474551
if (!value) {
4548-
array.push_back(ptree::value_type("", NULL_STRING));
4549-
} else {
45504552
array.push_back(
4551-
ptree::value_type("", timestamp_to_string(*value)));
4553+
std::make_pair("", ptree(NULL_STRING)));
4554+
} else {
4555+
array.push_back(std::make_pair(
4556+
"", ptree(timestamp_to_string(*value))));
45524557
}
45534558
}
45544559

@@ -4611,10 +4616,12 @@ field_operations::get(field_kind kind)
46114616

46124617
for (const auto& value : *values) {
46134618
if (!value) {
4614-
array.push_back(ptree::value_type("", NULL_STRING));
4619+
array.push_back(
4620+
std::make_pair("", ptree(NULL_STRING)));
46154621
} else {
4616-
array.push_back(ptree::value_type(
4617-
"", timestamp_with_timezone_to_string(*value)));
4622+
array.push_back(std::make_pair(
4623+
"",
4624+
ptree(timestamp_with_timezone_to_string(*value))));
46184625
}
46194626
}
46204627

@@ -4677,10 +4684,11 @@ field_operations::get(field_kind kind)
46774684

46784685
for (const auto& value : *values) {
46794686
if (!value) {
4680-
array.push_back(ptree::value_type("", NULL_STRING));
4687+
array.push_back(
4688+
std::make_pair("", ptree(NULL_STRING)));
46814689
} else {
4682-
array.push_back(ptree::value_type(
4683-
"", write_generic_record(*value)));
4690+
array.push_back(
4691+
std::make_pair("", write_generic_record(*value)));
46844692
}
46854693
}
46864694

@@ -4743,10 +4751,11 @@ field_operations::get(field_kind kind)
47434751

47444752
for (const auto& value : *values) {
47454753
if (!value) {
4746-
array.push_back(ptree::value_type("", NULL_STRING));
4754+
array.push_back(
4755+
std::make_pair("", ptree(NULL_STRING)));
47474756
} else {
47484757
array.push_back(
4749-
ptree::value_type("", BOOL_STRING[*value]));
4758+
std::make_pair("", ptree(BOOL_STRING[*value])));
47504759
}
47514760
}
47524761

@@ -4807,10 +4816,11 @@ field_operations::get(field_kind kind)
48074816

48084817
for (const auto& value : *values) {
48094818
if (!value) {
4810-
array.push_back(ptree::value_type("", NULL_STRING));
4819+
array.push_back(
4820+
std::make_pair("", ptree(NULL_STRING)));
48114821
} else {
48124822
array.push_back(
4813-
ptree::value_type("", std::to_string(*value)));
4823+
std::make_pair("", ptree(std::to_string(*value))));
48144824
}
48154825
}
48164826

@@ -4871,10 +4881,11 @@ field_operations::get(field_kind kind)
48714881

48724882
for (const auto& value : *values) {
48734883
if (!value) {
4874-
array.push_back(ptree::value_type("", NULL_STRING));
4884+
array.push_back(
4885+
std::make_pair("", ptree(NULL_STRING)));
48754886
} else {
48764887
array.push_back(
4877-
ptree::value_type("", std::to_string(*value)));
4888+
std::make_pair("", ptree(std::to_string(*value))));
48784889
}
48794890
}
48804891

@@ -4935,10 +4946,11 @@ field_operations::get(field_kind kind)
49354946

49364947
for (const auto& value : *values) {
49374948
if (!value) {
4938-
array.push_back(ptree::value_type("", NULL_STRING));
4949+
array.push_back(
4950+
std::make_pair("", ptree(NULL_STRING)));
49394951
} else {
49404952
array.push_back(
4941-
ptree::value_type("", std::to_string(*value)));
4953+
std::make_pair("", ptree(std::to_string(*value))));
49424954
}
49434955
}
49444956

@@ -4999,10 +5011,11 @@ field_operations::get(field_kind kind)
49995011

50005012
for (const auto& value : *values) {
50015013
if (!value) {
5002-
array.push_back(ptree::value_type("", NULL_STRING));
5014+
array.push_back(
5015+
std::make_pair("", ptree(NULL_STRING)));
50035016
} else {
50045017
array.push_back(
5005-
ptree::value_type("", std::to_string(*value)));
5018+
std::make_pair("", ptree(std::to_string(*value))));
50065019
}
50075020
}
50085021

@@ -5063,10 +5076,11 @@ field_operations::get(field_kind kind)
50635076

50645077
for (const auto& value : *values) {
50655078
if (!value) {
5066-
array.push_back(ptree::value_type("", NULL_STRING));
5079+
array.push_back(
5080+
std::make_pair("", ptree(NULL_STRING)));
50675081
} else {
50685082
array.push_back(
5069-
ptree::value_type("", std::to_string(*value)));
5083+
std::make_pair("", ptree(std::to_string(*value))));
50705084
}
50715085
}
50725086

@@ -5127,10 +5141,11 @@ field_operations::get(field_kind kind)
51275141

51285142
for (const auto& value : *values) {
51295143
if (!value) {
5130-
array.push_back(ptree::value_type("", NULL_STRING));
5144+
array.push_back(
5145+
std::make_pair("", ptree(NULL_STRING)));
51315146
} else {
51325147
array.push_back(
5133-
ptree::value_type("", std::to_string(*value)));
5148+
std::make_pair("", ptree(std::to_string(*value))));
51345149
}
51355150
}
51365151

hazelcast/test/src/compact/compact_rabin_fingerprint_test.h

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,48 +48,72 @@ TEST_F(CompactRabinFingerprintTest, test_i8_fingerprint)
4848
{
4949
check_each(std::vector<entry_t<byte>>{
5050
// Before Val After(Expected)
51-
{ 100, -5, -6165936963810616235 },
52-
{ INT64_MIN, 0, 36028797018963968 },
53-
{ 9223372036854775807, 113, -3588673659009074035 },
54-
{ -13, -13, 72057594037927935 },
55-
{ 42, 42, 0 },
56-
{ 42, -42, -1212835703325587522 },
57-
{ 0, 0, 0 },
58-
{ -123456789, 0, 7049212178818848951 },
59-
{ 123456789, 127, -8322440716502314713 },
60-
{ 127, -128, -7333697815154264656 },
51+
std::tuple<int64_t, byte, int64_t>{
52+
int64_t(100), byte(-5), int64_t(-6165936963810616235) },
53+
std::tuple<int64_t, byte, int64_t>{
54+
int64_t(INT64_MIN), byte(0), int64_t(36028797018963968) },
55+
std::tuple<int64_t, byte, int64_t>{ int64_t(9223372036854775807),
56+
byte(113),
57+
int64_t(-3588673659009074035) },
58+
std::tuple<int64_t, byte, int64_t>{
59+
int64_t(-13), byte(-13), int64_t(72057594037927935) },
60+
std::tuple<int64_t, byte, int64_t>{ int64_t(42), byte(42), int64_t(0) },
61+
std::tuple<int64_t, byte, int64_t>{
62+
int64_t(42), byte(-42), int64_t(-1212835703325587522) },
63+
std::tuple<int64_t, byte, int64_t>{ int64_t(0), byte(0), int64_t(0) },
64+
std::tuple<int64_t, byte, int64_t>{
65+
int64_t(-123456789), byte(0), int64_t(7049212178818848951) },
66+
std::tuple<int64_t, byte, int64_t>{
67+
int64_t(123456789), byte(127), int64_t(-8322440716502314713) },
68+
std::tuple<int64_t, byte, int64_t>{
69+
int64_t(127), byte(-128), int64_t(-7333697815154264656) },
6170
});
6271
}
6372

6473
TEST_F(CompactRabinFingerprintTest, test_i32_fingerprint)
6574
{
6675
check_each(std::vector<entry_t<int>>{
6776
// Before Val After(Expected)
68-
{ INT64_MIN, 2147483647, 6066553457199370002 },
69-
{ 9223372036854775807, INT32_MIN, 6066553459773452525 },
70-
{ 9223372036854707, 42, -961937498224213201 },
71-
{ -42, -42, 4294967295 },
72-
{ 42, 42, 0 },
73-
{ 42, -442, 7797744281030715531 },
74-
{ 0, 0, 0 },
75-
{ -123456789, 0, -565582369564281851 },
76-
{ 123456786669, 42127, 7157681543413310373 },
77-
{ 2147483647, INT32_MIN, -7679311364898232185 } });
77+
std::tuple<int64_t, int, int64_t>{
78+
INT64_MIN, 2147483647, 6066553457199370002 },
79+
std::tuple<int64_t, int, int64_t>{
80+
9223372036854775807, INT32_MIN, 6066553459773452525 },
81+
std::tuple<int64_t, int, int64_t>{
82+
9223372036854707, 42, -961937498224213201 },
83+
std::tuple<int64_t, int, int64_t>{ -42, -42, 4294967295 },
84+
std::tuple<int64_t, int, int64_t>{ 42, 42, 0 },
85+
std::tuple<int64_t, int, int64_t>{ 42, -442, 7797744281030715531 },
86+
std::tuple<int64_t, int, int64_t>{ 0, 0, 0 },
87+
std::tuple<int64_t, int, int64_t>{ -123456789, 0, -565582369564281851 },
88+
std::tuple<int64_t, int, int64_t>{
89+
123456786669, 42127, 7157681543413310373 },
90+
std::tuple<int64_t, int, int64_t>{
91+
2147483647, INT32_MIN, -7679311364898232185 } });
7892
}
7993

8094
TEST_F(CompactRabinFingerprintTest, test_str_fingerprint)
8195
{
8296
check_each(std::vector<entry_t<std::string>>{
83-
{ 0, "hazelcast", 8164249978089638648 },
84-
{ -31231241235, "üğişçö", 6128923854942458838 },
85-
{ 41231542121235, "😀 😃 😄", -6875080751809013377 },
86-
{ rabin_finger_print::INIT, "STUdent", 1896492170246289820 },
87-
{ rabin_finger_print::INIT, "aü😄", -2084249746924383631 },
88-
{ rabin_finger_print::INIT, "", -2316162475121075004 },
89-
{ -123321, "xyz", 2601391163390439688 },
90-
{ 132132123132132, " ç", -7699875372487088773 },
91-
{ 42, "42", 7764866287864698590 },
92-
{ -42, "-42", -3434092993477103253 } });
97+
std::tuple<int64_t, std::string, int64_t>{
98+
0, "hazelcast", 8164249978089638648 },
99+
std::tuple<int64_t, std::string, int64_t>{
100+
-31231241235, "üğişçö", 6128923854942458838 },
101+
std::tuple<int64_t, std::string, int64_t>{
102+
41231542121235, "😀 😃 😄", -6875080751809013377 },
103+
std::tuple<int64_t, std::string, int64_t>{
104+
rabin_finger_print::INIT, "STUdent", 1896492170246289820 },
105+
std::tuple<int64_t, std::string, int64_t>{
106+
rabin_finger_print::INIT, "aü😄", -2084249746924383631 },
107+
std::tuple<int64_t, std::string, int64_t>{
108+
rabin_finger_print::INIT, "", -2316162475121075004 },
109+
std::tuple<int64_t, std::string, int64_t>{
110+
-123321, "xyz", 2601391163390439688 },
111+
std::tuple<int64_t, std::string, int64_t>{
112+
132132123132132, " ç", -7699875372487088773 },
113+
std::tuple<int64_t, std::string, int64_t>{
114+
42, "42", 7764866287864698590 },
115+
std::tuple<int64_t, std::string, int64_t>{
116+
-42, "-42", -3434092993477103253 } });
93117
}
94118

95119
// hazelcast.internal.serialization.impl.compact.RabinFingerPrintTest::testRabinFingerprint()

0 commit comments

Comments
 (0)