Rename asserts

This commit is contained in:
2026-06-26 15:32:23 +01:00
parent 61c1ec99e5
commit 65d99db738
15 changed files with 126 additions and 126 deletions
+18 -18
View File
@@ -8,23 +8,23 @@
#include "../../base/strings/str8/str8.h"
WFile *wapp_file_open(const Allocator *allocator, Str8RO *filepath, FileAccessMode mode) {
wapp_debug_assert(allocator != NULL && filepath != NULL, "`allocator` and `filepath` should not be NULL");
wapp_debug_assert(filepath->size < WAPP_PATH_MAX, "`filepath` exceeds max path limit.");
wpDebugAssert(allocator != NULL && filepath != NULL, "`allocator` and `filepath` should not be NULL");
wpDebugAssert(filepath->size < WAPP_PATH_MAX, "`filepath` exceeds max path limit.");
return _file_open(allocator, filepath, mode);
}
i64 wapp_file_get_current_position(WFile *file) {
wapp_debug_assert(file != NULL, "`file` should not be NULL.");
wpDebugAssert(file != NULL, "`file` should not be NULL.");
return _file_seek(file, 0, WAPP_SEEK_CURRENT);
}
i64 wapp_file_seek(WFile *file, i64 offset, FileSeekOrigin origin) {
wapp_debug_assert(file != NULL, "`file` should not be NULL.");
wpDebugAssert(file != NULL, "`file` should not be NULL.");
return _file_seek(file, offset, origin);
}
i64 wapp_file_get_length(WFile *file) {
wapp_debug_assert(file != NULL, "`file` should not be NULL.");
wpDebugAssert(file != NULL, "`file` should not be NULL.");
i64 current = wapp_file_get_current_position(file);
@@ -39,7 +39,7 @@ i64 wapp_file_get_length(WFile *file) {
}
u64 wapp_file_read(void *dst_buf, WFile *file, u64 byte_count) {
wapp_debug_assert(dst_buf != NULL && file != NULL,
wpDebugAssert(dst_buf != NULL && file != NULL,
"`dst_buf` and `file` should not be NULL.");
i64 file_length = wapp_file_get_length(file);
@@ -51,23 +51,23 @@ u64 wapp_file_read(void *dst_buf, WFile *file, u64 byte_count) {
}
i64 wapp_file_write(const void *src_buf, WFile *file, u64 byte_count) {
wapp_debug_assert(src_buf != NULL && file != NULL,
wpDebugAssert(src_buf != NULL && file != NULL,
"`src_buf` and `file` should not be NULL.");
return _file_write(src_buf, file, byte_count);
}
u64 wapp_file_read_str8(Str8 *str, WFile *file) {
wapp_debug_assert(str != NULL, "`str` should not be NULL.");
wpDebugAssert(str != NULL, "`str` should not be NULL.");
return wapp_file_read((void *)(str->buf), file, str->size);
}
i64 wapp_file_write_str8(Str8RO *str, WFile *file) {
wapp_debug_assert(str != NULL, "`str` should not be NULL.");
wpDebugAssert(str != NULL, "`str` should not be NULL.");
return wapp_file_write((void *)(str->buf), file, str->size);
}
u64 wapp_file_read_array(GenericArray dst_buf, WFile *file, u64 item_count) {
wapp_debug_assert(dst_buf != NULL && file != NULL,
wpDebugAssert(dst_buf != NULL && file != NULL,
"`dst_buf` and `file` should not be NULL.");
i64 _file_length = wapp_file_get_length(file);
@@ -98,7 +98,7 @@ u64 wapp_file_read_array(GenericArray dst_buf, WFile *file, u64 item_count) {
}
i64 wapp_file_write_array(const GenericArray src_buf, WFile *file, u64 item_count) {
wapp_debug_assert(src_buf != NULL && file != NULL,
wpDebugAssert(src_buf != NULL && file != NULL,
"`src_buf` and `file` should not be NULL.");
u64 item_size = wapp_array_item_size(src_buf);
@@ -115,25 +115,25 @@ i64 wapp_file_write_array(const GenericArray src_buf, WFile *file, u64 item_coun
}
i32 wapp_file_flush(WFile *file) {
wapp_debug_assert(file != NULL, "`file` should not be NULL.");
wpDebugAssert(file != NULL, "`file` should not be NULL.");
return _file_flush(file);
}
i32 wapp_file_close(WFile *file) {
wapp_debug_assert(file != NULL, "`file` should not be NULL.");
wpDebugAssert(file != NULL, "`file` should not be NULL.");
return _file_close(file);
}
i32 wapp_file_rename(Str8RO *old_filepath, Str8RO *new_filepath) {
wapp_debug_assert(old_filepath != NULL && new_filepath != NULL,
wpDebugAssert(old_filepath != NULL && new_filepath != NULL,
"`old_filepath` and `new_filepath` should not be NULL");
wapp_debug_assert(old_filepath->size < WAPP_PATH_MAX, "`old_filepath` exceeds max path limit.");
wapp_debug_assert(new_filepath->size < WAPP_PATH_MAX, "`new_filepath` exceeds max path limit.");
wpDebugAssert(old_filepath->size < WAPP_PATH_MAX, "`old_filepath` exceeds max path limit.");
wpDebugAssert(new_filepath->size < WAPP_PATH_MAX, "`new_filepath` exceeds max path limit.");
return _file_rename(old_filepath, new_filepath);
}
i32 wapp_file_remove(Str8RO *filepath) {
wapp_debug_assert(filepath != NULL, "`filepath` should not be NULL");
wapp_debug_assert(filepath->size < WAPP_PATH_MAX, "`filepath` exceeds max path limit.");
wpDebugAssert(filepath != NULL, "`filepath` should not be NULL");
wpDebugAssert(filepath->size < WAPP_PATH_MAX, "`filepath` exceeds max path limit.");
return _file_remove(filepath);
}
+2 -2
View File
@@ -111,7 +111,7 @@ i64 _file_seek(WFile *file, i64 offset, FileSeekOrigin origin) {
u64 _file_read(void* dst_buf, u64 byte_count, WFile* file, u64 file_length) {
u64 copy_byte_count = file_length <= byte_count ? file_length : byte_count;
wapp_debug_assert(copy_byte_count <= DWORD_MAX, "Attempting to read large number of bytes at once");
wpDebugAssert(copy_byte_count <= DWORD_MAX, "Attempting to read large number of bytes at once");
DWORD read_count = 0;
if (!ReadFile(file->fh, dst_buf, (DWORD)copy_byte_count, &read_count, NULL)) {
@@ -122,7 +122,7 @@ u64 _file_read(void* dst_buf, u64 byte_count, WFile* file, u64 file_length) {
}
i64 _file_write(const void *src_buf, WFile *file, u64 byte_count) {
wapp_debug_assert(byte_count <= DWORD_MAX, "Attempting to write large number of bytes at once");
wpDebugAssert(byte_count <= DWORD_MAX, "Attempting to write large number of bytes at once");
DWORD write_count = 0;
if (!WriteFile(file->fh, src_buf, (DWORD)byte_count, &write_count, NULL)) {