Skip to content

Commit ff29a3e

Browse files
author
Taiju Yamada
committed
Fix msvc compilation
1 parent 045f81e commit ff29a3e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

include/mujincontrollerclient/mujinjson.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ inline void LoadJsonValue(const rapidjson::Value& v, unsigned long long& t) {
358358
}
359359
}
360360

361+
#ifndef _MSC_VER
361362
inline void LoadJsonValue(const rapidjson::Value& v, uint64_t& t) {
362363
if (v.IsUint64()) {
363364
t = v.GetUint64();
@@ -381,6 +382,7 @@ inline void LoadJsonValue(const rapidjson::Value& v, int64_t& t) {
381382
throw MujinJSONException("Cannot convert json type " + GetJsonString(v) + " to Int64");
382383
}
383384
}
385+
#endif
384386

385387
inline void LoadJsonValue(const rapidjson::Value& v, double& t) {
386388
if (v.IsNumber()) {
@@ -576,9 +578,11 @@ inline void SaveJsonValue(rapidjson::Value& v, long long t, rapidjson::Document:
576578
v.SetInt64(t);
577579
}
578580

581+
#ifndef _MSC_VER
579582
inline void SaveJsonValue(rapidjson::Value& v, int64_t t, rapidjson::Document::AllocatorType& alloc) {
580583
v.SetInt64(t);
581584
}
585+
#endif
582586

583587
inline void SaveJsonValue(rapidjson::Value& v, unsigned long long t, rapidjson::Document::AllocatorType& alloc) {
584588
v.SetUint64(t);

src/mujinjson.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44

55
#include <fcntl.h>
66
#include <sys/stat.h>
7+
8+
#if defined(_WIN32)
9+
#include <io.h>
10+
#else
711
#include <unistd.h>
12+
#endif
13+
14+
#if defined(_MSC_VER)
15+
#include <BaseTsd.h>
16+
typedef SSIZE_T ssize_t;
17+
#endif
818

919
namespace mujinjson {
1020

0 commit comments

Comments
 (0)