1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

49 Commits

Author SHA1 Message Date
ba32b33796 Windows: configure fails to detect missing math
For some reason AC_CHECK_MATH_FUNC() on Windows is not detecting a
handful of math functions as not being supported.  This commit is a bit
of a hack.
2017-02-25 18:51:09 -06:00
6e77b017c5 Make comment consistent with code 2017-02-25 18:51:09 -06:00
5d058fa416 Don't call SetConsoleOutputCP
Should use wide-string function instead of SetConsoleOutputCP.

Fixes #1121
2017-02-25 18:51:04 -06:00
12c60b2f32 Quiet a compiler warning 2017-02-25 18:49:22 -06:00
06f20603f6 Add localtime and strflocaltime (fix #1349) 2017-02-23 22:26:53 -06:00
8cde328007 Allow var bindings in path expressions (#1347)
The expression in a variable binding is not and must not be seen as
being part of a path expression in which the variable binding appears.
2017-02-21 18:11:35 -06:00
02bad4b298 Add local oniguruma submodule
Configure should still allow use of prebuilt onigurumas (whether
system-installed or in a special prefix).  If these are not found, and
configure was not called with `--without-oniguruma`, then use the vendored
oniguruma module.  If configure was called with `--without-oniguruma`, then we
do not build regex functionality into jq.
2017-02-18 21:34:26 -05:00
1c806b74ea Add builtins builtin 2017-02-13 11:36:20 -05:00
8001955fb7 Fix memory leak in libm cfunctions 2017-02-13 11:36:20 -05:00
e0b784ac6d Add @base64d for decoding base64 #47 2017-02-12 16:03:59 -05:00
dc679081fa fix truncate_stream to match docs 2017-02-07 21:30:55 -06:00
597c1f6667 Add more missing math functions 2017-02-04 00:11:46 -06:00
125071cf00 Fix handling of unsupported math functions 2017-02-04 00:11:10 -06:00
bd7b48c1b9 Make |= delete LHS when RHS is empty (Fix #1314)
Now that #1313 is fixed, |= no longer outputs null when the RHS update
expression outputs empty.

When a user wants to keep the current value of the LHS they would have
the RHS update expression output `.`, so having `empty` achieve the same
thing would be redundant.  The obvious thing to do is to delete the LHS
when the RHS update outputs `empty` (i.e., doesn't output any values).

It's reasonable to think that existing programs won't be broken by this
change, because reduce and |= not handling empty well is clearly a bug.
(Though it's possible that some programs were using empty to quickly
terminate reduce or |=, it's not likely.  They should use label/break
instead.)

Prior to this change |= would use the _last_ value output by the RHS
update expression.  With this change |= will use the _first_ value
instead.  This change _is_ a minor backwards-incompatible change.  It
may or may not be acceptable; we'll see.  It is a useful change in that
it makes |= faster when the update expression produces multiple values.
2017-01-30 14:11:05 -06:00
aac8132f47 recurse (i.e., ..) needs to find leaf nulls 2017-01-30 14:11:05 -06:00
7bdf3a39ad Add SQL-style operators (#1322) 2017-01-30 14:11:05 -06:00
396543191c Make first(g) more efficient: extract only 1 value
first(g) was extracting two values, which, if g is slow, made first(g)
slow.  And if the second extraction were to throw an error, then
first(g) would throw that error, which is clearly not the right thing to
do.  Besides that, first(g) was allocating garbage, which it no longer
does.
2017-01-30 14:11:05 -06:00
e24af3c78e reduce: handle empty updates (fix #1313) 2017-01-30 14:11:05 -06:00
e82147bbb8 Solaris needs XPG6 for c99 2017-01-28 19:16:23 -06:00
e84d17196c Handle cut-off UTF-8 sequences when reading files
Read additional bytes from the file to complete the UTF-8 sequence so the bytes
in it don't get converted to U+FFFD replacement characters.
2017-01-27 21:04:26 -05:00
fd4ae8304e Parse no deeper than MAX_PARSING_DEPTH
while true; do printf '{"deeper": '; done | jq .
2017-01-27 09:59:44 -06:00
83e2cf607f Skip printing what's below a MAX_PRINT_DEPTH
This addresses #1136, and mitigates a stack exhaustion when printing
a very deeply nested term.
2017-01-27 09:59:44 -06:00
eeba7b3167 Fix input_(line_number|filename) leak memory 2017-01-23 15:18:51 -06:00
7835a724d6 Make jv_sort stable regardless of qsort details. 2016-01-18 10:41:25 -06:00
093d20c3b9 Fix cross-compilation build 2016-01-16 16:51:06 -06:00
ec07936888 Fix Windows build (fix #911) 2016-01-16 16:51:01 -06:00
f217fa26ae MultiByteToWideChar() usage bug (fix #1072) 2016-01-15 11:58:41 -06:00
8f6f28c8d3 Make it easier to use jq with shebangs (fix #1044)
Allow a continuation on a comment immediately after a shebang to make
this traditional hack possible:

    #!/bin/sh
    # this next line is ignored by jq \
    exec jq -f "$0" "$@"
    # jq code follows

But continue only on the first line following a shebang, and only if
it's a comment.
2015-12-14 22:08:17 -08:00
856a4b2f3f Add note about IEEE754 to help msg 2015-12-15 00:00:03 -06:00
6d76cd0a99 Change usage formatting 2015-12-14 23:58:28 -06:00
6151f20477 Avoiding conditional directives that break statements 2015-12-09 15:29:35 -06:00
ad8d1a8cc8 Two sub bugs fixed; two new gsub tests have been added.
./jq --run-tests < tests/onig.test
has been run successfully:

...
Testing 'gsub("a";"b")' at line number 70
Testing 'gsub( "(.*)"; "";  "x")' at line number 74
...
22 of 22 tests passed (0 malformed)
2015-12-09 15:28:01 -06:00
ec583deefa Fix JV_OBJECT() and go up to 18 2015-12-01 23:27:19 -06:00
5fe053671a Assume . if either stdin/on isatty() (fix #1028)
And move the #define of isatty on Windows up.
2015-12-01 23:27:19 -06:00
e17ccf2297 Support numbers and boolean in join (fix #930) 2015-10-25 12:40:15 -07:00
8eb1367ca4 Heap buffer overflow in tokenadd() (fix #105)
This was an off-by one: the NUL terminator byte was not allocated on
resize.  This was triggered by JSON-encoded numbers longer than 256
bytes.
2015-10-24 17:27:56 -05:00
2f79004f85 strptime() on OpenBSD requires _XOPEN_SOURCE_EXTENDED 1 (fix #999)
strptime() is an XPG4v2 function, on OpenBSD the prototype
is not included in time.h unless visibility is set, it needs
either "#define _XOPEN_SOURCE_EXTENDED 1" or _XOPEN_SOURCE
>= 500. Without this the prototype isn't included and
strptime's returned pointer is truncated to an int, causing
SEGV on 64-bit arches when using it.

Thanks @sthen
2015-10-24 11:23:56 -07:00
143e8dc5e4 Move jq-coded builtins to non-C file (fix #424) 2015-10-22 19:26:00 -07:00
c8dc164566 Support lowercase name in from_entries (fix #990) 2015-10-17 20:50:40 -07:00
da15e10bd0 Accept only bitwise identical NaN values in jv_identical (fix #978) 2015-10-12 20:47:22 -07:00
4490d9d1f6 Support NaN in path expressions (fix #962) 2015-09-24 10:33:34 -07:00
c4524da3e0 EOF after newline in string mishandled (fix #951) 2015-09-22 20:11:54 -07:00
58f082d74f Delete negative indices in array (fix #954) 2015-09-21 20:33:06 -07:00
154d0ee4a8 Fix assert fail if object literal key is not a string (fix #953) 2015-09-21 12:47:06 -07:00
dccda74062 Address comments on PR #950 2015-09-16 10:48:50 -07:00
b52bebfbe8 Improve invalid object key error message 2015-09-16 09:53:42 -07:00
83e8ec587f utf8bytelength: count UTF8 string bytelength
[Builtin name changed, and it only works on string inputs. -Nico]
2015-09-13 01:01:24 -05:00
63dd033da7 Fix segmentation fault on Windows with long paths (fix #939) 2015-09-10 21:29:34 -07:00
0c93eb3379 Move source files to src/ 2015-08-23 20:36:11 -07:00