From c35bbe54d9f34f6b054f664243492731e32224aa Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Mon, 17 Nov 2014 13:26:49 +0100 Subject: [PATCH 1/3] Writer: fix documentation of stackAllocator param (closes #196) --- include/rapidjson/writer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h index fdade6e..dc41a1b 100644 --- a/include/rapidjson/writer.h +++ b/include/rapidjson/writer.h @@ -59,7 +59,7 @@ public: //! Constructor /*! \param os Output stream. - \param allocator User supplied allocator. If it is null, it will create a private one. + \param stackAllocator User supplied allocator. If it is null, it will create a private one. \param levelDepth Initial capacity of stack. */ Writer(OutputStream& os, StackAllocator* stackAllocator = 0, size_t levelDepth = kDefaultLevelDepth) : From 6b69662ce8d34f72f4789497fef4034ca8e494c5 Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Mon, 17 Nov 2014 13:27:54 +0100 Subject: [PATCH 2/3] Writer: declare constructors as explicit Avoids implicit conversion from an `OutputStream` (or an allocator pointer) to a `Writer` instance. --- include/rapidjson/writer.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/rapidjson/writer.h b/include/rapidjson/writer.h index dc41a1b..02d6680 100644 --- a/include/rapidjson/writer.h +++ b/include/rapidjson/writer.h @@ -62,9 +62,11 @@ public: \param stackAllocator User supplied allocator. If it is null, it will create a private one. \param levelDepth Initial capacity of stack. */ + explicit Writer(OutputStream& os, StackAllocator* stackAllocator = 0, size_t levelDepth = kDefaultLevelDepth) : os_(&os), level_stack_(stackAllocator, levelDepth * sizeof(Level)), hasRoot_(false) {} + explicit Writer(StackAllocator* allocator = 0, size_t levelDepth = kDefaultLevelDepth) : os_(0), level_stack_(allocator, levelDepth * sizeof(Level)), hasRoot_(false) {} From c88cc331d5c9816745082e7e8d1294bc1c5ebdd0 Mon Sep 17 00:00:00 2001 From: "Philipp A. Hartmann" Date: Mon, 17 Nov 2014 13:31:24 +0100 Subject: [PATCH 3/3] DiyFp: avoid shadowing (closes #195) --- include/rapidjson/internal/dtoa.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/internal/dtoa.h b/include/rapidjson/internal/dtoa.h index 9645e9b..289a224 100644 --- a/include/rapidjson/internal/dtoa.h +++ b/include/rapidjson/internal/dtoa.h @@ -45,7 +45,7 @@ RAPIDJSON_DIAG_OFF(effc++) struct DiyFp { DiyFp() {} - DiyFp(uint64_t f, int e) : f(f), e(e) {} + DiyFp(uint64_t fp, int exp) : f(fp), e(exp) {} DiyFp(double d) { union {