118 Commits

Author SHA1 Message Date
Milo Yip
fcd2e1f60c Fix #1017 allOf keyword fail with Writer handler
Gave up using static binding for null handler, because it cannot be
used with arbitrary handler type. Change `OutputHandler handler_` to
pointer type.
2017-07-13 16:07:36 +08:00
Milo Yip
df6362d450 Fix patternProperties & additionalProperties lead to ASSERT
Fix #825
2017-06-09 10:16:24 +08:00
Oliver Hahm
885b5cd2f9 common notation of empty if/else case 2017-04-21 14:49:30 +02:00
Oliver Hahm
63423eb6f8 fix return values 2017-04-21 14:49:12 +02:00
StilesCrisis
4643104b8a Fix null handler construction
We should not malloc the null-handler object and cast to OutputHandler;
we need to actually invoke the constructor via placement new.
2017-02-27 23:28:25 -08:00
Milo Yip
97e2f7f16f Try fixing Error compilation Ubuntu 14.04 #834 2017-02-28 09:48:36 +08:00
Zhihao Yuan
3cc77d5d63
Treat signed-unsigned conversions as errors. 2017-01-18 18:09:18 -06:00
Andrey Glebov
41ceb8624f - replaced RAPIDJSON_NEW with C++98 compatible version 2016-12-21 14:03:53 +03:00
Andrey Glebov
9fe93bb984 - replaced RAPIDJSON_NEW macro with variadic varient 2016-12-21 10:17:25 +03:00
Milo Yip
992b7f5f8e Fix nullHandler allocation bug 2016-10-21 12:25:37 +08:00
Milo Yip
bf0cc7bea8 Fixed a bug for SchemaDocument move constructor 2016-10-18 13:53:00 +08:00
Milo Yip
7c4e511eb0 Change Schema::GetTypeless() from singleton to instance
Now owned by SchemaDocument::typeless_, and be shared to its
Schema::typeless_
2016-10-18 11:37:15 +08:00
Milo Yip
ddbd2ef05d Restore missing deallocation of GenericSchemaValidator::nullHandler_ 2016-10-18 10:14:00 +08:00
Milo Yip
b963eb447b Change SchemaValidator::GetNullHandler() from singleton to instance. 2016-10-17 18:30:18 +08:00
Milo Yip
517dd4dbb8 Fix failing to resolve $ref in allOf causes crash in SchemaValidator::StartObject() 2016-10-17 14:25:24 +08:00
Milo Yip
769185d68b Refactor regex
Remove mutable which causes reentrant issue
2016-09-16 12:13:02 +08:00
niukuo
250cf666d3 fix wrong length in remote schema
Change-Id: Ia96ddf5746f1c18968e9e086f17fe4a24b8480d7
2016-08-31 16:26:27 +08:00
Jason Smith
899156172d Make GenericSchemaDocument constructor explicit
Prior to this change, a user could incorrectly pass a Document object to
SchemaValidator. This would implicitly construct a SchemaDocument, which
would then be destructed before the validator was used. This caused
unpredictable results including memory corruption and program crashes.
2016-07-01 06:59:07 -07:00
Philipp A. Hartmann
f6a07692f9 Fix warnings on GCC 6 and later (closes #666)
* document.h
  * suppress -Wterminate on GCC 6.x and later
  * simplify warning handling
* schema.h
  * drop RAPIDJSON_NOEXCEPT from GenericSchemaDocument constructor
    (calls RAPIDJSON_NEW anyway)
  * simplify warning handling
    (avoids RAPIDJSON_POP mismatch on Clang)
* encodingtest.cpp, istreamwrappertest.cpp
  * work around -Wdangling-else
* readertest.cpp
  * suppress -Wdangling-else
2016-06-23 21:42:16 +02:00
Eli Fidler
8074b722f0 avoid reference to null pointer and member access within null pointer
UBSAN gave issues with the typeless Schema:
runtime error: reference binding to null pointer of type 'rapidjson::GenericSchemaDocument<rapidjson::GenericValue<rapidjson::UTF16<wchar_t>, rapidjson::MemoryPoolAllocator<rapidjson::CrtAllocator> >, rapidjson::CrtAllocator>'
and
runtime error: member access within null pointer of type 'AllocatorType' (aka 'rapidjson::CrtAllocator')
2016-06-13 07:24:26 -07:00
Milo Yip
a6571d504a Combine objectDependices and objectRequired into propertyExist array 2016-04-19 15:10:28 +08:00
Milo Yip
f586edd33d Fix required for duplicated keys
Fix #608
2016-04-19 15:06:41 +08:00
Milo Yip
ba0a137b9c Remove unnecessary code in GenericSchemaDocument::CreateSchemaRecursive() 2016-04-17 09:17:05 +08:00
Milo Yip
cb2f340d55 Remove ISchemaStateFactory::ReallocState() 2016-04-17 09:11:00 +08:00
Milo Yip
e7149d6659 Fix memory leak for invalid regex 2016-04-17 00:58:32 +08:00
Milo Yip
26e69ffde9 Fix a bug in schema minimum/maximum keywords for 64-bit integer 2016-04-17 00:48:02 +08:00
Milo Yip
44d114f3ee Supress VC C4512 warning 2016-04-06 00:47:16 +08:00
Milo Yip
c843a2655b Try to fix all /W4 warnings in VC2015 2016-04-04 15:01:34 +08:00
Sergey Kosarevsky
22d22145d2 Added GenericSchemaValidator::RawNumber() 2016-02-29 18:05:24 +01:00
Sergey Kosarevsky
2bbfe0d8a8 Number() -> RawNumber() to avoid name clashes with the union Number 2016-02-28 18:50:04 +01:00
Sergey Kosarevsky
334461b421 Added Hasher::Number() 2016-02-28 18:28:19 +01:00
Milo Yip
db4bc75cd9 Add move constructor for GenericSchemaDocument 2016-02-20 22:18:23 +08:00
Milo Yip
8cb978dc15 Add fwd.h and extract stream.h 2016-02-02 18:20:36 +08:00
Milo Yip
dd2076f8d8 Minor refactoring 2016-02-02 12:56:53 +08:00
Milo Yip
ba7aa979a5 Refactoring: Remove GenericSchemaValiadator::nullOutputHandler_ 2016-02-02 10:17:06 +08:00
Milo Yip
02ea9f9db6 Refactor: remove unncessary template member functions 2016-02-02 10:00:27 +08:00
Milo Yip
f9d1e423ba Refactoring: remove GenericSchemaDocument::document_ 2016-02-02 09:52:00 +08:00
Milo Yip
13ee68c910 Add API doc for schema 2016-02-02 00:43:01 +08:00
Milo Yip
55d2867841 Add SchemaValidatingReader ::IsValid() 2016-01-31 22:36:19 +08:00
Milo Yip
b8b7dfedd1 Fix partial specialization issue 2016-01-30 23:07:51 +08:00
Milo Yip
a33af83ee4 Optimization for Regex and Schema 2016-01-30 22:41:09 +08:00
Milo Yip
ea62c64add Fix clang warning 2016-01-27 14:22:05 +08:00
Milo Yip
63ae3b730a Fix memory leak 2016-01-27 14:17:24 +08:00
Milo Yip
05968b7031 Fix schema tests and added SchemaValidatingReader 2016-01-27 13:59:14 +08:00
Milo Yip
d4d03cab1c Use internal regex as default in schema validator 2015-05-29 19:04:17 +08:00
miloyip
85c8b657c0 Achieve zero heap allocation for SchemaValidator.TestSuite 2015-05-17 22:22:53 +08:00
miloyip
3919348602 Refactor hasher construction 2015-05-17 20:43:52 +08:00
miloyip
69c58b584f Use state allocator for all context states 2015-05-17 18:58:57 +08:00
miloyip
87d1f95551 Use state allocator for creating parallel validators 2015-05-17 18:06:43 +08:00
miloyip
7ef7ba13f0 Refactor: aggregate parallel validators 2015-05-17 13:07:12 +08:00