Convert all uses of *_from_slice to *_from_bytes where appropriate

This commit is contained in:
gingerBill
2022-05-16 01:43:43 +01:00
parent e10105a780
commit 33895b6d92
11 changed files with 31 additions and 26 deletions
+3 -3
View File
@@ -18,7 +18,7 @@ import "core:os"
import "core:strings"
import "core:bytes"
parse_mo_from_slice :: proc(data: []u8, options := DEFAULT_PARSE_OPTIONS, pluralizer: proc(int) -> int = nil, allocator := context.allocator) -> (translation: ^Translation, err: Error) {
parse_mo_from_bytes :: proc(data: []byte, options := DEFAULT_PARSE_OPTIONS, pluralizer: proc(int) -> int = nil, allocator := context.allocator) -> (translation: ^Translation, err: Error) {
context.allocator = allocator
/*
An MO file should have at least a 4-byte magic, 2 x 2 byte version info,
@@ -126,10 +126,10 @@ parse_mo_file :: proc(filename: string, options := DEFAULT_PARSE_OPTIONS, plural
if !data_ok { return {}, .File_Error }
return parse_mo_from_slice(data, options, pluralizer, allocator)
return parse_mo_from_bytes(data, options, pluralizer, allocator)
}
parse_mo :: proc { parse_mo_file, parse_mo_from_slice }
parse_mo :: proc { parse_mo_file, parse_mo_from_bytes }
/*
Helpers.
+3 -3
View File
@@ -27,7 +27,7 @@ TS_XML_Options := xml.Options{
expected_doctype = "TS",
}
parse_qt_linguist_from_slice :: proc(data: []u8, options := DEFAULT_PARSE_OPTIONS, pluralizer: proc(int) -> int = nil, allocator := context.allocator) -> (translation: ^Translation, err: Error) {
parse_qt_linguist_from_bytes :: proc(data: []byte, options := DEFAULT_PARSE_OPTIONS, pluralizer: proc(int) -> int = nil, allocator := context.allocator) -> (translation: ^Translation, err: Error) {
context.allocator = allocator
ts, xml_err := xml.parse(data, TS_XML_Options)
@@ -150,7 +150,7 @@ parse_qt_linguist_file :: proc(filename: string, options := DEFAULT_PARSE_OPTION
if !data_ok { return {}, .File_Error }
return parse_qt_linguist_from_slice(data, options, pluralizer, allocator)
return parse_qt_linguist_from_bytes(data, options, pluralizer, allocator)
}
parse_qt :: proc { parse_qt_linguist_file, parse_qt_linguist_from_slice }
parse_qt :: proc { parse_qt_linguist_file, parse_qt_linguist_from_bytes }