1.1 --- a/templates/native/io.c Sat Oct 30 23:09:57 2021 +0200
1.2 +++ b/templates/native/io.c Sun Oct 31 01:01:10 2021 +0200
1.3 @@ -1,6 +1,6 @@
1.4 /* Native functions for input/output.
1.5
1.6 -Copyright (C) 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.7 +Copyright (C) 2016, 2017, 2021 Paul Boddie <paul@boddie.org.uk>
1.8
1.9 This program is free software; you can redistribute it and/or modify it under
1.10 the terms of the GNU General Public License as published by the Free Software
1.11 @@ -120,7 +120,7 @@
1.12 /* fp interpreted as FILE reference */
1.13 FILE *f = (FILE *) fp.datavalue;
1.14 /* size interpreted as int */
1.15 - int to_read = __TOINT(size);
1.16 + size_t to_read = __TOINT(size);
1.17 char buf[to_read];
1.18 size_t have_read;
1.19 int error;
1.20 @@ -150,7 +150,7 @@
1.21 /* str.__data__ interpreted as string */
1.22 char *s = __load_via_object(__VALUE(str), __data__).strvalue;
1.23 /* str.__size__ interpreted as int */
1.24 - int to_write = __TOINT(__load_via_object(__VALUE(str), __size__));
1.25 + size_t to_write = __TOINT(__load_via_object(__VALUE(str), __size__));
1.26 size_t have_written = fwrite(s, sizeof(char), to_write, f);
1.27 int error;
1.28
1.29 @@ -182,7 +182,7 @@
1.30 /* fd interpreted as int */
1.31 int i = __TOINT(fd);
1.32 /* n interpreted as int */
1.33 - int to_read = __TOINT(n);
1.34 + size_t to_read = __TOINT(n);
1.35 char buf[to_read];
1.36 ssize_t have_read;
1.37 char *s;
1.38 @@ -207,7 +207,7 @@
1.39 /* str.__data__ interpreted as string */
1.40 char *s = __load_via_object(__VALUE(str), __data__).strvalue;
1.41 /* str.__size__ interpreted as int */
1.42 - int size = __TOINT(__load_via_object(__VALUE(str), __size__));
1.43 + size_t size = __TOINT(__load_via_object(__VALUE(str), __size__));
1.44 ssize_t have_written;
1.45
1.46 errno = 0;