Skip to content

Commit 102dba8

Browse files
authored
Merge pull request #860 from ygj6/build
fix github actions failure and use C style casts instead of C++ style casts in zbuffer.h
2 parents 7893d4d + 1a37205 commit 102dba8

File tree

2 files changed

+6
-13
lines changed

2 files changed

+6
-13
lines changed

.github/workflows/gha.yml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,17 +94,10 @@ jobs:
9494
pattern: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
9595
steps:
9696
- uses: actions/checkout@v1
97-
- name: install g++-multilib
98-
run: |
99-
sudo apt-get install g++-multilib
100-
- name: install clang
101-
run: |
102-
sudo apt-get update
103-
sudo apt-get install clang-8
104-
- name: install valgrind
97+
- name: install depends
10598
run: |
10699
sudo apt-get update
107-
sudo apt-get install valgrind
100+
sudo apt-get install g++-multilib clang-8 valgrind
108101
- name: Cache boost
109102
id: cache-boost
110103
uses: actions/cache@v1

include/msgpack/zbuffer.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static inline void msgpack_zbuffer_free(msgpack_zbuffer* zbuf)
100100

101101
static inline bool msgpack_zbuffer_expand(msgpack_zbuffer* zbuf)
102102
{
103-
size_t used = static_cast<size_t>(reinterpret_cast<char*>(zbuf->stream.next_out) - zbuf->data);
103+
size_t used = (size_t)((char *)(zbuf->stream.next_out) - zbuf->data);
104104
size_t csize = used + zbuf->stream.avail_out;
105105

106106
size_t nsize = (csize == 0) ? zbuf->init_size : csize * 2;
@@ -112,7 +112,7 @@ static inline bool msgpack_zbuffer_expand(msgpack_zbuffer* zbuf)
112112

113113
zbuf->data = tmp;
114114
zbuf->stream.next_out = (Bytef*)(tmp + used);
115-
zbuf->stream.avail_out = static_cast<uInt>(nsize - used);
115+
zbuf->stream.avail_out = (uInt)(nsize - used);
116116

117117
return true;
118118
}
@@ -122,7 +122,7 @@ static inline int msgpack_zbuffer_write(void* data, const char* buf, size_t len)
122122
msgpack_zbuffer* zbuf = (msgpack_zbuffer*)data;
123123

124124
zbuf->stream.next_in = (Bytef*)buf;
125-
zbuf->stream.avail_in = static_cast<uInt>(len);
125+
zbuf->stream.avail_in = (uInt)len;
126126

127127
while(zbuf->stream.avail_in > 0) {
128128
if(zbuf->stream.avail_out < MSGPACK_ZBUFFER_RESERVE_SIZE) {
@@ -164,7 +164,7 @@ static inline const char* msgpack_zbuffer_data(const msgpack_zbuffer* zbuf)
164164

165165
static inline size_t msgpack_zbuffer_size(const msgpack_zbuffer* zbuf)
166166
{
167-
return static_cast<size_t>(reinterpret_cast<char*>(zbuf->stream.next_out) - zbuf->data);
167+
return (size_t)((char *)(zbuf->stream.next_out) - zbuf->data);
168168
}
169169

170170
static inline void msgpack_zbuffer_reset_buffer(msgpack_zbuffer* zbuf)

0 commit comments

Comments
 (0)