Commit Graph

1427 Commits

Author SHA1 Message Date
jedav
fdb529bd06
Move removeIndex's result instead of copying (#1516)
Currently removeIndex copies the removed value into removed and then
destructs the original, which can cause significant performance overhead.

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 19:53:56 -07:00
Jordan Bayles
8d1ea7054f
Update cmake.yml 2024-09-09 19:07:04 -07:00
Jordan Bayles
d13801e832
Update meson.yml (#1564) 2024-09-09 19:06:30 -07:00
Jordan Bayles
d791737ccd
Create cmake.yml (#1563)
* Create cmake.yml

* Update cmake.yml

* Update cmake.yml
2024-09-09 19:05:11 -07:00
SpaceIm
a4a083c307
remove ccache micro management (#1448)
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 18:57:51 -07:00
Pedro Kaj Kjellerup Nacht
62f7f3efe6
Add security policy (#1484)
Signed-off-by: Pedro Kaj Kjellerup Nacht <pnacht@google.com>
2024-09-09 18:53:23 -07:00
Kapandaria
742c645ab3
Update readFromString.cpp (#1477)
Print the error to screen

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 18:51:35 -07:00
Pavel Tsynk
31754ce2e2
Fixed setting JSONCPP_USE_SECURE_MEMORY definition (#1479)
* Fixed setting JSONCPP_USE_SECURE_MEMORY definition

* fix indent

* Fix passing from command line

* simplified definition

---------

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 18:51:11 -07:00
Pavel Tsynk
483f1c310e
Fix compile on windows with clang (#1480)
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 18:50:38 -07:00
martinduffy1
c04c0c2131
CharReader: Add StructuredError (#1409)
* CharReader: Add Structured Error

Add getStructuredError to CharReader

* run clang format

---------

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
2024-09-09 18:48:54 -07:00
NotWearingPants
c857395951
Update link in amalgamate.py (#1335) 2024-09-09 18:43:32 -07:00
Timo Röhling
d39b0dff0c
Bump CMake policy version to avoid deprecation warning (#1499)
Starting with CMake 3.27, there will be a warning for compat levels
below CMake 3.5.

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 18:42:54 -07:00
Andrea Pappacoda
fd1abe4cca
build(meson): use find_program('python3') (#1386)
If you really want to be sure to always find python3 when running Meson (and not some other implementation like [Muon](https://muon.build)) it is a bit better to use `find_program('python3')`, as described in https://mesonbuild.com/Reference-manual_functions.html#find_program : "if the "python3" program is requested and it is not found in the system, Meson will return its current interpreter

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 18:42:23 -07:00
Jordan Bayles
badbbc7185
Update clang-format.yml 2024-09-09 18:35:49 -07:00
Jordan Bayles
caf5fb0742
Update meson.yml (#1562) 2024-09-09 18:35:36 -07:00
Jordan Bayles
57de64bf69
Add code coverage (#1561)
* Add code coverage

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml
2024-09-09 18:29:28 -07:00
Jordan Bayles
78893d3961
Update clang-format.yml 2024-09-09 18:19:48 -07:00
Philip Top
034976a19d
add a valueToQuotedString overload (#1397)
* add a valueToQuotedString overload to take a string length to support things like a string_view more directly.

* Apply suggestions from code review

Co-authored-by: Billy Donahue <BillyDonahue@users.noreply.github.com>

---------

Co-authored-by: Billy Donahue <BillyDonahue@users.noreply.github.com>
Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 17:38:22 -07:00
vslashg
e1a3c64fef
Fix asserts in Value::setComment (#1445)
The existing asserts seem to not be what was intended; they appear to have been mistranslated in pull/877.

The first assert for `comment.empty()` was previously a check that a provided `const char*` parameter was not null.  The function this replaced accepted empty strings, and the if() statement at the start of this function handles them.

The second assert for `comment[0] == '\0'` was written when `comment` was a `const char*`, and was testing for empty c-string input.  This PR replaces it with `comment.empty()` to match the original intent.

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 17:34:55 -07:00
vslashg
3c2205cd97
Fix out-of-bounds read. (#1503)
getLocationLIneAndColumn would read past the end of the provided buffer if generating an error message at the end of the stream, if the final character was `\r`.

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 17:32:17 -07:00
vslashg
0a9b9d9c6e
Fix a parser bug where tokens are misidentified as commas. (#1502)
* Fix a parser bug where tokens are misidentified as commas.

In the old and new readers, when parsing an object, a comment
followed by any non-`}` token is treated as a comma.

The new unit test required changing the runjsontests.py
flag regime so that failure tests could be run with default settings.

* Honor allowComments==false mode.

Much of the comment handling in the parsers is bespoke, and does not
honor this flag.  By unfiying it under a common API, the parser is
simplified and strict mode is now more correctly strict.

Note that allowComments mode does not allow for comments in
arbitrary locations; they are allowed only in certain positions.
Rectifying this is a bigger effort, since collectComments mode requires
storing the comments somewhere, and it's not immediately clear
where in the DOM all such comments should live.

---------

Co-authored-by: Jordan Bayles <bayles.jordan@gmail.com>
2024-09-09 17:30:16 -07:00
Jordan Bayles
c3a986600f
Update clang-format.yml 2024-09-09 17:19:14 -07:00
Jordan Bayles
073ad7e96e
Update meson.yml 2024-09-09 17:19:04 -07:00
Jordan Bayles
65d92a4313
Update meson.yml (#1554)
* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

Switch to clang-format-check

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

Add multilple OSes

* Update meson.yml

Add ninja version

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml

* Update meson.yml
2024-09-09 17:10:48 -07:00
Jordan Bayles
ccea7db6c3
Clang format updates (#1560)
* add comment space directive

* Fix clang format issue

* wrap in clang-format off
2024-09-09 17:07:11 -07:00
Jordan Bayles
4290915354
Update clang-format.yml 2024-09-09 16:56:02 -07:00
Jordan Bayles
cc28be0590
Update clang-format.yml 2024-09-09 16:54:56 -07:00
Jordan Bayles
255ebc54af
Create clang-format.yml 2024-09-09 16:52:59 -07:00
Jordan Bayles
c8166ddf1c
add comment space directive (#1558) 2024-09-09 16:30:33 -07:00
Jordan Bayles
73c94501ed
Delete .travis_scripts directory (#1556) 2024-09-09 15:50:39 -07:00
Jordan Bayles
d2a9495fda
Delete .travis.yml (#1557) 2024-09-09 15:50:23 -07:00
Jordan Bayles
5c003ecacc
Fix clang format issues (#1555) 2024-09-09 15:48:18 -07:00
Jordan Bayles
6668fa51ee
Delete .github/workflows/c-cpp.yml 2024-09-09 11:50:31 -07:00
Jordan Bayles
79ade90248
Rename meson_build_and_run to meson.yml 2024-09-09 11:46:57 -07:00
Jordan Bayles
01b11d2e4b
Create meson_build_and_run (#1553) 2024-09-09 11:40:13 -07:00
Jordan Bayles
cd8173c6d3
Create c-cpp.yml 2024-09-09 11:39:17 -07:00
Mykola
69098a18b9
Avoid using cmake glob vars if we are a subproject (#1459)
If jsoncpp is a subproject (like a git submodule), setting the
global cmake variables affect the entire project (changes the
structure of the output folders) and these changes prevent it.
2023-06-27 10:42:38 -04:00
Jakob Widauer
3d9bf8ee54
feat: adds front and back methods to Value type (#1458)
Value::front and Value::back
2023-06-07 12:11:01 -04:00
mwestphal
8190e061bc
Fix wrong usage of doxygen groups (#1417) 2022-07-14 17:57:37 -04:00
Jessica Clarke
42e892d96e
Use default rather than hard-coded 8 for maximum aggregate member alignment (#1378)
On CHERI, and thus Arm's Morello prototype, pointers are represented as
hardware capabilities. These capabilities are comprised of not just an
integer address, as is the representation for traditional pointers, but
also bounds, permissions and other metadata, plus a tag bit used as the
validity bit, which provides fine-grained spatial and referential safety
for C and C++ in hardware. This tag bit is not part of the data itself
and is instead kept on the side, flowing with the capability between
registers and the memory subsystem, and any attempt to amplify the
privilege of or corrupt a capability clears this tag (or, in some cases,
traps), rendering them impossible to forge; you can only create
capabilities that are (possibly trivial) subsets of existing ones.

When the capability is stored in memory, this tag bit needs to be
preserved, which is done through the use of tagged memory. Every
capability-sized word gains an additional non-addressable (from the
CPU's perspective; depending on the implementation the tag bits may be
stored in a small block of memory carved out of normal DRAM that the CPU
is blocked from accessing) bit. This means that capabilities can only be
stored to aligned locations; attempting to store them to unaligned
locations will trap with an alignment fault or, if you end up using a
memcpy call, will copy the raw bytes of the capability's representation
but lose the tag, so when it is eventually loaded back as a capability
and dereferenced it will fault.

Since, on 64-bit architectures, our capabilities, used to implement C
language pointers, are 128-bit quantities, this means they need 16-byte
alignment. Currently the various #pragma pack directives, used to work
around (extremely broken and bogus) code that includes jsoncpp in a
context where the maximum alignment has been overridden, hard-code 8 as
the maximum alignment to use, and so do not sufficiently align CHERI /
Morello capabilities on 64-bit architectures. On Windows x64, the
default is also not 8 but 16 (ARM64 is supposedly 8), so this is
slightly dodgy to do there too, but in practice likely not an issue so
long as you don't use any 128-bit types there.

Instead of hard-coding a width, use a directive that resets the packing
back to the default. Unfortunately, whilst GCC and Clang both accept
using #pragma pack(push, 0) as shorthand like for any non-zero value,
MSVC does not, so this needs to be two directives.
2022-01-12 16:27:16 -05:00
luzpaz
a1f1613bdd
Fix various typos (#1350)
Found via `codespell -q 3 -L alue,alse`

Co-authored-by: Christopher Dunn <cdunn2001@gmail.com>
Co-authored-by: Jordan Bayles <jophba@chromium.org>
2021-12-14 18:04:47 -08:00
Tero Kinnunen
2d55c7445f
Parse large floats as infinity (#1349) (#1353)
Return 1.9.1 functionality where values too large to fit in
double are converted to positive or negative infinity.

Commit 645cd04 changed functionality so that large floats cause
parse error, while version 1.9.1 accepted them as infinite.
This is problematic because writer outputs infinity values
as `1e+9999`, which could no longer be parsed back.

Fixed also legacy Reader even though it did not parse large values
even before breaking change, due to problematic output/parse asymmetry.

`>>` operator sets value to numeric_limits::max/lowest value if
representation is too large to fit to double. [1][2] In macos
value appears to be parsed to infinity.

> | value in *val*           | description |
> |--------------------------|-------------|
> | numeric_limits::max()    | The sequence represents a value too large for the type of val |
> | numeric_limits::lowest() | The sequence represents a value too large negative for the type of val |

[1] https://www.cplusplus.com/reference/istream/istream/operator%3E%3E/
[2] https://www.cplusplus.com/reference/locale/num_get/get/

Signed-off-by: Tero Kinnunen <tero.kinnunen@vaisala.com>

Co-authored-by: Tero Kinnunen <tero.kinnunen@vaisala.com>
2021-12-14 18:00:28 -08:00
Christopher Dunn
5defb4ed1a
Merge pull request #1351 from open-source-parsers/drop-deprecation-warnings
Drop compile-time deprecation warning
2021-11-03 12:53:28 -05:00
Christopher Dunn
c4904b2c0d Bump micro version 2021-11-03 11:39:54 -05:00
Christopher Dunn
54a5432c01 Drop compile-time deprecation warning 2021-11-03 11:35:15 -05:00
Christopher Dunn
b22302e560
Merge pull request #1347 from fjtrujy/position_independent_code
Fix POSITION_INDEPENDENT_CODE
2021-11-03 10:41:12 -05:00
Francisco Javier Trujillo Mata
29f9853455 Fix cmake config for POSITION_INDEPENDENT_CODE enabling it just when BUILD_SHARED_LIBS is ON 2021-10-29 10:41:41 +02:00
Christopher Dunn
fa747b1ae3 clang-format is not available by default 2021-10-28 13:38:53 -05:00
Alex Beregszaszi
94a6220f7c
Document skipBom in CharReaderBuilder (#1332) 2021-09-21 01:55:25 -04:00
Jack Ullery
c39fbdac0f
minor fix for code examples (#1317) 2021-08-12 17:08:46 -04:00