MSVC2005 compatibility (@hotpepsi++)

This commit is contained in:
frsyuki
2010-02-02 10:52:42 +09:00
parent 34b3bbc883
commit 7df60b259b
5 changed files with 21 additions and 10 deletions

View File

@@ -19,7 +19,6 @@
#define MSGPACK_OBJECT_H__
#include "msgpack/zone.h"
#include "msgpack/sysdep.h"
#include <stdio.h>
#ifdef __cplusplus

View File

@@ -104,7 +104,6 @@ static inline void init_finalizer_array(msgpack_zone_finalizer_array* fa)
static inline void call_finalizer_array(msgpack_zone_finalizer_array* fa)
{
// 逆順に呼び出し
msgpack_zone_finalizer* fin = fa->tail;
for(; fin != fa->array; --fin) {
(*(fin-1)->func)((fin-1)->data);
@@ -132,9 +131,6 @@ bool msgpack_zone_push_finalizer_expand(msgpack_zone* zone,
size_t nnext;
if(nused == 0) {
// 初回の呼び出しfa->tail == fa->end == fa->array == NULL
// glibcは72バイト以下のmallocが高速
nnext = (sizeof(msgpack_zone_finalizer) < 72/2) ?
72 / sizeof(msgpack_zone_finalizer) : 8;

View File

@@ -18,6 +18,7 @@
#ifndef MSGPACK_ZONE_H__
#define MSGPACK_ZONE_H__
#include "msgpack/sysdep.h"
#include <stddef.h>
#include <stdbool.h>

View File

@@ -29,11 +29,15 @@ inline std::vector<T>& operator>> (object o, std::vector<T>& v)
{
if(o.type != type::ARRAY) { throw type_error(); }
v.resize(o.via.array.size);
object* p = o.via.array.ptr;
object* const pend = o.via.array.ptr + o.via.array.size;
T* it = &v.front();
for(; p < pend; ++p, ++it) {
p->convert(it);
if(o.via.array.size > 0) {
object* p = o.via.array.ptr;
object* const pend = o.via.array.ptr + o.via.array.size;
T* it = &v[0];
do {
p->convert(it);
++p;
++it;
} while(p < pend);
}
return v;
}

View File

@@ -46,6 +46,17 @@ typedef unsigned int _msgpack_atomic_counter_t;
#endif
#ifdef __cplusplus
/* numeric_limits<T>::min,max */
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
#endif
#ifdef _WIN32
#include <winsock2.h>
#else