cpp: fixes problem that InterlockedIncrement/Decrement are not found on _WIN32 platform

This commit is contained in:
FURUHASHI Sadayuki 2011-02-24 00:21:54 +09:00
parent 67ab510b5d
commit 0d5708a01d
4 changed files with 9 additions and 4 deletions

View File

@ -40,6 +40,6 @@ copy src\msgpack\type\string.hpp include\msgpack\type\
copy src\msgpack\type\vector.hpp include\msgpack\type\
copy src\msgpack\type\tuple.hpp include\msgpack\type\
copy src\msgpack\type\define.hpp include\msgpack\type\
copy src\msgpack\type\tr1\unordered_map.hpp include\msgpack\type\
copy src\msgpack\type\tr1\unordered_set.hpp include\msgpack\type\
copy src\msgpack\type\tr1\unordered_map.hpp include\msgpack\type\tr1\
copy src\msgpack\type\tr1\unordered_set.hpp include\msgpack\type\tr1\

View File

@ -44,7 +44,7 @@ inline void operator<< (object::with_zone& o, const std::string& v)
o.type = type::RAW;
char* ptr = (char*)o.zone->malloc(v.size());
o.via.raw.ptr = ptr;
o.via.raw.size = v.size();
o.via.raw.size = (uint32_t)v.size();
memcpy(ptr, v.data(), v.size());
}
@ -52,7 +52,7 @@ inline void operator<< (object& o, const std::string& v)
{
o.type = type::RAW;
o.via.raw.ptr = v.data();
o.via.raw.size = v.size();
o.via.raw.size = (uint32_t)v.size();
}

View File

@ -19,6 +19,10 @@
#include "msgpack/unpack_define.h"
#include <stdlib.h>
#ifdef _msgpack_atomic_counter_header
#include _msgpack_atomic_counter_header
#endif
typedef struct {
msgpack_zone* z;

View File

@ -38,6 +38,7 @@ typedef unsigned __int64 uint64_t;
#ifdef _WIN32
#define _msgpack_atomic_counter_header <windows.h>
typedef long _msgpack_atomic_counter_t;
#define _msgpack_sync_decr_and_fetch(ptr) InterlockedDecrement(ptr)
#define _msgpack_sync_incr_and_fetch(ptr) InterlockedIncrement(ptr)