Skip to content

Commit 8dae63e

Browse files
committed
Merge branch 'add_std_prefix'
Conflicts: include/msgpack/adaptor/char_ptr.hpp include/msgpack/adaptor/string.hpp
2 parents c1e9f92 + a4aa14d commit 8dae63e

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

include/msgpack/adaptor/char_ptr.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ inline void operator<< (object::with_zone& o, const char* v)
4444
char* ptr = static_cast<char*>(o.zone.allocate_align(size));
4545
o.via.str.ptr = ptr;
4646
o.via.str.size = size;
47-
memcpy(ptr, v, size);
47+
std::memcpy(ptr, v, size);
4848
}
4949

5050
inline void operator<< (object& o, const char* v)

include/msgpack/adaptor/raw.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ struct raw_ref {
4040

4141
bool operator== (const raw_ref& x) const
4242
{
43-
return size == x.size && memcmp(ptr, x.ptr, size) == 0;
43+
return size == x.size && std::memcmp(ptr, x.ptr, size) == 0;
4444
}
4545

4646
bool operator!= (const raw_ref& x) const
@@ -50,13 +50,13 @@ struct raw_ref {
5050

5151
bool operator< (const raw_ref& x) const
5252
{
53-
if(size == x.size) { return memcmp(ptr, x.ptr, size) < 0; }
53+
if(size == x.size) { return std::memcmp(ptr, x.ptr, size) < 0; }
5454
else { return size < x.size; }
5555
}
5656

5757
bool operator> (const raw_ref& x) const
5858
{
59-
if(size == x.size) { return memcmp(ptr, x.ptr, size) > 0; }
59+
if(size == x.size) { return std::memcmp(ptr, x.ptr, size) > 0; }
6060
else { return size > x.size; }
6161
}
6262
};

include/msgpack/adaptor/string.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ inline void operator<< (object::with_zone& o, const std::string& v)
6060
char* ptr = static_cast<char*>(o.zone.allocate_align(size));
6161
o.via.str.ptr = ptr;
6262
o.via.str.size = size;
63-
memcpy(ptr, v.data(), size);
63+
std::memcpy(ptr, v.data(), v.size());
6464
}
6565

6666
inline void operator<< (object& o, const std::string& v)

include/msgpack/object.hpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -212,30 +212,30 @@ inline void operator<< (object::with_zone& o, const object& v)
212212
case type::POSITIVE_INTEGER:
213213
case type::NEGATIVE_INTEGER:
214214
case type::FLOAT:
215-
::memcpy(&o.via, &v.via, sizeof(v.via));
215+
std::memcpy(&o.via, &v.via, sizeof(v.via));
216216
return;
217217

218218
case type::STR: {
219219
char* ptr = static_cast<char*>(o.zone.allocate_align(v.via.str.size));
220220
o.via.str.ptr = ptr;
221221
o.via.str.size = v.via.str.size;
222-
::memcpy(ptr, v.via.str.ptr, v.via.str.size);
222+
std::memcpy(ptr, v.via.str.ptr, v.via.str.size);
223223
return;
224224
}
225225

226226
case type::BIN: {
227227
char* ptr = static_cast<char*>(o.zone.allocate_align(v.via.bin.size));
228228
o.via.bin.ptr = ptr;
229229
o.via.bin.size = v.via.bin.size;
230-
::memcpy(ptr, v.via.bin.ptr, v.via.bin.size);
230+
std::memcpy(ptr, v.via.bin.ptr, v.via.bin.size);
231231
return;
232232
}
233233

234234
case type::EXT: {
235235
char* ptr = static_cast<char*>(o.zone.allocate_align(v.via.ext.size + 1));
236236
o.via.ext.ptr = ptr;
237237
o.via.ext.size = v.via.ext.size;
238-
::memcpy(ptr, v.via.ext.ptr, v.via.ext.size + 1);
238+
std::memcpy(ptr, v.via.ext.ptr, v.via.ext.size + 1);
239239
return;
240240
}
241241

@@ -347,15 +347,15 @@ inline bool operator==(const object& x, const object& y)
347347

348348
case type::STR:
349349
return x.via.str.size == y.via.str.size &&
350-
memcmp(x.via.str.ptr, y.via.str.ptr, x.via.str.size) == 0;
350+
std::memcmp(x.via.str.ptr, y.via.str.ptr, x.via.str.size) == 0;
351351

352352
case type::BIN:
353353
return x.via.bin.size == y.via.bin.size &&
354-
memcmp(x.via.bin.ptr, y.via.bin.ptr, x.via.bin.size) == 0;
354+
std::memcmp(x.via.bin.ptr, y.via.bin.ptr, x.via.bin.size) == 0;
355355

356356
case type::EXT:
357357
return x.via.ext.size == y.via.ext.size &&
358-
memcmp(x.via.ext.ptr, y.via.ext.ptr, x.via.ext.size) == 0;
358+
std::memcmp(x.via.ext.ptr, y.via.ext.ptr, x.via.ext.size) == 0;
359359

360360
case type::ARRAY:
361361
if(x.via.array.size != y.via.array.size) {
@@ -526,20 +526,20 @@ object::object(const T& v, zone* z)
526526
inline object::object(msgpack_object o)
527527
{
528528
// FIXME beter way?
529-
::memcpy(this, &o, sizeof(o));
529+
std::memcpy(this, &o, sizeof(o));
530530
}
531531

532532
inline void operator<< (object& o, msgpack_object v)
533533
{
534534
// FIXME beter way?
535-
::memcpy(&o, &v, sizeof(v));
535+
std::memcpy(&o, &v, sizeof(v));
536536
}
537537

538538
inline object::operator msgpack_object() const
539539
{
540540
// FIXME beter way?
541541
msgpack_object obj;
542-
::memcpy(&obj, this, sizeof(obj));
542+
std::memcpy(&obj, this, sizeof(obj));
543543
return obj;
544544
}
545545

include/msgpack/sbuffer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class sbuffer {
5555
if(m_alloc - m_size < len) {
5656
expand_buffer(len);
5757
}
58-
::memcpy(m_data + m_size, buf, len);
58+
std::memcpy(m_data + m_size, buf, len);
5959
m_size += len;
6060
}
6161

include/msgpack/vrefbuffer.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ class vrefbuffer {
160160
}
161161

162162
char* m = ib->ptr;
163-
::memcpy(m, buf, len);
163+
std::memcpy(m, buf, len);
164164
ib->free -= len;
165165
ib->ptr += len;
166166

@@ -222,7 +222,7 @@ class vrefbuffer {
222222
to->m_tail = nvec + tosize;
223223
}
224224

225-
::memcpy(to->m_tail, m_array, sizeof(iovec)*nused);
225+
std::memcpy(to->m_tail, m_array, sizeof(iovec)*nused);
226226

227227
to->m_tail += nused;
228228
m_tail = m_array;

0 commit comments

Comments
 (0)