String16, commands, Lua_New, layout next, build and encodings
This commit is contained in:
@@ -1152,7 +1152,7 @@ UTF8Result UTF32ToUTF8(uint32_t codepoint) {
|
||||
return result;
|
||||
}
|
||||
|
||||
UTF32Result UTF8ToUTF32(char *c, int64_t max_advance) {
|
||||
UTF32Result UTF8ToUTF32(uint8_t *c, int64_t max_advance) {
|
||||
UTF32Result result;
|
||||
MemoryZero(&result, sizeof(result));
|
||||
|
||||
@@ -1242,7 +1242,7 @@ int64_t CreateCharFromWidechar(char *buffer, int64_t buffer_size, wchar_t *in, i
|
||||
int64_t CreateWidecharFromChar(wchar_t *buffer, int64_t buffer_size, char *in, int64_t inlen) {
|
||||
int64_t outlen = 0;
|
||||
for (int64_t i = 0; i < inlen;) {
|
||||
UTF32Result decode = UTF8ToUTF32(in + i, (int64_t)(inlen - i));
|
||||
UTF32Result decode = UTF8ToUTF32((uint8_t *)(in + i), (int64_t)(inlen - i));
|
||||
if (!decode.error) {
|
||||
i += decode.advance;
|
||||
UTF16Result encode = UTF32ToUTF16(decode.out_str);
|
||||
@@ -1266,7 +1266,7 @@ bool IsValid(UTF8Iter &iter) {
|
||||
|
||||
void Advance(UTF8Iter *iter) {
|
||||
iter->i += iter->utf8_codepoint_byte_size;
|
||||
UTF32Result r = UTF8ToUTF32(iter->data + iter->i, iter->len - iter->i);
|
||||
UTF32Result r = UTF8ToUTF32((uint8_t *)(iter->data + iter->i), iter->len - iter->i);
|
||||
if (r.error) {
|
||||
iter->item = 0;
|
||||
return;
|
||||
|
||||
@@ -30,7 +30,7 @@ bool IsWord(wchar_t w) {
|
||||
}
|
||||
|
||||
bool IsLoadWord(wchar_t w) {
|
||||
bool result = w == '/' || w == '\\' || w == ':' || w == '+' || w == '_' || w == '.' || w == '-';
|
||||
bool result = w == L'(' || w == L')' || w == L'/' || w == L'\\' || w == L':' || w == L'+' || w == L'_' || w == L'.' || w == L'-' || w == L',';
|
||||
if (!result) {
|
||||
result = !(IsSymbol(w) || IsWhitespace(w));
|
||||
}
|
||||
@@ -306,7 +306,7 @@ String16 SkipWhitespace(String16 *string) {
|
||||
return begin;
|
||||
}
|
||||
|
||||
String16 FormatV(Allocator allocator, const wchar_t *data, va_list args1) {
|
||||
String16 Format16V(Allocator allocator, const wchar_t *data, va_list args1) {
|
||||
va_list args2;
|
||||
va_copy(args2, args1);
|
||||
int64_t len = vswprintf(0, 0, data, args2);
|
||||
@@ -318,13 +318,13 @@ String16 FormatV(Allocator allocator, const wchar_t *data, va_list args1) {
|
||||
return res;
|
||||
}
|
||||
|
||||
#define STRING16_FORMAT(allocator, data, result) \
|
||||
va_list args1; \
|
||||
va_start(args1, data); \
|
||||
String16 result = FormatV(allocator, data, args1); \
|
||||
#define STRING16_FORMAT(allocator, data, result) \
|
||||
va_list args1; \
|
||||
va_start(args1, data); \
|
||||
String16 result = Format16V(allocator, data, args1); \
|
||||
va_end(args1)
|
||||
|
||||
String16 Format(Allocator allocator, const wchar_t *data, ...) PrintfFormatAttribute(2, 3) {
|
||||
String16 Format16(Allocator allocator, const wchar_t *data, ...) {
|
||||
STRING16_FORMAT(allocator, data, result);
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user