From: Brendan Hansen Date: Wed, 8 Mar 2023 15:33:32 +0000 (-0600) Subject: bugfix: socket not reporting bad-write X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=9055b5e86a779a276c845ddb9b5a227a326b0f32;p=onyx.git bugfix: socket not reporting bad-write --- 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, ", ");