profile
viewpoint
Milo Yip miloyip Tencent Hong Kong, China

miloyip/game-programmer 10265

A Study Path for Game Programmer

Tencent/rapidjson 8857

A fast JSON parser/generator for C++ with both SAX/DOM style API

miloyip/json-tutorial 3103

从零开始的 JSON 库教程

miloyip/nativejson-benchmark 1213

C/C++ JSON parser/generator benchmark

miloyip/light2d 531

Light rendering in 2D

miloyip/svpng 427

Minimalistic C function for saving RGB/RGBA image as uncompressed PNG.

miloyip/itoa-benchmark 254

C++ integer-to-string conversion benchmark

miloyip/dtoa-benchmark 176

C++ double-to-string conversion benchmark

miloyip/line 121

2D Line Drawing Samples in C

miloyip/graphvizuml 102

使用 Graphviz 绘画 UML 图

issue commentTencent/rapidjson

Hang when reading JSON

I think it should be due to that, GetObject() returns a value instead of reference. Try:

for(auto b : (*mainSettings)["buttons"].GetObject()) {
TheGreatRambler

comment created time in 23 minutes

issue commentTencent/rapidjson

Write crash in Array with only one record.

If an object has only a key but not an assocaited value, it will assert at EndObject().

normandviking

comment created time in a day

push eventmiloyip/exhippocampus

Milo Yip

commit sha 5d2f1ad050489aa6de646b96ece85d3f6283bbe7

Create sv2020.html

view details

push time in 4 days

push eventmiloyip/misc

Milo Yip

commit sha 1d2c0a26dd413a763aec07465a9e4cfa809ea6df

Create sv2020.html

view details

push time in 4 days

push eventTencent/rapidjson

miloyip

commit sha 2a3f4f8fc45855933db223dae0a50fb7f8c9b0e6

Automatic doxygen build

view details

push time in 5 days

push eventTencent/rapidjson

xpahos

commit sha a895ce150fa2d73f4ee55f8657761a6b3e96236f

Allow escaped apostrophe in values (#1639) * Allow escaped apostrophe in values * Allow escaped apostrophe in values * Canonical flag name * Add translation for escaped apostrophe Co-authored-by: Milo Yip <miloyip@gmail.com>

view details

push time in 5 days

PR merged Tencent/rapidjson

Allow escaped apostrophe in values

Right now if the value has escaped apostrophe this code:

              Ch e = is.Peek();
               if ((sizeof(Ch) == 1 || unsigned(e) < 256) && RAPIDJSON_LIKELY(escape[static_cast<unsigned char>(e)])) {
                   is.Take();
                   os.Put(static_cast<typename TEncoding::Ch>(escape[static_cast<unsigned char>(e)]));
               }

https://github.com/Tencent/rapidjson/blob/master/include/rapidjson/reader.h#L1013

will return 0 in RAPIDJSON_LIKELY because of "'" is not defined and later will throw an error. I think escaped apostrophe(e.g. "{"foo": "bar'buzz"}" is not that case when we need to throw Invalid escape sequence error.

+32 -1

5 comments

4 changed files

xpahos

pr closed time in 5 days

push eventxpahos/rapidjson

Milo Yip

commit sha 270512a7ddae8d35363055380204b0d55c97344b

Add translation for escaped apostrophe

view details

push time in 5 days

pull request commentTencent/rapidjson

Allow escaped apostrophe in values

I think it is a kind of relaxed syntax (like those in #36 ) . But since it is non-standard, I prefer adding a parse flag for enabling this, if this feature would like to be merged.

xpahos

comment created time in 6 days

pull request commentTencent/rapidjson

Allow escaped apostrophe in values

JSON standards do not escape apostrophe.

xpahos

comment created time in 7 days

issue commentTencent/rapidjson

Large (183MB) build products -- best way to minimize this?

RapidJSON does not need to be built per se. The build process is only for tests and examples.

nckswt

comment created time in 8 days

push eventTencent/rapidjson

miloyip

commit sha 2e15513d0d50d4649bb7ae3f1ca85cb58711896d

Automatic doxygen build

view details

push time in a month

push eventTencent/rapidjson

PhoebeHui

commit sha b4cf6e73818529cace66a8bb2118756ffe04aab6

Add vcpkg installation instructions

view details

Milo Yip

commit sha 418331e99f859f00bdc8306f69eba67e8693c55e

Merge pull request #1631 from PhoebeHui/dev/Phoebe/vcpkg_instructions Add vcpkg installation instructions

view details

push time in a month

PR merged Tencent/rapidjson

Add vcpkg installation instructions

RapidJSON is available as a port in VCPKG , documenting the install process here will help users get started by providing a single set of commands to build rapidjson, ready to be included in their projects.

VCPKG is a C++ library manager that simplifies installation for rapidjson and other project dependencies, we also test whether our library ports build in various configurations (dynamic, static) on various platforms (OSX, Linux, Windows: x86, x64, UWP, ARM) to keep a wide coverage for users.

I'm a maintainer for vcpkg, and here is what the port script looks like. We try to keep the library maintained as close as possible to the original library.

+3 -0

2 comments

1 changed file

PhoebeHui

pr closed time in a month

pull request commentTencent/rapidjson

Check before really encoding code points by default.

Thank you for your hard work.

piratf

comment created time in 2 months

push eventTencent/rapidjson

piratf

commit sha 132a2e34c67e81436240a3acb51be96822bf8be0

add code point encoding check ability when using kParseValidateEncodingFlag

view details

piratf

commit sha b24219bb2fa8c51b7d54abeab93fe58e44feb1bd

always inline should not be used here.

view details

piratf

commit sha 01b90420ed2633735c79285f17e8f771c2caf2dd

use static_cast to optimize warning.

view details

piratf

commit sha 8fb58e8cc1a007ea6ffcf968b91da35ee29ca912

add unittest for `EncodeUnsafe` to increase coverage.

view details

piratf

commit sha 596d590e00174b221e9fd8591a02178c3b143d7a

fix [‘>>’ should be ‘> >’ within a nested template argument list]

view details

Milo Yip

commit sha 4842934001dcc3aceb8b358faececade768885c5

Merge pull request #1613 from piratf/Issue1604_ASCIIValidation Check before really encoding code points by default.

view details

push time in 2 months

PR merged Tencent/rapidjson

Check before really encoding code points by default.

Users can undef the macro 'VALIDATE_CODEPOINT' to disable this feature.

+137 -10

6 comments

6 changed files

piratf

pr closed time in 2 months

startedLingDong-/wenyan-lang

started time in 2 months

pull request commentTencent/rapidjson

Check before really encoding code points by default.

Just some warnings to be fixed. I have no more comment.

piratf

comment created time in 2 months

push eventTencent/rapidjson

miloyip

commit sha 52b883a9a6229fcc464ed7c44f98ec6fecce3fd9

Automatic doxygen build

view details

push time in 2 months

push eventTencent/rapidjson

miloyip

commit sha ef0b3f0222899232170212c55a2507b63968cfb2

Automatic doxygen build

view details

push time in 2 months

push eventTencent/rapidjson

ylavic

commit sha b4538b53637b7caf41cd8ce993514d1d54b2d1fb

Fix compilation of sortkeys.cpp with MSVC 2013 (hopefully).

view details

ylavic

commit sha 92f99bc2ee1c04669036ba2a35ef76ad1c2cad79

RAPIDJSON_NOEXCEPT_ASSERT() should never throw. clang warns about throwing from RAPIDJSON_NOEXCEPT_ASSERT() in a nothrow context. If RAPIDJSON_ASSERT() throws it can never be used for _NOEXCEPT_ASSERT(), so use C assert() instead. Finally (and originally), since RAPIDJSON_ASSERT() in "unittest.h" throws, make it define RAPIDJSON_ASSERT_THROWS for RAPIDJSON_NOEXCEPT_ASSERT() to now do the right thing.

view details

Milo Yip

commit sha dfbe1db9da455552f7a9ad5d2aea17dd9d832ac1

Merge pull request #1502 from ylavic/compilation_fixes Compilation fixes

view details

push time in 2 months

PR merged Tencent/rapidjson

Compilation fixes

Commits from PR #1485 that should probably be merged independendly/before.

+7 -3

2 comments

3 changed files

ylavic

pr closed time in 2 months

push eventTencent/rapidjson

Joshua Watt

commit sha 134af9d81132a0abbcdd3fcb51cee0e02543a17a

Remove shadow typedef Removes a duplicate and identical typedef that was causing a 'declaration shadows typedef' (-Wshadow) warning in clang.

view details

Milo Yip

commit sha eeb9d553f83f86e7b5bf22cbacf1d5d8b44608e5

Merge pull request #1617 from JPEWdev/master Remove shadow typedef

view details

push time in 2 months

pull request commentTencent/rapidjson

Remove shadow typedef

Thank you

JPEWdev

comment created time in 2 months

PR merged Tencent/rapidjson

Remove shadow typedef

Removes a duplicate and identical typedef that was causing a 'declaration shadows typedef' (-Wshadow) warning in clang.

+0 -1

2 comments

1 changed file

JPEWdev

pr closed time in 2 months

Pull request review commentTencent/rapidjson

Check before really encoding code points by default.

 class GenericDocument : public GenericValue<Encoding, Allocator> {     //!@name Parse from stream     //!@{ -    //! Parse JSON text from an input stream (with Encoding conversion)+    //! Parse JSON text from an input stream (with codepoint validate)     /*! \tparam parseFlags Combination of \ref ParseFlag.-        \tparam SourceEncoding Encoding of input stream-        \tparam InputStream Type of input stream, implementing Stream concept+        \tparam SourceEncoding Encoding of input stream.+        \tparam CodePointValidation Enable validate or not, implemented by ValidatableEncoder.+        \tparam InputStream Type of input stream, implementing Stream concept.         \param is Input stream to be parsed.         \return The document itself for fluent API.     */-    template <unsigned parseFlags, typename SourceEncoding, typename InputStream>+    template <unsigned parseFlags, typename SourceEncoding, bool CodePointValidation, typename InputStream>

Since it is a compile-time parameter, all conditions involving that parameter should be evaluated at compile-time. Actually, I have not analyzed what is the proper way to resolve this. Should kParseValidateEncodingFlag include this checking?

piratf

comment created time in 3 months

Pull request review commentTencent/rapidjson

Check before really encoding code points by default.

 class GenericDocument : public GenericValue<Encoding, Allocator> {     //!@name Parse from stream     //!@{ -    //! Parse JSON text from an input stream (with Encoding conversion)+    //! Parse JSON text from an input stream (with codepoint validate)     /*! \tparam parseFlags Combination of \ref ParseFlag.-        \tparam SourceEncoding Encoding of input stream-        \tparam InputStream Type of input stream, implementing Stream concept+        \tparam SourceEncoding Encoding of input stream.+        \tparam CodePointValidation Enable validate or not, implemented by ValidatableEncoder.+        \tparam InputStream Type of input stream, implementing Stream concept.         \param is Input stream to be parsed.         \return The document itself for fluent API.     */-    template <unsigned parseFlags, typename SourceEncoding, typename InputStream>+    template <unsigned parseFlags, typename SourceEncoding, bool CodePointValidation, typename InputStream>

I thought it was done via parseFlags...

piratf

comment created time in 3 months

push eventTencent/rapidjson

miloyip

commit sha 29467563ceabc10aeed496685a73da8447e6b802

Automatic doxygen build

view details

push time in 3 months

Pull request review commentTencent/rapidjson

Check before really encoding code points by default.

 struct Transcoder {         unsigned codepoint;         if (!SourceEncoding::Decode(is, &codepoint))             return false;+#ifdef VALIDATE_CODEPOINT

This is not ideal. Since this is a feature, I think it should be better switched on/off via non-type template parameter flag.

piratf

comment created time in 3 months

push eventTencent/rapidjson

piratf

commit sha 6cadd4b2ca192d8b9bcdd951cb81e0fd993b9166

add contributing section in readme.md, introduced the basic cooperation process.

view details

Milo Yip

commit sha 35e480fc4ddf4ec4f7ad34d96353eef0aabf002d

Merge pull request #1609 from piratf/readme_contributing add contributing section in readme.md

view details

push time in 3 months

PR merged Tencent/rapidjson

add contributing section in readme.md

add contributing section in readme.md, introduced the basic cooperation process.

+47 -0

1 comment

1 changed file

piratf

pr closed time in 3 months

issue commentTencent/rapidjson

IsDouble() does not work as expected

This may be a bit confused, but IsDouble() checks whether the value is stored in double representation. You may use IsNumber() instead. And then GetDouble() will do the conversion if neccessary.

ra1u

comment created time in 3 months

Pull request review commentTencent/rapidjson

add contributing section in readme.md

 More [examples](https://github.com/Tencent/rapidjson/tree/master/example) are av   * [parsebyparts](https://github.com/Tencent/rapidjson/blob/master/example/parsebyparts/parsebyparts.cpp): Implements an `AsyncDocumentParser` which can parse JSON in parts, using C++11 thread.   * [filterkey](https://github.com/Tencent/rapidjson/blob/master/example/filterkey/filterkey.cpp): A command line tool to remove all values with user-specified key.   * [filterkeydom](https://github.com/Tencent/rapidjson/blob/master/example/filterkeydom/filterkeydom.cpp): Same tool as above, but it demonstrates how to use a generator to populate a `Document`.++## Contributing++RapidJson welcomes contributions, When contributing, please follow the code bellow.

This sentence is not gramatically correct.

piratf

comment created time in 3 months

Pull request review commentTencent/rapidjson

add contributing section in readme.md

 More [examples](https://github.com/Tencent/rapidjson/tree/master/example) are av   * [parsebyparts](https://github.com/Tencent/rapidjson/blob/master/example/parsebyparts/parsebyparts.cpp): Implements an `AsyncDocumentParser` which can parse JSON in parts, using C++11 thread.   * [filterkey](https://github.com/Tencent/rapidjson/blob/master/example/filterkey/filterkey.cpp): A command line tool to remove all values with user-specified key.   * [filterkeydom](https://github.com/Tencent/rapidjson/blob/master/example/filterkeydom/filterkeydom.cpp): Same tool as above, but it demonstrates how to use a generator to populate a `Document`.++## Contributing++RapidJson welcomes contributions, When contributing, please follow the code bellow.

Note the capitialization is RapidJSON

piratf

comment created time in 3 months

issue commentTencent/rapidjson

RAPIDJSON_ASSERT

I think we try to let the user to choose whatever he wants to. Assertion is for checking invalid usage in the programmer side, it was not intended for runtime checking at first. Using thread local flag is possible, but it also incur a little bit performance overhead.

RoyBellingan

comment created time in 3 months

create barnchTencent/rapidjson

branch : Issue1604_ASCIIValidation

created branch time in 3 months

issue commentTencent/rapidjson

how to use the same document's parsing multiple times

You may clear the allocator manually:

d.SetNull();
d.GetAllocator().Clear();

But this should be simpler:

Document d2;
d.Swap(d2);

To prevent memory allocation, try user buffer.

suspy

comment created time in 3 months

issue commentTencent/rapidjson

Assert on \uXXXX in ASCII encoded document

Can you show an reproducible code example?

brjoha

comment created time in 3 months

issue closedTencent/rapidjson

CMake policy CMP0048 warning

When building as subproject of project using CMake 3.9.6 I get a warning:

CMake Warning (dev) at build/rapidjson-src/CMakeLists.txt:12 (PROJECT): Policy CMP0048 is not set: project() command manages VERSION variables. Run "cmake --help-policy CMP0048" for policy details. Use the cmake_policy command to set the policy and suppress this warning.

The following variable(s) would be set to empty:

PROJECT_VERSION PROJECT_VERSION_MAJOR PROJECT_VERSION_MINOR PROJECT_VERSION_PATCH

This warning is for project developers. Use -Wno-dev to suppress it.

This project does not seem to use these variables, so explicitly setting policy CMP0048 (before project()) either way would silence this warning:

if (POLICY CMP0048)
  cmake_policy(SET CMP0048 NEW)
endif (POLICY CMP0048)

closed time in 3 months

yachoor

push eventTencent/rapidjson

piratf

commit sha 46d980b46aae3a3f7454794921eb01e2b95360c0

fix CMake policy CMP0048 warning #1154

view details

Milo Yip

commit sha 6534506e829a489bda78bc5eac5faa34da0a2c51

Merge pull request #1603 from piratf/cmakelist_upgrade fix CMake policy CMP0048 warning #1154

view details

push time in 3 months

PR merged Tencent/rapidjson

Reviewers
fix CMake policy CMP0048 warning #1154 enhancement

I think it's a good idea to be compatible with the new cmake versions. thank for issue #1154

+7 -2

2 comments

1 changed file

piratf

pr closed time in 3 months

issue commentTencent/rapidjson

可以关闭UTF-8的supportUnicode选项吗

ASCII 就是 supportUnicode = 0

star2sea

comment created time in 3 months

MemberEvent

push eventTencent/rapidjson

miloyip

commit sha 12d986c8f49d2268f533812475a2e4910520364a

Automatic doxygen build

view details

push time in 4 months

pull request commentTencent/rapidjson

Fix ARM NEON under MSVC

Thank you

sylveon

comment created time in 4 months

push eventTencent/rapidjson

Charles Milette

commit sha d5d7171f6d21f2894e67bbe47c9a48e01114700f

Fix ARM NEON under MSVC

view details

Charles Milette

commit sha 07e1d7870ac4a1b5dbdeca69301aeea2efc5a5fd

Fix build error under non-Clang compilers

view details

Charles Milette

commit sha 0d671a2e19afe6f1a8197f0fdf760f219cb4f1f8

Fix signedness error

view details

Charles Milette

commit sha dfc0b35360ddf5ee4159a2e1b29abdce8947d0e0

Update comment

view details

Charles Milette

commit sha 02230fecbf90c588e4100419a7346cb16c98bf27

Change #ifdef to #if defined

view details

Charles Milette

commit sha e54aca70066cbec9e988c7db1d29078b108041f1

Merge branch 'master' of https://github.com/Tencent/rapidjson

view details

Milo Yip

commit sha c4c6a65410d25f8ae1629fa6c86c0fa65bcbc564

Merge pull request #1548 from TranslucentTB/master Fix ARM NEON under MSVC

view details

push time in 4 months

PR merged Tencent/rapidjson

Fix ARM NEON under MSVC

Fixes #1521

+108 -42

4 comments

5 changed files

sylveon

pr closed time in 4 months

issue closedTencent/rapidjson

ARM64 builds fails if Neon is enabled on MSVC

When building rapidjson for ARM64 with RAPIDJSON_NEON defined on MSVC, it will fail to build, because it includes <arm_neon.h>, but this is for ARM 32-bits only on Microsoft's compiler. The right file to include is <arm64_neon.h>

Apparently a fix is incoming, but this was posted in April and we're in June now... https://developercommunity.visualstudio.com/content/problem/201662/arm-neonh-doenst-support-arm64-compiler.html

closed time in 4 months

sylveon

issue commentTencent/rapidjson

48-bit pointer optimization does not work on Solaris x86

I think we can either make a white list or black list for enabling this feature automatically. And we may add assertion to check whether the bits in that pointer are zeros.

ChristianAmmer

comment created time in 4 months

issue commentTencent/rapidjson

error C2061: syntax error: identifier 'stack_'

Which compiler are you using?

rsanthisre

comment created time in 4 months

PR closed miloyip/game-programmer

Keyboard Debugging

void debugKeyboard() {

while (!antKeyboard.checkKeyState(KEY_PRESS_ESC)) {

cout << "Key Code : " << (int) inportb(0x60) << endl;

}

}

+0 -0

2 comments

0 changed file

ghost

pr closed time in 4 months

issue commentTencent/rapidjson

请问下用VC6.0编不过是正常的吗

flagflag

comment created time in 4 months

push eventmiloyip/graphvizuml

Milo Yip

commit sha be63a6bb527e59aace3455e9064a295347812d5d

Fix pdf wrong substitution

view details

push time in 4 months

push eventmiloyip/graphvizuml

Milo Yip

commit sha 58d4d7df06045c3da14b4ea0b69796f656d7ff77

Update pdf

view details

push time in 4 months

push eventmiloyip/graphvizuml

Milo Yip

commit sha 6742749ac7ade3a43b5153c1aa7cb11b70a397c2

Add github repo

view details

push time in 4 months

push eventmiloyip/graphvizuml

Milo Yip

commit sha 6d3c06ec832b4f7190f78d6964a94b674854963f

Add PDF link

view details

push time in 4 months

create barnchmiloyip/graphvizuml

branch : gh-pages

created branch time in 4 months

create barnchmiloyip/graphvizuml

branch : master

created branch time in 4 months

created repositorymiloyip/graphvizuml

created time in 4 months

issue commentTencent/rapidjson

How to prevent the direct memory leak when creating a rapidjson::Value object using new

I am not sure what are you going to do, but you may try:

rapidjson::Value* head = new (allocator.Malloc(sizeof(rapidjson::Value))) rapidjson::Value(rapidjson::kArrayType);
hungptit

comment created time in 4 months

issue commentTencent/rapidjson

need help: How do I get the default value when using `json schema`?

There is no such feature in the current version. Related #1486

membphis

comment created time in 4 months

issue commentTencent/rapidjson

rapidjson::Value可以浅拷贝吗

现在的 DOM 做不到,因为 Value 之间是 ownership 的关系。 但如果目的是生成 JSON,那么 Writer::WriteRawValue() 可以直接写入 JSON 串。

ggggle

comment created time in 4 months

pull request commentTencent/rapidjson

Add kWriteNanAndInfAsNullFlag for writing invalid double values as null

I think this can be done by making a writer wrapper which converts the events.

timwoj

comment created time in 4 months

push eventTencent/rapidjson

miloyip

commit sha 32cc3d1ac988631750ade3562dec320c7874fb8a

Automatic doxygen build

view details

push time in 4 months

pull request commentTencent/rapidjson

fix a typo of doc

Thank you

veekxt

comment created time in 4 months

push eventTencent/rapidjson

VeekXT

commit sha 67b245e07d7e16c16369b9d7d7a1f3aeef96eb8f

doc: fix a typo

view details

Milo Yip

commit sha bb5f966b9939d6cdfbac3462a0410e185099b3af

Merge pull request #1591 from veekxt/patch-1 fix a typo of doc

view details

push time in 4 months

PR merged Tencent/rapidjson

fix a typo of doc
+1 -1

2 comments

1 changed file

veekxt

pr closed time in 4 months

issue commentTencent/rapidjson

遇到这个字符会产生错误

请给与完整、可重现的例子。

lixiaomeng8520

comment created time in 4 months

issue commentTencent/rapidjson

modifying document creating object and removing member causes assert when writing document

Yes, my fault. Sorry for the confusion. The behavior is more similiar to std::vector. Anyway, the reference or iterator will become invalid when modifying a value/document in RapidJSON.

mikealeonetti

comment created time in 4 months

issue commentTencent/rapidjson

modifying document creating object and removing member causes assert when writing document

I traced the code above and found the answer. After calling document.AddMember(), one becomes an invalid reference. This behavior is similiar to C++ containers:

std::map<std::string, int> m;
m.insert({ "apple", 1 });
auto &a = m["apple"];
m.insert({ "orange", 2}); // a becomes invalid reference
a = 3; // error
mikealeonetti

comment created time in 4 months

issue commentTencent/rapidjson

how to GetDouble() ?

Have you tried Document::Parse<kParseFullPrecisionFlag>(...) or kParseNumbersAsStringsFlag?

You can find these flags in the user guide.

dotkt

comment created time in 4 months

push eventTencent/rapidjson

miloyip

commit sha 45c86f15f00cc1245e35b678b6600a092de14b79

Automatic doxygen build

view details

push time in 4 months

push eventTencent/rapidjson

Renny Koshy

commit sha c43697c16cc9b77151012701b578ecc72bc2deed

- Fixed a build issue by initializing "index" in the header file

view details

Milo Yip

commit sha 1a825d24fa322a5fe721624b2ed7a18b6de9b48a

Merge pull request #1529 from rkoshy/master Fixed a build issue by initializing "index" in the header file

view details

push time in 4 months

PR merged Tencent/rapidjson

Fixed a build issue by initializing "index" in the header file

Build on CentOS 6 was failing due to an uninitialized SizeType variable "index". Initialized it to 0 to prevent the warning (which was being treated as an error)

+1 -1

1 comment

1 changed file

rkoshy

pr closed time in 4 months

pull request commentTencent/rapidjson

Fix (Sub-)Value assignment

I suggest adding an unit test for testing this case.

ylavic

comment created time in 4 months

issue closedTencent/rapidjson

Added headers to my project and got thousands of errors

12 errors 28 warnings. Probably something very easy to fix but I can not find anything in the documentation that helps. I am on Windows using VS 2019.

Severity	Code	Description	Project	File	Line	Suppression State
Warning	C26451	Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\biginteger.h	243	
Warning	C26451	Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\diyfp.h	133	
Warning	C26451	Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\diyfp.h	145	
Warning	C26451	Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\diyfp.h	229	
Warning	C26451	Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\strtod.h	136	
Warning	C26451	Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\strtod.h	174	
Warning	C26451	Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2).	mIronAPI	\RAPIDJSON\internal\strtod.h	178	
Warning	C4067	 unexpected tokens following preprocessor directive - expected a newline	mIronAPI		6	
Warning	C4067	 unexpected tokens following preprocessor directive - expected a newline	mIronAPI		7	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	958	
Warning	C4003	 not enough arguments for function-like macro invocation 'min'	mIronAPI	\rapidjson\document.h	964	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	965	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	982	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	983	
Error	C2589	 '(': illegal token on right side of '::'	mIronAPI	\rapidjson\document.h	958	
Error	C2760	 syntax error: unexpected token '(', expected ')'	mIronAPI	\rapidjson\document.h	958	
Error	C2589	 '(': illegal token on right side of '::'	mIronAPI	\rapidjson\document.h	982	
Error	C2760	 syntax error: unexpected token '(', expected ')'	mIronAPI	\rapidjson\document.h	982	
Warning	C4067	 unexpected tokens following preprocessor directive - expected a newline	mIronAPI		6	
Warning	C4067	 unexpected tokens following preprocessor directive - expected a newline	mIronAPI		7	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	958	
Warning	C4003	 not enough arguments for function-like macro invocation 'min'	mIronAPI	\rapidjson\document.h	964	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	965	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	982	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	983	
Error	C2589	 '(': illegal token on right side of '::'	mIronAPI	\rapidjson\document.h	958	
Error	C2760	 syntax error: unexpected token '(', expected ')'	mIronAPI	\rapidjson\document.h	958	
Error	C2589	 '(': illegal token on right side of '::'	mIronAPI	\rapidjson\document.h	982	
Error	C2760	 syntax error: unexpected token '(', expected ')'	mIronAPI	\rapidjson\document.h	982	
Warning	C4067	 unexpected tokens following preprocessor directive - expected a newline	mIronAPI		6	
Warning	C4067	 unexpected tokens following preprocessor directive - expected a newline	mIronAPI		7	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	958	
Warning	C4003	 not enough arguments for function-like macro invocation 'min'	mIronAPI	\rapidjson\document.h	964	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	965	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	982	
Warning	C4003	 not enough arguments for function-like macro invocation 'max'	mIronAPI	\rapidjson\document.h	983	
Error	C2589	 '(': illegal token on right side of '::'	mIronAPI	\rapidjson\document.h	958	
Error	C2760	 syntax error: unexpected token '(', expected ')'	mIronAPI	\rapidjson\document.h	958	
Error	C2589	 '(': illegal token on right side of '::'	mIronAPI	\rapidjson\document.h	982	
Error	C2760	 syntax error: unexpected token '(', expected ')'	mIronAPI	\rapidjson\document.h	982	

closed time in 4 months

digitalhuman

issue commentTencent/rapidjson

Added headers to my project and got thousands of errors

I think there may be some macro defined (or indirectly defined) in "MobileIron.h", which create conflicts. The order of headers in RapidJSON itself should not have issue. It internally should include all necessary dependent headers. I am unsure how would be the best way to solve your problem. But I think another possible way is to create a .cpp which does JSON related things and then pass results (in a user defined data structure) to other parts of the program.

digitalhuman

comment created time in 4 months

issue closedTencent/rapidjson

作者你好,我 想请教一下,这个框架是否能够将变量中文stirng 转成wchar_t? 在文档只看到定量

作者你好,我 想请教一下,这个框架是否能够将变量中文stirng 转成wchar_t? 在文档只看到定量。感谢!

closed time in 4 months

dippac

issue commentTencent/rapidjson

作者你好,我 想请教一下,这个框架是否能够将变量中文stirng 转成wchar_t? 在文档只看到定量

RapidJSON 支持 UTF-8, UTF-16, UTF-32 和 ASCII 编码。其他编码需要使用者自行转换。

dippac

comment created time in 4 months

push eventTencent/rapidjson

miloyip

commit sha 43b934dd7162bc3c055c46f2a0a0d0d1af2d7e14

Automatic doxygen build

view details

push time in 4 months

push eventTencent/rapidjson

Ross Younger

commit sha 4116912cde6a9563faa3ebca40c872e05fc3a9ee

Use C++17 fallthrough tag instead of disabling warning Signed-off-by: Ross Younger <crazyscot@gmail.com>

view details

Milo Yip

commit sha 6a6bed2759d42891f9e29a37b21315d3192890ed

Merge pull request #1582 from crazyscot/master Use C++17 fallthrough tag instead of disabling compiler warning

view details

push time in 4 months

PR merged Tencent/rapidjson

Use C++17 fallthrough tag instead of disabling compiler warning

This is another way to approach #936 #941 #1372 #1513

Signed-off-by: Ross Younger crazyscot@gmail.com

+16 -4

1 comment

2 changed files

crazyscot

pr closed time in 4 months

push eventTencent/rapidjson

miloyip

commit sha e76c7db0424855dc2ecdc86ff200e6e713e66d2c

Automatic doxygen build

view details

push time in 4 months

push eventTencent/rapidjson

FredGan

commit sha a133b16699693c38664f22cb25277e02b7f91a84

Merge pull request #1 from Tencent/master Change all GenericMemberIterator from struct to class

view details

fredgan

commit sha 39db1177bf9b5768ab252e15f38ee328348ff078

fix some misspellings

view details

Milo Yip

commit sha 5592c2eed46632219fb6ce2368cfacf907356ca6

Merge pull request #1544 from fredgan/master 修复文档中的错误

view details

push time in 4 months

PR merged Tencent/rapidjson

修复文档中的错误
+2 -2

2 comments

2 changed files

fredgan

pr closed time in 4 months

issue commentTencent/rapidjson

作者你好,我 想请教一下,这个框架是否能够将变量中文stirng 转成wchar_t? 在文档只看到定量

「中文string」用什么编码?如果是 UTF-8 的话是可以转换成 UTF-16 用 wchar_t 存储。

dippac

comment created time in 5 months

MemberEvent

issue commentTencent/rapidjson

Negative array index can be read in reader.h file

But it is cast to unsigned char first?

Satyaanshu

comment created time in 5 months

MemberEvent
MemberEvent
MemberEvent

issue commentTencent/rapidjson

travis on windows

I think Windows has shell now? travis-doxygen.sh is only for building documents in travis CI automatically and upload to github pages.

ANaumann85

comment created time in 5 months

issue commentTencent/rapidjson

Bazel Support

I have not investigated what is it. But RapidJSON is an header-only library, cmake is only used for building unit tests and examples.

So is it really need to add more build system?

zaucy

comment created time in 5 months

issue closedTencent/rapidjson

Syntax typo in tutorial

rapidjson/doc/tutorial.md:85

// In this case, IsUint()/IsInt64()/IsUInt64() also return true.

IsUInt64() should be IsUint64()

closed time in 5 months

Robadob

issue commentTencent/rapidjson

Syntax typo in tutorial

Fixed

Robadob

comment created time in 5 months

issue commentTencent/rapidjson

Segmentation fault when parse json object

Can the unit tests run properly on your platform? Can you make a simple example that reproduce the problem?

amamidela

comment created time in 5 months

issue commentTencent/rapidjson

Always gets a core dump while creating json string (rapidjson)

I think you should not use StringRef.

MishraKhushbu

comment created time in 5 months

issue closedTencent/rapidjson

请教一个编码问题

下面的代码第一次输出的json字符串是ok的,但是之后将同一个Document多次生成的字符串都不一致,编码有问题。

//
//  main.cpp
//  cppTest
//
//  Created by xxxxx on 2019/8/26.
//  Copyright © 2019 xxxxx. All rights reserved.
//

#include <iostream>
#include "rapidjson/rapidjson.h"
#include "rapidjson/document.h"
#include "rapidjson/stringbuffer.h"
#include "rapidjson/prettywriter.h"

using namespace std;
using namespace rapidjson;

const char *kClasses = "classes";
const char *kCallee = "callees";
const char *kMethods = "methods";
const char *kSystem = "system";
const char *kSuperCls = "superCls";

string format(const char *fmt, ...)
{
    va_list ap;
    va_start(ap, fmt);
    int len = vsnprintf(nullptr, 0, fmt, ap);
    va_end(ap);
    std::string buf(len+1, '\0');
    va_start(ap, fmt);
    vsnprintf(&buf[0], buf.size(), fmt, ap);
    va_end(ap);
    buf.pop_back();
    return buf;
}
string toJsonString(Document &doc) {
    if (!doc.IsNull()) {
        StringBuffer sb;
        PrettyWriter<rapidjson::StringBuffer> writer(sb);
        doc.Accept(writer);    // Accept() traverses the DOM and generates Handler events.
        return sb.GetString();
    }
    return "";
}

class Some {
public:
    Some(){
        clsName = "AppDelegate";
        selName = "application:didFinishLauchWithOptions:";
        isInstanceMethod = true;
    }

    Document jsonDoc;
    string clsName;
    string selName;
    bool isInstanceMethod;
    
    void generatClassBasicJson(const char *clzName, string methodName) {
        
        Value::AllocatorType &alloctor = jsonDoc.GetAllocator();
        if (jsonDoc.IsNull()) {
            jsonDoc.SetObject();
            jsonDoc.AddMember(rapidjson::StringRef(kClasses), Value(kObjectType), alloctor);
        }
        
        if (!jsonDoc[kClasses].HasMember(clzName)) {
            Value clzMeta(kObjectType);
            clzMeta.AddMember(rapidjson::StringRef(kMethods), Value(kObjectType), alloctor);
            Value clzNameVal(kStringType);
            clzNameVal.SetString(rapidjson::StringRef(clzName));
            jsonDoc[kClasses].AddMember(clzNameVal, clzMeta, alloctor);
        }
        
        if (!methodName.empty()) {
            Value &methodMeta = jsonDoc[kClasses][clzName][kMethods];
            if (!methodMeta.HasMember(methodName.c_str())) {
                Value method(kObjectType);
                method.AddMember(rapidjson::StringRef(kCallee), Value(kArrayType), alloctor);
                jsonDoc[kClasses][clzName][kMethods].AddMember(StringRef(methodName.c_str()), method, alloctor);
            }
        }
        
    }
    void addCallee(string desc) {

        string prefix = isInstanceMethod ? "-" : "+";
        string method = format("%s[%s %s]", prefix.c_str(), clsName.c_str(), selName.c_str());
        generatClassBasicJson(clsName.c_str(), method);
        Value &callees = jsonDoc[kClasses][clsName.c_str()][kMethods][method.c_str()][kCallee];
        Value calleeNameVal(kStringType);
        calleeNameVal.SetString(rapidjson::StringRef(desc.c_str()));
        callees.PushBack(calleeNameVal, jsonDoc.GetAllocator());
        
        logJson();
    }
    
    void logJson() {
        string content = toJsonString(jsonDoc);
        cout << content << endl;
    }
};

int main(int argc, const char * argv[]) {
    // insert code here...
    
    Some s = Some();
    s.addCallee("-[SomeClass doSomething]");
    s.logJson();
    s.logJson();
    
    return 0;
}

上面代码的输出:

{
    "classes": {
        "AppDelegate": {
            "methods": {
                "-[AppDelegate application:didFinishLauchWithOptions:]": {
                    "callees": [
                        "-[SomeClass doSomething]"
                    ]
                }
            }
        }
    }
}
{
    "classes": {
        "AppDelegate": {
            "methods": {
                "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000 \207\u0006\u0010\u0000\u0000\u0000\260\272\u0001ication:didFinishLauchWithOptions:]": {
                    "callees": [
                        "-[SomeClass doSomething]"
                    ]
                }
            }
        }
    }
}
{
    "classes": {
        "AppDelegate": {
            "methods": {
                "\u0002\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\207\u0006\u0010\u0000\u0000\u0000\260\u0001\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0001:didFinishLauchWithOptions:]": {
                    "callees": [
                        "\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0002\u0000thing]"
                    ]
                }
            }
        }
    }
}
Program ended with exit code: 0

closed time in 5 months

CroPort
more