This commit is contained in:
veclavtlica
2026-10-12 21:52:52 +03:00
parent 8d2bb5575e
commit 964e623644
5 changed files with 28 additions and 16 deletions
+2 -2
View File
@@ -28,14 +28,14 @@ com_std_fd com_std_open(char const *path, uint32_t flags) {
}
bool com_std_write(com_std_fd fd, void const *data, uint32_t bytes) {
com_std_assert(fd != NULL && data != NULL && bytes != 0);
com_std_assert(data != NULL && bytes != 0);
bool s = fwrite(data, 1, bytes, fd) == bytes;
fflush(fd);
return s;
}
int32_t com_std_read(com_std_fd fd, void *data, uint32_t upto) {
com_std_assert(fd != NULL && data != NULL && upto != 0);
com_std_assert(data != NULL && upto != 0);
return fread(data, 1, upto, fd);
}
+3 -3
View File
@@ -10,9 +10,9 @@
#include <stddef.h>
#include <stdint.h>
#if COM_DEF_TARGET == COM_DEF_TARGET_WASM
#define COM_STD_INFD 0
#define COM_STD_OUTFD 1
#if COM_DEF_TARGET != COM_DEF_TARGET_COSMO
#define COM_STD_INFD (void *)0
#define COM_STD_OUTFD (void *)1
#else
/* TODO: Make it more graceful, probably with static func. */
#include <unistd.h>