From 214f56421eb3147cfde563c343a8dc86b049fd6e Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 17:27:35 +0100 Subject: [PATCH 1/7] src/thread/context.hpp: fix to build with boost 1.62 (see bitshares/bitshares-fc#5) --- src/thread/context.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/thread/context.hpp b/src/thread/context.hpp index 31bfbaaa0..9ba724883 100644 --- a/src/thread/context.hpp +++ b/src/thread/context.hpp @@ -97,7 +97,7 @@ namespace fc { } context( fc::thread* t) : -#if BOOST_VERSION >= 105600 && BOOST_VERSION <= 106100 +#if BOOST_VERSION >= 105600 my_context(nullptr), #elif BOOST_VERSION >= 105300 my_context(new bc::fcontext_t), From 212a749cde6914f67c51093742e49b75dad5fc6f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 18:01:09 +0100 Subject: [PATCH 2/7] include/fc/rpc/state.hpp: remove default 2.0 value from jsonrpc --- include/fc/rpc/state.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/fc/rpc/state.hpp b/include/fc/rpc/state.hpp index 9019f4c1f..de6f9a36a 100644 --- a/include/fc/rpc/state.hpp +++ b/include/fc/rpc/state.hpp @@ -6,7 +6,7 @@ namespace fc { namespace rpc { struct request { - std::string jsonrpc = "2.0"; + std::string jsonrpc; optional id; std::string method; variants params; From 20db7c7f6a719562c1a07213d87b0d7b5a97d37f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 19:24:15 +0100 Subject: [PATCH 3/7] src/thread/context.hpp: quieten boost coroutine warnings --- src/thread/context.hpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/thread/context.hpp b/src/thread/context.hpp index 9ba724883..99330f18f 100644 --- a/src/thread/context.hpp +++ b/src/thread/context.hpp @@ -8,6 +8,9 @@ #include +#define BOOST_COROUTINES_NO_DEPRECATION_WARNING // Boost 1.61 +#define BOOST_COROUTINE_NO_DEPRECATION_WARNING // Boost 1.62 + #if BOOST_VERSION >= 105400 # include namespace bc = boost::context; From 61c48f337f17bb19569dc4b823f5c0ffdd4e94ac Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 19:24:44 +0100 Subject: [PATCH 4/7] src/rpc/cli.cpp: quieten unused warning (g++) --- src/rpc/cli.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/rpc/cli.cpp b/src/rpc/cli.cpp index 81438b5c9..055d704e8 100644 --- a/src/rpc/cli.cpp +++ b/src/rpc/cli.cpp @@ -165,6 +165,10 @@ char* my_generator(const char* text, int state) } +#ifdef __GNUC__ +static char** cli_completion( const char * text , int start, int end) __attribute__ ((unused)); +#endif + static char** cli_completion( const char * text , int start, int end) { char **matches; From f4913f76d63e6cfb0584faffb620ee944daa7c69 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 19:36:20 +0100 Subject: [PATCH 5/7] src/compress/miniz.c: avoid misleading-indentation warnings [gcc] --- src/compress/miniz.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/compress/miniz.c b/src/compress/miniz.c index 7123d6226..55a39a0ee 100644 --- a/src/compress/miniz.c +++ b/src/compress/miniz.c @@ -1497,7 +1497,10 @@ tinfl_status tinfl_decompress(tinfl_decompressor *r, const mz_uint8 *pIn_buf_nex { mz_uint8 *p = r->m_tables[0].m_code_size; mz_uint i; r->m_table_sizes[0] = 288; r->m_table_sizes[1] = 32; TINFL_MEMSET(r->m_tables[1].m_code_size, 5, 32); - for ( i = 0; i <= 143; ++i) *p++ = 8; for ( ; i <= 255; ++i) *p++ = 9; for ( ; i <= 279; ++i) *p++ = 7; for ( ; i <= 287; ++i) *p++ = 8; + for ( i = 0; i <= 143; ++i) *p++ = 8; + for ( ; i <= 255; ++i) *p++ = 9; + for ( ; i <= 279; ++i) *p++ = 7; + for ( ; i <= 287; ++i) *p++ = 8; } else { @@ -2281,7 +2284,10 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break; TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE; } - if (!dist) break; q = (const mz_uint16*)(d->m_dict + probe_pos); if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; p = s; probe_len = 32; + if (!dist) break; + q = (const mz_uint16*)(d->m_dict + probe_pos); + if (TDEFL_READ_UNALIGNED_WORD(q) != s01) continue; + p = s; probe_len = 32; do { } while ( (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (TDEFL_READ_UNALIGNED_WORD(++p) == TDEFL_READ_UNALIGNED_WORD(++q)) && (--probe_len > 0) ); if (!probe_len) From 45feb03eb6df12fc4d3a5d9ceaa7e9a968d4fa4c Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 22:14:12 +0100 Subject: [PATCH 6/7] src/compress/miniz.c: avoid unitialized variable --- src/compress/miniz.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compress/miniz.c b/src/compress/miniz.c index 55a39a0ee..c55bfb097 100644 --- a/src/compress/miniz.c +++ b/src/compress/miniz.c @@ -2267,7 +2267,7 @@ static int tdefl_flush_block(tdefl_compressor *d, int flush) #define TDEFL_READ_UNALIGNED_WORD(p) *(const mz_uint16*)(p) static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahead_pos, mz_uint max_dist, mz_uint max_match_len, mz_uint *pMatch_dist, mz_uint *pMatch_len) { - mz_uint dist, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; + mz_uint dist = 0, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; const mz_uint16 *s = (const mz_uint16*)(d->m_dict + pos), *p, *q; mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), s01 = TDEFL_READ_UNALIGNED_WORD(s); From 533111953338904b93cebfdd0ee46257f891066f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 12 Nov 2017 22:14:35 +0100 Subject: [PATCH 7/7] src/compress/miniz.c: avoid dereferencing type-punned pointer [g++-6] --- src/compress/miniz.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/compress/miniz.c b/src/compress/miniz.c index c55bfb097..fe4eff675 100644 --- a/src/compress/miniz.c +++ b/src/compress/miniz.c @@ -2270,7 +2270,8 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe mz_uint dist = 0, pos = lookahead_pos & TDEFL_LZ_DICT_SIZE_MASK, match_len = *pMatch_len, probe_pos = pos, next_probe_pos, probe_len; mz_uint num_probes_left = d->m_max_probes[match_len >= 32]; const mz_uint16 *s = (const mz_uint16*)(d->m_dict + pos), *p, *q; - mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]), s01 = TDEFL_READ_UNALIGNED_WORD(s); + mz_uint8 *c01_src = &d->m_dict[pos + match_len - 1]; + mz_uint16 c01 = TDEFL_READ_UNALIGNED_WORD(c01_src), s01 = TDEFL_READ_UNALIGNED_WORD(s); MZ_ASSERT(max_match_len <= TDEFL_MAX_MATCH_LEN); if (max_match_len <= match_len) return; for ( ; ; ) { @@ -2278,10 +2279,13 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe { if (--num_probes_left == 0) return; #define TDEFL_PROBE \ + { \ next_probe_pos = d->m_next[probe_pos]; \ if ((!next_probe_pos) || ((dist = (mz_uint16)(lookahead_pos - next_probe_pos)) > max_dist)) return; \ probe_pos = next_probe_pos & TDEFL_LZ_DICT_SIZE_MASK; \ - if (TDEFL_READ_UNALIGNED_WORD(&d->m_dict[probe_pos + match_len - 1]) == c01) break; + mz_uint8 *c01_check = &d->m_dict[probe_pos + match_len - 1]; \ + if (TDEFL_READ_UNALIGNED_WORD(c01_check) == c01) break; \ + } TDEFL_PROBE; TDEFL_PROBE; TDEFL_PROBE; } if (!dist) break; @@ -2297,7 +2301,8 @@ static MZ_FORCEINLINE void tdefl_find_match(tdefl_compressor *d, mz_uint lookahe else if ((probe_len = ((mz_uint)(p - s) * 2) + (mz_uint)(*(const mz_uint8*)p == *(const mz_uint8*)q)) > match_len) { *pMatch_dist = dist; if ((*pMatch_len = match_len = MZ_MIN(max_match_len, probe_len)) == max_match_len) break; - c01 = TDEFL_READ_UNALIGNED_WORD(&d->m_dict[pos + match_len - 1]); + mz_uint8 *c01_check = &d->m_dict[probe_pos + match_len - 1]; + c01 = TDEFL_READ_UNALIGNED_WORD(c01_check); } } }