feat+fix: add extern fns reading; fix VM reading issues

This commit is contained in:
samsonium
2026-11-06 13:32:41 +03:00
parent 376e7bd1b4
commit 317b846108
9 changed files with 249 additions and 9 deletions
+4 -3
View File
@@ -1,5 +1,6 @@
#include <common/fzl_extern.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -25,14 +26,14 @@ bool vm_rd_extern_libs(fzl_vm_reader_t *reader, FILE *fd)
memset(reader->extern_libs, 0, sizeof(char *) * libs_count);
bool ok = false;
uint16_t name_sz = 0;
bool ok = false;
size_t name_sz = 0;
char name[256];
for (uint16_t i = 0; i < libs_count; i++)
{
memset(name, 0, sizeof(name));
ok = vm_rd_u16(fd, 1, &name_sz);
ok = vm_rd_word(fd, 1, &name_sz);
if (!ok || name_sz < 1)
{
snprintf(internal_error, sizeof(internal_error),