--- runtime/Clib/cports.c.orig 2022-12-29 23:55:22.000000000 -0700
+++ runtime/Clib/cports.c 2023-01-10 10:14:53.442758400 -0700
@@ -158,7 +158,7 @@ static int posix_close(FILE *f) {
}
static ssize_t posix_read(FILE *f, void *buf, size_t count) {
- int n = fread(buf, 1, count, f);
+ size_t n = fread(buf, 1, count, f);
if (n != 0)
return n;
@@ -174,9 +174,9 @@ static ssize_t posix_read(FILE *f, void
/* BSD compatibility kit */
/*---------------------------------------------------------------------*/
#if (BGL_HAVE_SENDFILE && (BGL_SENDFILE_BRAND == BGL_SENDFILE_BSD))
-static int bsd_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
- off_t sz = count;
- int n = sendfile(in_fd, out_fd, offset ? *offset : 0, &sz, 0, 0);
+static ssize_t bsd_sendfile(int out_fd, int in_fd, off_t *offset, size_t count) {
+ ssize_t sz = count;
+ ssize_t n = sendfile(in_fd, out_fd, offset ? *offset : 0, &sz, 0, 0);
return n ? n : sz;
}
@@ -2296,7 +2296,7 @@ bgl_file_to_string(char *path) {
return 0L;
} else {
obj_t res = make_string_sans_fill(sin.st_size);
- int n = read(fd, BSTRING_TO_STRING(res), sin.st_size);
+ ssize_t n = read(fd, BSTRING_TO_STRING(res), sin.st_size);
close(fd);
@@ -2585,7 +2585,7 @@ bgl_sendchars(obj_t ip, obj_t op, long s
}
#if (BGL_HAVE_SENDFILE)
} else {
- if (sz == -1) sz = in.st_size;
+ if (sz == -1) sz = (long) in.st_size;
if (sz != 0) {
#if (BGL_GC_HAVE_BLOCKING)
@@ -2695,7 +2695,7 @@ bgl_sendfile(obj_t name, obj_t op, long
C_SYSTEM_FAILURE(
BGL_IO_PORT_ERROR, "send-file", strerror(errno), name);
}
- sz = sin.st_size;
+ sz = (long) sin.st_size;
}
#if (!BGL_HAVE_SENDFILE)