Skip to content

Commit 6cae57c

Browse files
author
huangxiyuan
committed
fix int64 to bool warning
1 parent 1690251 commit 6cae57c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

json_reader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ class JsonReader:public XReader<JsonReader> {
110110
val = v->GetBool();
111111
return true;
112112
} else if (v->IsInt64()) {
113-
val = (bool)(v->GetInt64());
113+
val = (0 != (v->GetInt64()));
114114
return true;
115115
} else {
116116
read_exception("wish bool, but not bool or int", key);

rapidjson_custom.h

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
#ifndef __X_RAPIDJSON_CUSTOME_H
22
#define __X_RAPIDJSON_CUSTOME_H
33

4-
#include <cassert>
5-
#define RAPIDJSON_NOEXCEPT_ASSERT(x) assert(x)
4+
#ifndef RAPIDJSON_NOEXCEPT_ASSERT
5+
#include <cassert>
6+
#define RAPIDJSON_NOEXCEPT_ASSERT(x) assert(x)
7+
#endif
68

7-
#include <stdexcept>
8-
#define RAPIDJSON_ASSERT(x) if(!(x)) throw std::runtime_error(#x)
9+
#ifndef RAPIDJSON_ASSERT
10+
#include <stdexcept>
11+
#define RAPIDJSON_ASSERT(x) if(!(x)) throw std::runtime_error(#x)
12+
#endif
913

10-
#define RAPIDJSON_HAS_STDSTRING 1
14+
#ifndef RAPIDJSON_HAS_STDSTRING
15+
#define RAPIDJSON_HAS_STDSTRING 1
16+
#endif
1117

1218

1319
#endif

test/example.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define XTOSTRUCT_SUPPORT_CHAR_ARRAY
2222
#include <x2struct.hpp>
23-
#include <xtypes.h>
23+
//#include <xtypes.h>
2424

2525
using namespace std;
2626
using namespace x2struct;

0 commit comments

Comments
 (0)