Skip to content
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
8 changes: 5 additions & 3 deletions include/my_hash_combine.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ Steinar */
#define MY_FUNCTIONAL_HASH_ROTL32(x, r) (x << r) | (x >> (32 - r))
#endif /* _MSC_VER */

#include <stdint.h>

template <typename SizeT>
inline void my_hash_combine(SizeT &seed, SizeT value) {
seed ^= value + 0x9e3779b9 + (seed << 6) + (seed >> 2);
}

inline void my_hash_combine(std::uint32_t &h1, std::uint32_t k1) {
inline void my_hash_combine(uint32_t &h1, uint32_t k1) {
const uint32_t c1 = 0xcc9e2d51;
const uint32_t c2 = 0x1b873593;

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

inline void my_hash_combine(std::uint64_t &h, std::uint64_t k) {
const std::uint64_t m = 0xc6a4a7935bd1e995ull;
inline void my_hash_combine(uint64_t &h, uint64_t k) {
const uint64_t m = 0xc6a4a7935bd1e995ull;
const int r = 47;

k *= m;
Expand Down
2 changes: 1 addition & 1 deletion sql/rpl_applier_reader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class Rpl_applier_reader::Stage_controller {
}

void enter_stage() {
DBUG_ASSERT(m_state = LOCKED);
DBUG_ASSERT(m_state == LOCKED);
m_thd->ENTER_COND(m_cond, m_mutex, &m_new_stage, &m_old_stage);
m_state = IN_STAGE;
}
Expand Down
12 changes: 6 additions & 6 deletions sql/rpl_binlog_sender.cc
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,12 @@ void Binlog_sender::run() {
if (reader.is_open()) {
if (is_fatal_error()) {
/* output events range to error message */
snprintf(error_text, sizeof(error_text),
"%s; the first event '%s' at %lld, "
"the last event read from '%s' at %lld, "
"the last byte read from '%s' at %lld.",
m_errmsg, m_start_file, m_start_pos, m_last_file, m_last_pos,
log_file, reader.position());
my_snprintf_8bit(nullptr, error_text, sizeof(error_text),
"%s; the first event '%s' at %lld, "
"the last event read from '%s' at %lld, "
"the last byte read from '%s' at %lld.",
m_errmsg, m_start_file, m_start_pos, m_last_file,
m_last_pos, log_file, reader.position());
set_fatal_error(error_text);
}

Expand Down
1 change: 1 addition & 0 deletions sql/rpl_utility.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#endif

#include <sys/types.h>
#include <string>
#include <unordered_map>

#include "field_types.h" // enum_field_types
Expand Down
2 changes: 1 addition & 1 deletion sql/udpsvr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ void CUdpServer::loopdealreq() {
fprintf(stderr, "recvfrom received %d bytes, equals to message buffer size(%d), "
"from int ip:%u, data may be truncated.",
ret, recvlen, from.sin_addr.s_addr);
strncpy(fromaddr, inet_ntoa(from.sin_addr), 24);
strncpy(fromaddr, inet_ntoa(from.sin_addr), strlen(fromaddr));
do_request(recvbuf, ret, fromaddr);
} else {
fprintf(stderr, "recvfrom ret:%d<=0,errno:%d,errstr:%s,from int ip:%u",
Expand Down