Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion SPECS/LICENSES-AND-NOTICES/LICENSES-MAP.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions SPECS/rapidjson/0000-Supress-implicit-fallthrough-in-GCC.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
From fe19b7b6016d446722621fb407738209d1a911e8 Mon Sep 17 00:00:00 2001
From: Harry Wong <harrywong@live.com>
Date: Thu, 4 May 2017 10:08:48 +0800
Subject: [PATCH] Supress implicit fallthrough in GCC

---
include/rapidjson/internal/regex.h | 1 +
1 file changed, 1 insertion(+)

diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
index 1369ea2..6d110bd 100644
--- a/include/rapidjson/internal/regex.h
+++ b/include/rapidjson/internal/regex.h
@@ -29,6 +29,7 @@ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
+RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#endif

#ifdef _MSC_VER
--
2.7.4
26 changes: 26 additions & 0 deletions SPECS/rapidjson/0001-Onley-apply-to-GCC-7.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From cba45fe9de6923b858edb0780e257b7257aa4f7b Mon Sep 17 00:00:00 2001
From: Harry Wong <harrywong@live.com>
Date: Thu, 4 May 2017 10:32:45 +0800
Subject: [PATCH] Onley apply to GCC 7

---
include/rapidjson/internal/regex.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h
index 6d110bd..e1a2faa 100644
--- a/include/rapidjson/internal/regex.h
+++ b/include/rapidjson/internal/regex.h
@@ -29,8 +29,10 @@ RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#ifdef __GNUC__
RAPIDJSON_DIAG_PUSH
RAPIDJSON_DIAG_OFF(effc++)
+#if __GNUC__ >= 7
RAPIDJSON_DIAG_OFF(implicit-fallthrough)
#endif
+#endif

#ifdef _MSC_VER
RAPIDJSON_DIAG_PUSH
--
2.7.4
50 changes: 50 additions & 0 deletions SPECS/rapidjson/0002-Correct-object-copying-in-document_h.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
diff --git a/include/rapidjson/document.h b/include/rapidjson/document.h
index e3e20dfb..95aa8999 100644
--- a/include/rapidjson/document.h
+++ b/include/rapidjson/document.h
@@ -22,6 +22,7 @@
#include "internal/strfunc.h"
#include "memorystream.h"
#include "encodedstream.h"
+#include <algorithm>
#include <new> // placement new
#include <limits>

@@ -69,6 +70,7 @@ class GenericDocument;
*/
template <typename Encoding, typename Allocator>
struct GenericMember {
+ GenericMember() {}
GenericValue<Encoding, Allocator> name; //!< name of member (must be a string)
GenericValue<Encoding, Allocator> value; //!< value of member.
};
@@ -1934,9 +1936,11 @@ private:
void SetArrayRaw(GenericValue* values, SizeType count, Allocator& allocator) {
data_.f.flags = kArrayFlag;
if (count) {
- GenericValue* e = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
- SetElementsPointer(e);
- std::memcpy(e, values, count * sizeof(GenericValue));
+ auto arr = static_cast<GenericValue*>(allocator.Malloc(count * sizeof(GenericValue)));
+ for (SizeType idx = 0; idx < count; ++idx)
+ new (arr + idx) GenericValue;
+ SetElementsPointer(arr);
+ std::copy_n(values, count, arr);
}
else
SetElementsPointer(0);
@@ -1947,9 +1951,11 @@ private:
void SetObjectRaw(Member* members, SizeType count, Allocator& allocator) {
data_.f.flags = kObjectFlag;
if (count) {
- Member* m = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
- SetMembersPointer(m);
- std::memcpy(m, members, count * sizeof(Member));
+ auto arr = static_cast<Member*>(allocator.Malloc(count * sizeof(Member)));
+ for (SizeType idx = 0; idx < count; ++idx)
+ new (arr + idx) Member;
+ SetMembersPointer(arr);
+ std::copy_n(members, count, arr);
}
else
SetMembersPointer(0);
5 changes: 5 additions & 0 deletions SPECS/rapidjson/rapidjson.signatures.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"Signatures": {
"rapidjson-1.1.0.tar.gz" : "bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e"
}
}
72 changes: 72 additions & 0 deletions SPECS/rapidjson/rapidjson.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
Summary: A fast JSON parser/generator for C++ with both SAX/DOM style API
Name: rapidjson
Version: 1.1.0
Release: 6%{?dist}
License: BSD and JSON and MIT
Vendor: Microsoft Corporation
Distribution: Mariner
Group: Development/Tools
URL: https://github.com/Tencent/rapidjson
Source0: https://github.com/Tencent/%{name}/archive/%{name}-%{version}.tar.gz
Patch0: 0000-Supress-implicit-fallthrough-in-GCC.patch
Patch1: 0001-Onley-apply-to-GCC-7.patch
Patch2: 0002-Correct-object-copying-in-document_h.patch
%global debug_package %{nil}
BuildRequires: cmake
BuildRequires: gcc

%description
RapidJSON is a JSON parser and generator for C++. It was inspired by RapidXml.

%package devel
Summary: Fast JSON parser and generator for C++
Group: Development/Libraries/C and C++
Provides: %{name} = %{version}-%{release}

%description devel
RapidJSON is a header-only JSON parser and generator for C++.
This package contains development headers and examples.

%prep
%autosetup -p 1

%build
mkdir build && cd build
cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} -DBUILD_SHARED_LIBS=ON ..
make %{?_smp_mflags}

%install
cd build
make DESTDIR=%{buildroot} install

%check
make test

%files devel
%defattr(-,root,root)
%license license.txt
%dir %{_libdir}/cmake/RapidJSON
%{_libdir}/cmake/RapidJSON/*
%{_libdir}/pkgconfig/*.pc
%{_includedir}
%{_datadir}

%changelog
* Mon Oct 12 2020 Thomas Crain <thcrain@microsoft.com> - 1.1.0-6
- Update Source0
- Licenses verified, added %%license macro

* Fri May 08 2020 Jonathan Chiu <jochi@microsoft.com> - 1.1.0-5
- Fix build failure with gcc 9

* Tue Sep 03 2019 Mateusz Malisz <mamalisz@microsoft.com> - 1.1.0-4
- Initial CBL-Mariner import from Photon (license: Apache2).

* Mon Nov 19 2018 Vasavi Sirnapalli <vsirnapalli@vmware.com> - 1.1.0-3
- Fix makecheck

* Wed Aug 08 2018 Srivatsa S. Bhat <srivatsa@csail.mit.edu> - 1.1.0-2
- Fix build failure with gcc 7.3

* Fri Jun 09 2017 Harish Udaiya Kumar <hudaiyakumar@vmware.com> - 1.1.0-1
- Initial build. First version
10 changes: 10 additions & 0 deletions cgmanifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5011,6 +5011,16 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "rapidjson",
"version": "1.1.0",
"downloadUrl": "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz"
}
}
},
{
"component": {
"type": "other",
Expand Down