File tree Expand file tree Collapse file tree 4 files changed +7
-5
lines changed Expand file tree Collapse file tree 4 files changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ class RubyStringBuffer {
41
41
capacity = newcap;
42
42
}
43
43
44
- const size_t INITIAL_SIZE = 2048 ;
44
+ static const size_t INITIAL_SIZE = 2048 ;
45
45
46
46
VALUE ruby_string;
47
47
Original file line number Diff line number Diff line change @@ -19,12 +19,12 @@ using namespace rapidjson;
19
19
typedef RubyStringBuffer DefaultBuffer;
20
20
21
21
VALUE encode (VALUE _self, VALUE obj) {
22
- RubyObjectEncoder<DefaultBuffer, Writer<DefaultBuffer>> encoder;
22
+ RubyObjectEncoder<DefaultBuffer, Writer<DefaultBuffer> > encoder;
23
23
return encoder.encode (obj);
24
24
}
25
25
26
26
VALUE pretty_encode (VALUE _self, VALUE obj) {
27
- RubyObjectEncoder<DefaultBuffer, PrettyWriter<DefaultBuffer>> encoder;
27
+ RubyObjectEncoder<DefaultBuffer, PrettyWriter<DefaultBuffer> > encoder;
28
28
return encoder.encode (obj);
29
29
}
30
30
Original file line number Diff line number Diff line change 5
5
6
6
using namespace rapidjson ;
7
7
8
- template <typename B = RubyStringBuffer, typename W=Writer<B>>
8
+ template <typename B = RubyStringBuffer, typename W=Writer<B> >
9
9
class RubyObjectEncoder {
10
10
B buf;
11
11
W writer;
Original file line number Diff line number Diff line change @@ -8,14 +8,16 @@ using namespace rapidjson;
8
8
9
9
class NullHandler : public BaseReaderHandler <UTF8<>, NullHandler> {
10
10
static const int MAX_DEPTH = 256 ;
11
- int depth = 0 ;
11
+ int depth;
12
12
bool push () {
13
13
return depth++ < MAX_DEPTH;
14
14
}
15
15
bool pop () {
16
16
return depth-- > 0 ;
17
17
}
18
18
public:
19
+ NullHandler (): depth(0 ) {
20
+ }
19
21
bool StartObject () { return push (); }
20
22
bool EndObject (SizeType s) { return pop (); }
21
23
bool StartArray () { return push (); }
You can’t perform that action at this time.
0 commit comments