fix: add strings terminators

This commit is contained in:
samsonium
2026-11-06 12:02:37 +03:00
parent d95ff88b66
commit 376e7bd1b4
12 changed files with 198 additions and 37 deletions
+3 -4
View File
@@ -2,7 +2,6 @@
#include <compiler/fzl_writer.h>
#include <compiler/internals/writer.h>
#include <compiler/utils/fzl_const_pool.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
@@ -14,11 +13,11 @@ char wrlast_err[256];
fzl_writer_t *fzl_mkwriter(const char *filepath)
{
if (strlen(filepath) < 1)
return NULL;
return nullptr;
fzl_writer_t *writer = malloc(sizeof(fzl_writer_t));
if (!writer)
return NULL;
return nullptr;
writer->filepath = filepath;
@@ -38,7 +37,7 @@ int fzl_write(fzl_writer_t *writer, fzl_gen_t *gen)
return -1;
}
const char hdr[5] = {'F', 'Z', 'L', 0x0, 0x2};
constexpr char hdr[5] = {'F', 'Z', 'L', 0x0, 0x2};
fwrite(hdr, sizeof(char), 5, fd);
fwrite(&gen->consts->size, sizeof(uint16_t), 1, fd);
fwrite(&gen->extern_libs_count, sizeof(uint16_t), 1, fd);