Commit Graph

923 Commits

Author SHA1 Message Date
Sean Bright
76300601d9 Add runtime version checking functions
This patch adds two new exported functions:

* `jansson_version_str` - Returns a human-readable version number
* `jansson_version_cmp` - Returns an integer less than, equal to, or greater
  than zero if the runtime version of Jansson is found, respectively, to be
  less than, to match, or be greater than the provided major, minor, and micro.
2019-03-12 13:03:34 -04:00
Petri Lehtinen
f4498d2856 CHANGES: Fix 2.12 release date 2018-11-26 10:59:06 +02:00
Petri Lehtinen
71c4e8ec21
Merge pull request #448 from coreyfarrell/2.12
jansson 2.12
2018-11-26 09:10:04 +01:00
Corey Farrell
10afd33efb
jansson 2.12 2018-11-25 03:40:56 -05:00
Corey Farrell
2a31c4f475
Merge pull request #447 from vsoch/update/install-readme
Update/install readme
2018-11-25 02:40:09 -05:00
vsoch
f44c137a84 extra comma! 2018-11-24 23:29:14 -08:00
vsoch
7197810714 small updates to README 2018-11-24 23:27:23 -08:00
Corey Farrell
4ba5c7cc5d
Merge pull request #445 from coreyfarrell/fix-444
Remove inappropriate jsonp_free which caused segmentation fault.
2018-11-08 16:00:32 -05:00
Corey Farrell
e262ea5fcd
Remove inappropriate jsonp_free which caused segmentation fault.
pack_string should never free str on error.  This wouldn't be a problem
except the check for `ours` was inverted.  Just remove the check for
ours since the true condition is unreachable.

json_vpack_ex also had an error check for s.has_error.  This can never
be true unless value is NULL.

Expand pack_unpack testing to cover empty format string, NULL object
value with non-null concatenated key, array containing a non-null object
after a NULL (error) string.

Fixes #444
2018-11-05 16:49:22 -05:00
Corey Farrell
6ac0eefed0
Merge pull request #436 from edgale/warnings
removed various warnings
2018-10-17 06:29:47 -04:00
Maximilian Röhrle
226b34d546
fixed extra bracket 2018-10-15 07:05:02 +02:00
Maximilian Röhrle
d115953347 removed explicit casts 2018-10-15 06:58:19 +02:00
Corey Farrell
15f77c8f47
Merge pull request #439 from coreyfarrell/codecoverage
Fix code coverage ignored paths.
2018-09-29 15:37:56 -04:00
Corey Farrell
ef080d17b5
Fix code coverage ignored paths.
* Replace 'tests/*' with '*/test/*'.
* Replace '/usr/*' with '/usr/include/*'.  This resolves an issue where
  it was impossible to test code coverage with the source in /usr/src.
* Ignore build/include/jansson.h as we just want src/jansson.h.
2018-09-29 14:36:54 -04:00
Corey Farrell
4f91b1d072
Merge pull request #438 from coreyfarrell/issue-437
json_pack: Improve handling of formats with '?' and '*'.
2018-09-28 14:47:33 -04:00
Corey Farrell
8d659113d5
More work on json_pack error reporting.
* Remove errant line-feed from pack_object error message.
* Correct error message in pack_object_inter.
* Create pack_integer / pack_real to get the correct error messages on
  failure when packing numeric values.
* Add tests for packing NAN and infinity directly, in an array and as
  an object value.
2018-09-25 18:03:06 -04:00
Corey Farrell
5df5fc5b13
json_pack: Improve handling of formats with '?' and '*'.
When NULL is received for an optional argument we should not set an
error message as this would block later error messages. If NULL is
received for a non-optional string we should set has_error. Set
has_error for UTF-8 errors to ensure optional strings with UTF-8
errors are not replaced with json_null(). Use 'purpose' argument in
NULL error messages of read_string.

Add error handling and tests for invalid formats where '+', '#', or '%'
is used on an optional string 's?' or 's*'.

Fix NULL string error messages to use 'purpose'.

Refactor skipping of '*' token, this is now handled by read_string and
pack_object_inter. This allows invalid format strings such as 's*#' and
's*+' to produce error messages.

Fixes #437
2018-09-25 16:35:19 -04:00
Petri Lehtinen
e65a490c44
Merge pull request #435 from edgale/master
unreferenced variable fix
2018-09-04 06:25:45 +03:00
Maximilian Röhrle
fc591913ac removed various warnings 2018-08-31 09:01:36 +02:00
Maximilian Röhrle
d83d3d9172 This fixes https://github.com/akheron/jansson/issues/434 2018-08-30 14:45:28 +02:00
Petri Lehtinen
020cc26b5c Rename a varialble that shadows another one
Fixes #430
2018-08-12 18:25:51 +03:00
Michal Privoznik
360b1ef5a1 Enable -Bsymbolic-functions linker flag whenever possible
It was discovered fairly recently that JSON parsing libraries use
common pattern to name their exported symbols (they all use
json_ prefix). So eventually it happens that two symbols from two
different libraries have the same name. This will lead to cryptic
crashes (see [1] and [2]). Linking with -Bsymbolic-functions
prevents this.

