mirror of
https://github.com/sbrow/zomq.git
synced 2026-08-26 10:53:32 -04:00
fix: Fixed a compilation issue with send_const_string.
`send` now automatically uses `send_const_string` when appropriate.
This commit is contained in:
@@ -115,6 +115,7 @@ connect :: proc(s: Socket, addr: string, allocator := context.temp_allocator) ->
|
||||
|
||||
send :: proc {
|
||||
send_bytes,
|
||||
send_const_string,
|
||||
send_string,
|
||||
}
|
||||
|
||||
@@ -136,17 +137,12 @@ send_const :: proc {
|
||||
}
|
||||
|
||||
send_const_string :: proc(s: Socket, $str: string, flags: Flags = {}) -> (int, Error) {
|
||||
n := _send_const(s, rawptr($str), len($str), flags)
|
||||
if n < 0 {
|
||||
return -1, last_error()
|
||||
}
|
||||
|
||||
return int(n), nil
|
||||
return send_const_bytes(s, transmute([]byte)str, flags)
|
||||
}
|
||||
|
||||
// buf must have @(rodata) or global lifetime.
|
||||
send_const_bytes :: proc(s: Socket, buf: []byte, flags: Flags = {}) -> (int, Error) {
|
||||
n := _send_const(s, rawptr(&buf[0]), len(buf), flags)
|
||||
n := _send_const(s, rawptr(&buf[0]), c.size_t(len(buf)), flags)
|
||||
if n < 0 {
|
||||
return -1, last_error()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user