Commit Graph

73 Commits

Author SHA1 Message Date
ItsAlbertZhang
ad337a8a86 fix: compilation error with libc++ 2024-03-19 16:59:39 +01:00
sina-rostami
106aeb0f0d Add indentation to json dump method
Closes #747
2024-03-10 21:41:43 +01:00
JuneHan
973d5fa1cd
fix: minimize the precision loss when dumping double to string (#712)
* fix: minimize the precision loss when dumping double to string
* abandon one-time macro
* replace hard-coded buffer size, replace `sprintf` with `snprintf`
* replace `DECIMAL_DIG` with `DBL_DECIMAL_DIG`
* Update json.h changed to C++11 DECIMAL_DIGIT
* added cfloat include
* identify float and double as different numeral types, and approach their precisions accordingly

---------

Co-authored-by: June Han <jun_h@pretia.co.jp>
Co-authored-by: gittiver <gulliver@traumkristalle.net>
2024-01-29 15:25:26 +01:00
keith-dev
6aed71e3c4
fix build: android/termux/clang-17.0 (#736)
* fix build: android/termux/clang-17.0

* Android build links with liblog in places
2024-01-04 10:46:21 +01:00
Corentin Schreiber
42fab729a2 Add missing const to mustache and json::wvalue::operator[] 2023-07-08 13:04:48 +01:00
Gulliver
bb58cc1a8b removed superfluous move of temporary. 2023-06-14 08:46:40 +02:00
Marc Robert
4eb78bb366
Fixed compilation under android ndk, operator = was undefined 2023-05-12 00:49:57 +02:00
Gabriel Schlozer
215834f8f9
Added a static method which create an empty json value crow::json::wvalue (outputs "{}" instead of a "null" string) (#602) 2023-03-30 14:09:36 +02:00
Gulliver
a77d7bd84f fix warning on non MS systems for using sprintf instead of snprintf 2022-12-25 18:24:51 +01:00
Andrea Cocito
c8e376cfa5
Apply workaround for Apple to FreeBSD aswell
Maybe these should be triggered by __clang__?
2022-12-12 21:06:42 +01:00
Vladislav Oleshko
c105a86a7a Fix struct/class divergence 2022-07-22 00:45:40 +03:00
Vladislav Oleshko
ea4c672a41 Emulate variant with json wvalue for C++11/14 2022-06-22 17:02:16 +03:00
Farook Al-Sammarraie
454dabdba2
formatting 2022-06-21 02:56:07 +03:00
The-EDev
ab2a132bff
fixed error in json float dump (where a pointer was checked against nullptr instead of '\0') 2022-06-21 02:25:42 +03:00
The-EDev
c2d1bfac38 Fix wvalue::Operator = (wvalue && r); 2022-06-20 05:52:30 +03:00
Luca Schlecker
e7a04859fe r_string: combine equality operation algorithm.
A private templated function containing the algorithm is used to prevent repetition.
2022-06-18 17:21:37 +03:00
Luca Schlecker
9cffc3f268 json: add missing r_string comparison operator. 2022-06-18 17:21:37 +03:00
Luca Schlecker
4aa9b3e89b json: replace std::equal to maintain C++11 compatibility. 2022-06-18 17:21:37 +03:00
Luca Schlecker
5336d0fff7 json: replace remaining boost functions with their std equivalent. 2022-06-18 17:21:37 +03:00
Luca Schlecker
df92d6d639 replace boost::lexical_cast with an equivalent based on std::stringstream. 2022-06-18 17:21:37 +03:00
Luca Schlecker
f3d00bbecf replace boost::asio with standalone asio. 2022-06-18 17:21:37 +03:00
Luca Schlecker
78f764791e remove 'using namespace boost' declarations. 2022-06-18 17:21:37 +03:00
The-EDev
5f18548369
Fixed problem where GCC < 6 wouldn't compile Crow 2022-03-30 15:50:11 +03:00
The-EDev
9a7677bf1a
Applied changes from review
Also moved builtin_expect to utility.h (for use in sanitizer function)
2022-02-11 00:56:30 +03:00
Farook Al-Sammarraie
ab50fb3134
Merge branch 'master' into parser_optimization 2022-02-11 00:46:19 +03:00
Vhuynh25
07a2422c63
changed output to null and changed warning message
also changed from <cmath> to <math.h>
2022-02-08 15:45:49 -08:00
Vhuynh25
c44fec82bf
added space to match clang format 2022-02-06 11:58:41 -08:00
The-EDev
175b004c26
code formatting (also disabled formatting where not applicable) 2022-02-06 22:29:46 +03:00
The-EDev
75b100527f
Merge branch 'refs/heads/master' into parser_optimization 2022-02-05 18:35:01 +03:00
The-EDev
4cdde73388
Optimized HTTP parser
Also (likely) fixed problem with streaming without keeping connection
alive
Also fixed problem with multipart hanging on request
Also updated TODO entries to indicate Writer
2022-02-05 18:15:19 +03:00
Vhuynh25
781a40bee1
fixed clang format 2022-02-03 09:07:54 -08:00
Vien Huynh
c21ae7ea3e change NaN output warning message 2022-02-01 16:40:07 -05:00
Vien Huynh
a134e2b9ff fixed NaN handling errors 2022-02-01 15:31:09 -05:00
Vien Huynh
9af906dc21 fixed JSON outputting NaN and infinite values 2022-01-30 23:43:30 -05:00
Thomas Neumann
3569c93984 defend against excessive recursion in json::load
Passing a deeply nested JSON structure to json::load leads to a crash
due to stack overflow. We handle this now gracefully by limiting the
maximum nesting depth to 10,000.

Test case:

https://github.com/nst/JSONTestSuite/blob/master/test_parsing/n_structure_100000_opening_arrays.json
2022-01-25 08:48:36 +01:00
Farook Al-Sammarraie
790e34cea8
Merge branch 'master' into mustache_lambdas 2021-12-17 09:08:24 +03:00
Mosolov Sergey
d59cda5677 Fixes issue 302
https://github.com/CrowCpp/Crow/issues/302
Escape only the invisible characters from 0 to 31 inclusive
Motivation: do not escape UTF8 encoding bytes
2021-12-17 08:47:00 +04:00
The-EDev
f6fd7dc85d
formatting, missing newline fixed 2021-12-11 02:38:30 +03:00
The-EDev
a1a4169d92
merge branch master 2021-12-10 05:12:24 +03:00
The-EDev
94a2f942bc
changed comment style back to the original (doxygen did not work with the new style) 2021-12-03 06:39:23 +03:00
The-EDev
03e59aa446
improved bracing rules, commented out clang-format 14 rule 2021-11-27 15:28:50 +03:00
The-EDev
7f4b7c8ff9
created new rules, used bot to enforce rules in PRs 2021-11-25 14:45:38 +03:00
Farook
eefe8f62bf made it so that workarounds would only run if the user is on an apple machine 2021-10-22 14:27:10 +03:00
The-EDev
efd55597f0 changed json and app code (relating to blueprints and initializer list)
also snuck in some guide updates
2021-10-10 14:42:36 +03:00
The-EDev
f5338260bb several changes:
added json list in a similar fashion to json object
renamed object_type to object
updated readme, index.html, and json.md to include objects and lists
updated examples to be slightly cleaner and include lists
replaced instances of json object (std::map and such) with the short version (object)
accurate floating point number dumping (`6.0` instead of `6`) while taking 1/30th of the time (29 microseconds saved)
added json list testing
snuck in utf-8 middleware warning fix
snuck in twitter card style for crowcpp.org site (makes social media cards look way better with a large image)
2021-08-20 03:57:21 +03:00
Lucas David
1e52b0182d ~ Corrected code as mentionned in review comments. 2021-08-11 22:25:58 +02:00
Lucas David
8f10f92627
Merge branch 'master' into feature-#189 2021-08-11 21:57:54 +02:00
Lucas David
df41cbec49 ~ Replaced foreach character type unsigned char by auto to resolve issue #195. 2021-08-11 15:43:40 +02:00
Lucas David
235f2b9ef4 + Added (implicit) constructors for json "supported" types.
+ added corresponding tests.
+ Added json-map examples.
2021-08-09 14:32:51 +02:00
Lucas David
762af68306 + Added object constructor and assignment for json::wvalue and unit tests.
+ json::wvalue::wvalue(std::initializer_list<std::pair<std::string const, json::wvalue>>
  + json::wvalue::wvalue(std::[unordered_]map<std::string, json::wvalue> const&)
  + json::wvalue::wvalue(std::[unordered_]map<std::string, json::wvalue>&&)
  + json::wvalue::operator=(std::initializer_list<std::pair<std::string const, json::wvalue>>)
  + json::wvalue::operator=(std::[unordered_]map<std::string, json::wvalue> const&)
  + json::wvalue::operator=(std::[unordered_]map<std::string, json::wvalue>&&)
2021-08-09 14:32:51 +02:00