1: https://gitlab.gnome.org/GNOME/json-glib/issues/33
2: https://groups.google.com/forum/#!topic/jansson-users/7Efx-RI45IU

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-08-09 07:54:26 +03:00
Petri Lehtinen
37147b8a23
Merge pull request #423 from coreyfarrell/gcc-8
Deal with warnings under gcc 8.
2018-08-02 11:26:11 +03:00
Petri Lehtinen
8a00a56ec4
Merge pull request #424 from Crayon2000/patch-1
Update copyright for 2018
2018-07-30 13:42:05 +03:00
Petri Lehtinen
401ece058d
Merge pull request #427 from lxin/va_end
Call va_end after va_copy in json_vsprintf
2018-07-30 13:41:39 +03:00
Xin Long
66e4ee795d Call va_end after va_copy in json_vsprintf
As said in man doc:
  "Each  invocation  of va_copy() must be matched by a corresponding
   invocation of va_end() in the same function."

va_copy may alloc memory in some system, it's necessay to free it by
va_end.

Fixes: efe6c7b3f2 ("Add json_sprintf and json_vsprintf")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
2018-07-25 17:44:00 +08:00
Crayon
3e13f514ce
Update copyright for 2018 2018-07-14 16:34:33 -04:00
Corey Farrell
81fe13eeed Deal with warnings under gcc 8.
Recent versions of gcc have introduced compiler warnings for string
operations that could be truncated.  This caused problems with -Werror.
src/error.c used strncpy to write "..." to a string, but skipped writing
the NUL terminator.  Switch this to use memcpy.  src/load.c produced
warnings from snprintf writing error strings that could be truncated.
Added code to autotools build to detect `-Wno-format-truncation', add it
to AM_CFLAGS if supported.
2018-07-14 13:24:55 -04:00
Petri Lehtinen
aed855e692 Avoid invalid memory read in json_pack()
Initial patch by @bharjoc-bitdefender

Fixes #421
2018-07-09 22:26:35 +03:00
Petri Lehtinen
b59ac57617
Merge pull request #415 from palmerc/master
CMake variable to number comparison changed to provide meaningful error
2018-05-22 07:38:17 +03:00
Cameron Lowell Palmer
904f5c28ac CMake variable to number comparison changed to provide meaningful error
message.  Explicitly specify STATIC and PIC
2018-05-18 10:35:05 +02:00
Petri Lehtinen
80cea73bf9
Merge pull request #408 from isaachier/cmake
CMake improvements, make package relocatable
2018-05-18 08:08:32 +03:00
Petri Lehtinen
e28bcfeac8
Merge pull request #417 from akheron/visual-studio-15
Appveyor & build instructions for Visual Studio 15 2017
2018-05-07 14:22:03 +03:00
Petri Lehtinen
fda9288b5f Update build instructions for Visual Studio 2018-05-07 11:17:08 +03:00
Petri Lehtinen
9ff08f6312 Also build with VS 2017 in appveyor 2018-05-07 08:39:49 +03:00
Petri Lehtinen
dd4743a51d
Merge pull request #412 from Mephistophiles/fix_defines
Fix JSON_HAVE_SYNC_BUILTINS define usage
2018-05-07 08:13:21 +03:00
Maxim Zhukov
50f29f9b1a Add JSON_HAVE_SYNC_BUILTINS and JSON_HAVE_ATOMIC_BUILTINS for autoheader
Added JSON_HAVE_SYNC_BUILTINS and JSON_HAVE_ATOMIC_BUILTINS defines to
jansson_config.h.cmake as well as in the autoheader for autoconf.
2018-03-22 17:46:29 +03:00
Petri Lehtinen
e5dbe7bb64
Merge pull request #409 from Mephistophiles/master
Fix error handling in json_pack
2018-03-22 10:40:41 +02:00
Maxim Zhukov
15105b66b4 Fix error handling in json_pack
Fixed a bug where the error message was not filled if an empty object
was passed to the json_pack.

Fixes #271
2018-03-22 11:16:40 +03:00
Petri Lehtinen
b23025d72b
Merge pull request #404 from coreyfarrell/func-attrs
Build: Add JANSSON_ATTRS macro.
2018-03-20 04:55:48 +02:00
Isaac Hier
2c98c30a02 Stop using absolute paths 2018-03-11 10:54:24 -04:00
Isaac Hier
bb71db204f Fix output file name for version config 2018-03-11 10:54:14 -04:00
Isaac Hier
92760bb363 Remove warning 2018-03-11 10:54:02 -04:00
Isaac Hier
fe7873e963 Fix package version config generation 2018-03-11 10:37:15 -04:00
Isaac Hier
a586c0654f Fix CMake include 2018-03-11 10:27:48 -04:00
Isaac Hier
6d7a02beb0 Clean up CMake install 2018-03-11 10:24:27 -04:00
Isaac Hier
b70364b362 Remove absolute path references 2018-03-11 10:11:09 -04:00
Isaac Hier
6d1ae86e1c Fix config file 2018-03-11 09:59:52 -04:00
Isaac Hier
a324d18940 Rename target file 2018-03-11 09:53:06 -04:00
Isaac Hier
44f6606df8 Rename config files 2018-03-11 09:47:29 -04:00