From ff29a3e35e5f3e0918bf55e522372fa093127730 Mon Sep 17 00:00:00 2001 From: Taiju Yamada Date: Fri, 8 Dec 2023 11:18:36 +0900 Subject: [PATCH] Fix msvc compilation --- include/mujincontrollerclient/mujinjson.h | 4 ++++ src/mujinjson.cpp | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/mujincontrollerclient/mujinjson.h b/include/mujincontrollerclient/mujinjson.h index 6c7235bf..f8c4eeb0 100644 --- a/include/mujincontrollerclient/mujinjson.h +++ b/include/mujincontrollerclient/mujinjson.h @@ -358,6 +358,7 @@ inline void LoadJsonValue(const rapidjson::Value& v, unsigned long long& t) { } } +#ifndef _MSC_VER inline void LoadJsonValue(const rapidjson::Value& v, uint64_t& t) { if (v.IsUint64()) { t = v.GetUint64(); @@ -381,6 +382,7 @@ inline void LoadJsonValue(const rapidjson::Value& v, int64_t& t) { throw MujinJSONException("Cannot convert json type " + GetJsonString(v) + " to Int64"); } } +#endif inline void LoadJsonValue(const rapidjson::Value& v, double& t) { if (v.IsNumber()) { @@ -576,9 +578,11 @@ inline void SaveJsonValue(rapidjson::Value& v, long long t, rapidjson::Document: v.SetInt64(t); } +#ifndef _MSC_VER inline void SaveJsonValue(rapidjson::Value& v, int64_t t, rapidjson::Document::AllocatorType& alloc) { v.SetInt64(t); } +#endif inline void SaveJsonValue(rapidjson::Value& v, unsigned long long t, rapidjson::Document::AllocatorType& alloc) { v.SetUint64(t); diff --git a/src/mujinjson.cpp b/src/mujinjson.cpp index 2654a946..7a166836 100644 --- a/src/mujinjson.cpp +++ b/src/mujinjson.cpp @@ -4,7 +4,17 @@ #include #include + +#if defined(_WIN32) +#include +#else #include +#endif + +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#endif namespace mujinjson {