aboutsummaryrefslogtreecommitdiff
path: root/src/lib/libkogata
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libkogata')
-rw-r--r--src/lib/libkogata/draw.c12
-rw-r--r--src/lib/libkogata/keyboard.c6
-rw-r--r--src/lib/libkogata/mainloop.c6
3 files changed, 12 insertions, 12 deletions
diff --git a/src/lib/libkogata/draw.c b/src/lib/libkogata/draw.c
index d988cb9..6aa3387 100644
--- a/src/lib/libkogata/draw.c
+++ b/src/lib/libkogata/draw.c
@@ -19,7 +19,7 @@ fb_t *g_fb_from_file(fd_t file, fb_info_t *geom) {
ret->data = (uint8_t*)region_alloc(geom->height * geom->pitch, "Framebuffer");
if (ret->data == 0) goto error;
- bool map_ok = mmap_file(file, 0, ret->data, geom->height * geom->pitch, MM_READ | MM_WRITE);
+ bool map_ok = sc_mmap_file(file, 0, ret->data, geom->height * geom->pitch, MM_READ | MM_WRITE);
if (!map_ok) goto error;
return ret;
@@ -43,7 +43,7 @@ fb_t *g_fb_from_mem(uint8_t* data, fb_info_t *geom) {
void g_delete_fb(fb_t *fb) {
if (fb->fd != 0) {
- munmap(fb->data);
+ sc_munmap(fb->data);
region_free(fb->data);
}
free(fb);
@@ -237,7 +237,7 @@ font_t *g_load_ascii_bitmap_font(fd_t f) {
ascii_bitmap_font_header h;
- size_t s = read(f, 0, sizeof(h), (char*)&h);
+ size_t s = sc_read(f, 0, sizeof(h), (char*)&h);
if (s != sizeof(h)) goto error;
if (h.magic != ASCII_BITMAP_FONT_MAGIC) goto error;
@@ -255,7 +255,7 @@ font_t *g_load_ascii_bitmap_font(fd_t f) {
font->ascii_bitmap.data = (uint8_t*)malloc(h.ch * h.nchars);
if (font->ascii_bitmap.data == 0) goto error;
- size_t rd = read(f, sizeof(h), h.ch * h.nchars, (char*)font->ascii_bitmap.data);
+ size_t rd = sc_read(f, sizeof(h), h.ch * h.nchars, (char*)font->ascii_bitmap.data);
if (rd != h.ch * h.nchars) goto error;
return font;
@@ -263,7 +263,7 @@ font_t *g_load_ascii_bitmap_font(fd_t f) {
error:
if (font && font->ascii_bitmap.data) free(font->ascii_bitmap.data);
if (font) free(font);
- close(f);
+ sc_close(f);
return 0;
}
@@ -271,7 +271,7 @@ font_t *g_load_font(const char* fontname) {
char buf[128];
snprintf(buf, 128, "sys:/fonts/%s.bf", fontname);
- fd_t f = open(buf, FM_READ);
+ fd_t f = sc_open(buf, FM_READ);
if (f != 0) return g_load_ascii_bitmap_font(f);
return 0;
diff --git a/src/lib/libkogata/keyboard.c b/src/lib/libkogata/keyboard.c
index e7fb08b..64569ed 100644
--- a/src/lib/libkogata/keyboard.c
+++ b/src/lib/libkogata/keyboard.c
@@ -57,14 +57,14 @@ bool load_keymap(keyboard_t *kb, const char* kmname) {
char buf[128];
snprintf(buf, 128, "sys:/keymaps/%s.km", kmname);
- fd_t f = open(buf, FM_READ);
+ fd_t f = sc_open(buf, FM_READ);
if (f == 0) {
dbg_printf("Failed to open keymap %s\n", buf);
return false;
}
keymap_t km;
- size_t rd = read(f, 0, sizeof(keymap_t), (char*)&km);
+ size_t rd = sc_read(f, 0, sizeof(keymap_t), (char*)&km);
bool ok = (rd == sizeof(keymap_t));
@@ -73,7 +73,7 @@ bool load_keymap(keyboard_t *kb, const char* kmname) {
kb->status = 0;
}
- close(f);
+ sc_close(f);
return ok;
}
diff --git a/src/lib/libkogata/mainloop.c b/src/lib/libkogata/mainloop.c
index bce1174..c1758a4 100644
--- a/src/lib/libkogata/mainloop.c
+++ b/src/lib/libkogata/mainloop.c
@@ -91,7 +91,7 @@ void mainloop_run() {
// ---- Do the select
/*dbg_printf("(mainloop) begin select\n");*/
- bool ok = select(sel_arg, nfds, -1);
+ bool ok = sc_select(sel_arg, nfds, -1);
if (!ok) {
dbg_printf("(mainloop) Failed to select.\n");
free(sel_arg);
@@ -107,7 +107,7 @@ void mainloop_run() {
fd->on_error(fd);
} else if ((sel_arg[i].got_flags & SEL_READ) && fd->rd_buf != 0) {
fd->rd_buf_filled +=
- read(fd->fd, 0, fd->rd_buf_expect_size - fd->rd_buf_filled, fd->rd_buf + fd->rd_buf_filled);
+ sc_read(fd->fd, 0, fd->rd_buf_expect_size - fd->rd_buf_filled, fd->rd_buf + fd->rd_buf_filled);
if (fd->rd_buf_filled == fd->rd_buf_expect_size) {
/*dbg_printf("(mainloop) finish read %d\n", fd->rd_buf_expect_size);*/
fd->rd_buf_filled = 0;
@@ -118,7 +118,7 @@ void mainloop_run() {
size_t remain_size = fd->wr_bufs[0].size - fd->wr_bufs[0].written;
void* write_ptr = fd->wr_bufs[0].buf + fd->wr_bufs[0].written;
- fd->wr_bufs[0].written += write(fd->fd, 0, remain_size, write_ptr);
+ fd->wr_bufs[0].written += sc_write(fd->fd, 0, remain_size, write_ptr);
if (fd->wr_bufs[0].written == fd->wr_bufs[0].size) {
/*dbg_printf("(mainloop) finish write %d\n", fd->wr_bufs[0].size);*/