Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nob.h
Original file line number Diff line number Diff line change
Expand Up @@ -2118,14 +2118,14 @@ NOBDEF bool nob_read_entire_file(const char *path, Nob_String_Builder *sb)
if (m < 0) nob_return_defer(false);
if (fseek(f, 0, SEEK_SET) < 0) nob_return_defer(false);

new_count = sb->count + m;
new_count = sb->count + (size_t)m;
if (new_count > sb->capacity) {
sb->items = NOB_DECLTYPE_CAST(sb->items)NOB_REALLOC(sb->items, new_count);
NOB_ASSERT(sb->items != NULL && "Buy more RAM lool!!");
sb->capacity = new_count;
}

fread(sb->items + sb->count, m, 1, f);
fread(sb->items + sb->count, (size_t)m, 1, f);
if (ferror(f)) {
// TODO: Afaik, ferror does not set errno. So the error reporting in defer is not correct in this case.
nob_return_defer(false);
Expand Down