Skip to content

Commit

Permalink
Fix msvc compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiju Yamada committed Dec 8, 2023
1 parent 045f81e commit ff29a3e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/mujincontrollerclient/mujinjson.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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()) {
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 10 additions & 0 deletions src/mujinjson.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@

#include <fcntl.h>
#include <sys/stat.h>

#if defined(_WIN32)
#include <io.h>
#else
#include <unistd.h>
#endif

#if defined(_MSC_VER)
#include <BaseTsd.h>
typedef SSIZE_T ssize_t;
#endif

namespace mujinjson {

Expand Down

0 comments on commit ff29a3e

Please sign in to comment.