---
native/dispatch.ha | 9 +++++----
native/main.ha | 6 +++---
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/native/dispatch.ha b/native/dispatch.ha
index 6c12e9e..54eac5f 100644
--- a/native/dispatch.ha
+++ b/native/dispatch.ha
@@ -1,8 +1,8 @@
-use bufio;
use encoding::json;
use himitsu::client;
use himitsu::query;
use io;
+use memio;
use strings;
fn dispatch(msg: json::value) (json::value | client::error) = {
@@ -14,7 +14,7 @@ fn dispatch(msg: json::value) (json::value | client::error) = {
const q = *(json::get(&obj, "query") as *json::value) as str;
const d = *(json::get(&obj, "decrypt") as *json::value) as bool;
- const qbuf = bufio::fixed(strings::toutf8(q), io::mode::READ);
+ const qbuf = memio::fixed(strings::toutf8(q));
const q = query::parse(&qbuf)!;
defer query::finish(&q);
const iter = client::query(client, switch (op) {
@@ -24,6 +24,8 @@ fn dispatch(msg: json::value) (json::value | client::error) = {
yield client::operation::ADD;
case "del" =>
yield client::operation::DEL;
+ case =>
+ abort();
}, &q, if (d) client::flags::DECRYPT else 0)!;
let resp: []json::value = [];
@@ -34,8 +36,7 @@ fn dispatch(msg: json::value) (json::value | client::error) = {
case let item: const str =>
yield item;
};
- const buf = bufio::fixed(strings::toutf8(item),
- io::mode::READ);
+ const buf = memio::fixed(strings::toutf8(item));
const q = query::parse(&buf)!;
let item: []json::value = [];
diff --git a/native/main.ha b/native/main.ha
index 44fb67d..5217b16 100644
--- a/native/main.ha
+++ b/native/main.ha
@@ -1,10 +1,10 @@
-use bufio;
use encoding::json;
use endian;
use fmt;
use himitsu::client;
use himitsu::query;
use io;
+use memio;
use os;
use strings;
@@ -33,11 +33,11 @@ export fn main() void = {
};
defer json::finish(resp);
- const bufout = bufio::dynamic(io::mode::WRITE);
+ const bufout = memio::dynamic();
defer io::close(&bufout)!;
json::dump(&bufout, resp)!;
- const buffer = bufio::buffer(&bufout);
+ const buffer = memio::buffer(&bufout);
endian::leputu32(lenbuf, len(buffer): u32);
const vec1 = io::mkvector(lenbuf);
const vec2 = io::mkvector(buffer);
--
2.42.1