<feed xmlns='http://www.w3.org/2005/Atom'>
<title>luci/libs/luci-lib-jsonc/src, branch master</title>
<subtitle>Lua Configuration Interface (mirror)</subtitle>
<id>https://git-03.infra.openwrt.org/project/luci/atom?h=master</id>
<link rel='self' href='https://git-03.infra.openwrt.org/project/luci/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/'/>
<updated>2024-11-17T22:23:42Z</updated>
<entry>
<title>luci-lib-jsonc: fix build error with LTO</title>
<updated>2024-11-17T22:23:42Z</updated>
<author>
<name>Anari Jalakas</name>
</author>
<published>2024-11-11T19:03:50Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=5de203082ffad31ba70e2d332e4ee3495ec58b30'/>
<id>urn:sha1:5de203082ffad31ba70e2d332e4ee3495ec58b30</id>
<content type='text'>
Adding $(FPIC) parameter fixes building with CONFIG_USE_LTO enabled.

Signed-off-by: Anari Jalakas &lt;anari.jalakas@gmail.com&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: improve handling of integral numeric values</title>
<updated>2023-10-25T20:42:23Z</updated>
<author>
<name>Jo-Philipp Wich</name>
</author>
<published>2023-10-25T20:35:08Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=efcd4879781ee6c428b467052957534a7919d36d'/>
<id>urn:sha1:efcd4879781ee6c428b467052957534a7919d36d</id>
<content type='text'>
Properly deal with integral numeric values exceeding the int32_t range
by replacing the cast logic with more fine grained checks:

 - Lua numbers which are integers in the first place are directly converted
   to JSON integers

 - Finite double Lua numbers which are integral are converted to JSON
   integer values

 - All other numeric values are converted to JSON doubles

This should bring the handling of large integral value in line with the
documented behavior of turning non-fractional Lua numbers into JSON
integers.

Fixes: #6647
Signed-off-by: Jo-Philipp Wich &lt;jo@mein.io&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: stringify int use json_object_new_int64 instead</title>
<updated>2022-03-20T15:11:33Z</updated>
<author>
<name>Justin Klaassen</name>
</author>
<published>2022-03-19T18:34:05Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=45f411b7a29d0aa6b46946f06bd88082f2a68034'/>
<id>urn:sha1:45f411b7a29d0aa6b46946f06bd88082f2a68034</id>
<content type='text'>
Fixes: #3293
Signed-off-by: Justin Klaassen &lt;jck112@users.noreply.github.com&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: store large JSON integer values as Lua doubles</title>
<updated>2019-11-13T08:11:09Z</updated>
<author>
<name>Jo-Philipp Wich</name>
</author>
<published>2019-11-13T08:03:38Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=8da8f38bf97c925f6f113d3b4793edb23e7e0dc2'/>
<id>urn:sha1:8da8f38bf97c925f6f113d3b4793edb23e7e0dc2</id>
<content type='text'>
Fixes: #3293
Signed-off-by: Jo-Philipp Wich &lt;jo@mein.io&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: prevent infinite recursion in stringify</title>
<updated>2018-12-21T14:41:19Z</updated>
<author>
<name>Jo-Philipp Wich</name>
</author>
<published>2018-12-21T12:16:16Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=21db93576aebe52707790fc1a8733dc2703d59a6'/>
<id>urn:sha1:21db93576aebe52707790fc1a8733dc2703d59a6</id>
<content type='text'>
Also increase the stack size as needed to prevent crashes when serializing
deeply nested tables.

Signed-off-by: Jo-Philipp Wich &lt;jo@mein.io&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: Add ltn12-compatible sink factory</title>
<updated>2015-09-04T10:21:30Z</updated>
<author>
<name>Jan-Philipp Litza</name>
</author>
<published>2015-09-01T14:17:23Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=5335f225374c7ed993348d15b5018411dc776bab'/>
<id>urn:sha1:5335f225374c7ed993348d15b5018411dc776bab</id>
<content type='text'>
To use the luci-lib-jsonc parser as sink for an ltn12 pump (for example
from stdin), the following code will now do:

    require 'luci.ltn12'
    require 'luci.jsonc'

    local parser = luci.jsonc.new()
    luci.ltn12.pump.all(luci.ltn12.source.file(io.input()), parser:sink())
    print(parser:get())

Signed-off-by: Jan-Philipp Litza &lt;janphilipp@litza.de&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: Fix memory leak in stringify()</title>
<updated>2015-08-31T17:53:51Z</updated>
<author>
<name>Jan-Philipp Litza</name>
</author>
<published>2015-08-31T17:52:36Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=90c841d66e5a13735996e5177b622cb0deae9016'/>
<id>urn:sha1:90c841d66e5a13735996e5177b622cb0deae9016</id>
<content type='text'>
</content>
</entry>
<entry>
<title>luci-lib-jsonc: allow encoding empty lists</title>
<updated>2015-08-30T13:52:33Z</updated>
<author>
<name>Jan-Philipp Litza</name>
</author>
<published>2015-08-30T13:45:49Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=e7645d557c1bd532e49c69f0ab781cf6342067d1'/>
<id>urn:sha1:e7645d557c1bd532e49c69f0ab781cf6342067d1</id>
<content type='text'>
To be consistent with the behavior of luci-lib-json, an empty Lua table
should be encoded to an empty JSON list, not an empty JSON object.

To still allow encoding empty JSON objects, the usage of anything other
than a number or a string as a key (for example an empty table or a
function) can be used to force encoding as an object:

    json.stringify({})                  -- "[]"
    json.stringify({[{}] = true})       -- "{}"

Signed-off-by: Jan-Philipp Litza &lt;janphilipp@litza.de&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: Ignore non-string-or-number keys in tables</title>
<updated>2015-08-30T13:51:17Z</updated>
<author>
<name>Jan-Philipp Litza</name>
</author>
<published>2015-08-30T13:42:52Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=e32a877aa48d0e9d87d999026a6c49707b42a7bf'/>
<id>urn:sha1:e32a877aa48d0e9d87d999026a6c49707b42a7bf</id>
<content type='text'>
Previously, the following caused a segmentation fault:

    json.stringify({[{}] = true})

This was caused by lua_tostring() returning NULL for anything but
strings and numbers, letting json_object_object_add crash.

This patch makes jsonc ignore all keys which have no string
representation altogether.

Signed-off-by: Jan-Philipp Litza &lt;janphilipp@litza.de&gt;
</content>
</entry>
<entry>
<title>luci-lib-jsonc: add api documentation</title>
<updated>2015-01-28T21:31:28Z</updated>
<author>
<name>Jo-Philipp Wich</name>
</author>
<published>2015-01-28T21:31:28Z</published>
<link rel='alternate' type='text/html' href='https://git-03.infra.openwrt.org/project/luci/commit/?id=cf7e2695cc676dff02561a1a45d6de8140170b17'/>
<id>urn:sha1:cf7e2695cc676dff02561a1a45d6de8140170b17</id>
<content type='text'>
Signed-off-by: Jo-Philipp Wich &lt;jow@openwrt.org&gt;
</content>
</entry>
</feed>
