From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
---
encoding/json/+test/lexer.ha | 5 +++--
encoding/json/+test/load.ha | 2 +-
encoding/json/lex.ha | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/encoding/json/+test/lexer.ha b/encoding/json/+test/lexer.ha
index 499d315..019e64c 100644
--- a/encoding/json/+test/lexer.ha
+++ b/encoding/json/+test/lexer.ha
@@ -1,4 +1,4 @@
-use bufio;
+use memio;
use strings;
use io;
@@ -22,7 +22,8 @@ use io;
for (let i = 0z; i < len(cases); i += 1) {
const src = strings::toutf8(cases[i].0);
- const src = bufio::fixed(src, io::mode::READ);
+ const src = memio::fixed(src);
+ defer io::close(&src)!;
const lexer = newlexer(&src);
defer close(&lexer);
diff --git a/encoding/json/+test/load.ha b/encoding/json/+test/load.ha
index 074860f..bf53777 100644
--- a/encoding/json/+test/load.ha
+++ b/encoding/json/+test/load.ha
@@ -52,7 +52,7 @@ fn errassert(input: str, expected_loc: (uint, uint)) void = {
roundtrip(`{"foo\u0000bar": 42}`, obj);
reset(&obj);
set(&obj, "min", -1.0e+28);
- set(&obj, "max", +1.0e+28);
+ set(&obj, "max", 1.0e+28);
roundtrip(`{"min": -1.0e+28, "max": 1.0e+28}`, obj);
reset(&obj);
set(&obj, "id", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");
diff --git a/encoding/json/lex.ha b/encoding/json/lex.ha
index a523db1..3d20101 100644
--- a/encoding/json/lex.ha
+++ b/encoding/json/lex.ha
@@ -24,7 +24,7 @@ export type lexer = struct {
// Creates a new JSON lexer. The caller may obtain tokens with [[lex]] and
// should pass the result to [[close]] when they're done with it.
export fn newlexer(src: io::handle) lexer = {
- let buf: []u8 = alloc([0...], os::BUFSZ);
+ let buf: []u8 = alloc([0...], os::BUFSIZ);
return lexer {
src = src,
buffer = buf,
--
2.41.0
On Mon Sep 18, 2023 at 9:28 AM CEST, wrote:
> From: "Haelwenn (lanodan) Monnier" <contact@hacktivis.me>
> diff --git a/encoding/json/lex.ha b/encoding/json/lex.ha
> index a523db1..3d20101 100644
> --- a/encoding/json/lex.ha
> +++ b/encoding/json/lex.ha
> @@ -24,7 +24,7 @@ export type lexer = struct {
> // Creates a new JSON lexer. The caller may obtain tokens with [[lex]] and
> // should pass the result to [[close]] when they're done with it.
> export fn newlexer(src: io::handle) lexer = {
> - let buf: []u8 = alloc([0...], os::BUFSZ);
> + let buf: []u8 = alloc([0...], os::BUFSIZ);
This should be the other way around. BUFSZ is the new name.