From 9055b5e86a779a276c845ddb9b5a227a326b0f32 Mon Sep 17 00:00:00 2001 From: Brendan Hansen Date: Wed, 8 Mar 2023 09:33:32 -0600 Subject: [PATCH] bugfix: socket not reporting bad-write --- core/net/net.onyx | 2 +- core/string/string.onyx | 10 ++++++++-- tests/dyn_str.onyx | 2 +- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/core/net/net.onyx b/core/net/net.onyx index d3355054..59886132 100644 --- a/core/net/net.onyx +++ b/core/net/net.onyx @@ -275,7 +275,7 @@ network_to_host :: #match #local {} if cast(i32) handle == 0 do return .BadFile, 0; bytes_written := __net_send(handle, buffer); - if bytes_written < 0 { s.vtable = null; } + if bytes_written < 0 { s.vtable = null; return .EOF, 0; } return .None, bytes_written; }, diff --git a/core/string/string.onyx b/core/string/string.onyx index 07fa5d97..f16ae9b1 100644 --- a/core/string/string.onyx +++ b/core/string/string.onyx @@ -659,8 +659,14 @@ delete :: macro (x: &dyn_str, idx: u32) -> u8 { return (package core.array).delete(x, idx); } -append :: macro (x: &dyn_str, other: str) { - (package core.array).concat(x, other); +append :: #match { + macro (x: &dyn_str, other: str) { + (package core.array).concat(x, other); + }, + + macro (x: &dyn_str, other: u8) { + (package core.array).push(x, other); + }, } clear :: macro (x: &dyn_str) { diff --git a/tests/dyn_str.onyx b/tests/dyn_str.onyx index 0169f808..5a0d2593 100644 --- a/tests/dyn_str.onyx +++ b/tests/dyn_str.onyx @@ -7,7 +7,7 @@ main :: () { string.append(&output, "Hello"); string.append(&output, "World"); - string.append(&output, "!"); + string.append(&output, '!'); string.insert(&output, 5, ", "); -- 2.25.1