Skip to content

Commit aa3f3d8

Browse files
committed
fix build error in release mode with gcc10
Signed-off-by: amyangfei <amyangfei@gmail.com>
1 parent 11bc573 commit aa3f3d8

File tree

5 files changed

+14
-11
lines changed

5 files changed

+14
-11
lines changed

include/my_hash_combine.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,14 @@ Steinar */
6161
#define MY_FUNCTIONAL_HASH_ROTL32(x, r) (x << r) | (x >> (32 - r))
6262
#endif /* _MSC_VER */
6363

64+
#include <stdint.h>
65+
6466
template <typename SizeT>
6567
inline void my_hash_combine(SizeT &seed, SizeT value) {
6668
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
6769
}
6870

69-
inline void my_hash_combine(std::uint32_t &h1, std::uint32_t k1) {
71+
inline void my_hash_combine(uint32_t &h1, uint32_t k1) {
7072
const uint32_t c1 = 0xcc9e2d51;
7173
const uint32_t c2 = 0x1b873593;
7274

@@ -79,8 +81,8 @@ inline void my_hash_combine(std::uint32_t &h1, std::uint32_t k1) {
7981
h1 = h1 * 5 + 0xe6546b64;
8082
}
8183

82-
inline void my_hash_combine(std::uint64_t &h, std::uint64_t k) {
83-
const std::uint64_t m = 0xc6a4a7935bd1e995ull;
84+
inline void my_hash_combine(uint64_t &h, uint64_t k) {
85+
const uint64_t m = 0xc6a4a7935bd1e995ull;
8486
const int r = 47;
8587

8688
k *= m;

sql/rpl_applier_reader.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Rpl_applier_reader::Stage_controller {
7070
}
7171

7272
void enter_stage() {
73-
DBUG_ASSERT(m_state = LOCKED);
73+
DBUG_ASSERT(m_state == LOCKED);
7474
m_thd->ENTER_COND(m_cond, m_mutex, &m_new_stage, &m_old_stage);
7575
m_state = IN_STAGE;
7676
}

sql/rpl_binlog_sender.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,12 @@ void Binlog_sender::run() {
356356
if (reader.is_open()) {
357357
if (is_fatal_error()) {
358358
/* output events range to error message */
359-
snprintf(error_text, sizeof(error_text),
360-
"%s; the first event '%s' at %lld, "
361-
"the last event read from '%s' at %lld, "
362-
"the last byte read from '%s' at %lld.",
363-
m_errmsg, m_start_file, m_start_pos, m_last_file, m_last_pos,
364-
log_file, reader.position());
359+
my_snprintf_8bit(nullptr, error_text, sizeof(error_text),
360+
"%s; the first event '%s' at %lld, "
361+
"the last event read from '%s' at %lld, "
362+
"the last byte read from '%s' at %lld.",
363+
m_errmsg, m_start_file, m_start_pos, m_last_file,
364+
m_last_pos, log_file, reader.position());
365365
set_fatal_error(error_text);
366366
}
367367

sql/rpl_utility.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#endif
2929

3030
#include <sys/types.h>
31+
#include <string>
3132
#include <unordered_map>
3233

3334
#include "field_types.h" // enum_field_types

sql/udpsvr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void CUdpServer::loopdealreq() {
143143
fprintf(stderr, "recvfrom received %d bytes, equals to message buffer size(%d), "
144144
"from int ip:%u, data may be truncated.",
145145
ret, recvlen, from.sin_addr.s_addr);
146-
strncpy(fromaddr, inet_ntoa(from.sin_addr), 24);
146+
strncpy(fromaddr, inet_ntoa(from.sin_addr), strlen(fromaddr));
147147
do_request(recvbuf, ret, fromaddr);
148148
} else {
149149
fprintf(stderr, "recvfrom ret:%d<=0,errno:%d,errstr:%s,from int ip:%u",

0 commit comments

Comments
 (0)