mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-13 06:43:35 +00:00
Remove core:mem imports from core:encoding.
This commit is contained in:
@@ -9,8 +9,8 @@ truncate it from the encoded output.
|
||||
*/
|
||||
package encoding_base64
|
||||
|
||||
import "base:runtime"
|
||||
import "core:io"
|
||||
import "core:mem"
|
||||
import "core:strings"
|
||||
|
||||
ENC_TABLE := [64]byte {
|
||||
@@ -110,7 +110,7 @@ DEC_URL_TABLE := [256]u8 {
|
||||
}
|
||||
|
||||
|
||||
encode :: proc(data: []byte, ENC_TBL := ENC_TABLE, allocator := context.allocator) -> (encoded: string, err: mem.Allocator_Error) #optional_allocator_error {
|
||||
encode :: proc(data: []byte, ENC_TBL := ENC_TABLE, allocator := context.allocator) -> (encoded: string, err: runtime.Allocator_Error) #optional_allocator_error {
|
||||
out_length := encoded_len(data)
|
||||
if out_length == 0 {
|
||||
return
|
||||
@@ -161,7 +161,7 @@ encoded_len :: proc(data: []byte) -> int {
|
||||
return ((4 * length / 3) + 3) &~ 3
|
||||
}
|
||||
|
||||
decode :: proc(data: string, DEC_TBL := DEC_TABLE, allocator := context.allocator) -> (decoded: []byte, err: mem.Allocator_Error) #optional_allocator_error {
|
||||
decode :: proc(data: string, DEC_TBL := DEC_TABLE, allocator := context.allocator) -> (decoded: []byte, err: runtime.Allocator_Error) #optional_allocator_error {
|
||||
out_length := decoded_len(data)
|
||||
|
||||
out := strings.builder_make(0, out_length, allocator) or_return
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package encoding_hxa
|
||||
|
||||
import "core:mem"
|
||||
import "base:runtime"
|
||||
|
||||
LATEST_VERSION :: 3
|
||||
VERSION_API :: "0.3"
|
||||
@@ -16,7 +16,7 @@ Header :: struct #packed {
|
||||
File :: struct {
|
||||
using header: Header,
|
||||
backing: []byte,
|
||||
allocator: mem.Allocator,
|
||||
allocator: runtime.Allocator,
|
||||
nodes: []Node,
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package encoding_hxa
|
||||
|
||||
import "core:fmt"
|
||||
import "core:mem"
|
||||
|
||||
Read_Error :: enum {
|
||||
None,
|
||||
@@ -45,7 +44,7 @@ read :: proc(data: []byte, filename := "<input>", print_error := false, allocato
|
||||
}
|
||||
ptr := raw_data(r.data[r.offset:])
|
||||
|
||||
value = mem.slice_ptr((^T)(ptr), count)
|
||||
value = ([^]T)(ptr)[:count]
|
||||
r.offset += size_of(T)*count
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package encoding_hxa
|
||||
|
||||
import "core:mem"
|
||||
|
||||
Write_Error :: enum {
|
||||
None,
|
||||
Buffer_Too_Small,
|
||||
@@ -50,7 +48,7 @@ write_internal :: proc(w: ^Writer, file: File) {
|
||||
remaining := len(w.data) - w.offset
|
||||
assert(size_of(T)*len(array) <= remaining)
|
||||
ptr := raw_data(w.data[w.offset:])
|
||||
dst := mem.slice_ptr((^T)(ptr), len(array))
|
||||
dst := ([^]T)(ptr)[:len(array)]
|
||||
copy(dst, array)
|
||||
}
|
||||
w.offset += size_of(T)*len(array)
|
||||
@@ -60,7 +58,7 @@ write_internal :: proc(w: ^Writer, file: File) {
|
||||
remaining := len(w.data) - w.offset
|
||||
assert(size_of(byte)*len(str) <= remaining)
|
||||
ptr := raw_data(w.data[w.offset:])
|
||||
dst := mem.slice_ptr((^byte)(ptr), len(str))
|
||||
dst := ([^]byte)(ptr)[:len(str)]
|
||||
copy(dst, str)
|
||||
}
|
||||
w.offset += size_of(byte)*len(str)
|
||||
|
||||
Reference in New Issue
Block a user