aboutsummaryrefslogtreecommitdiff
path: root/lzio.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-24 10:54:49 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-05-24 10:54:49 -0300
commitef62b340e0a6b7b18931000dcbb19c4703bfe0e8 (patch)
treed9d995116a8a686b798d1b625b06ead26f28ba58 /lzio.c
parent5c2dd7a9e0a5b871a71ba66c4683cd88fe4f5aa4 (diff)
downloadlua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.tar.gz
lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.tar.bz2
lua-ef62b340e0a6b7b18931000dcbb19c4703bfe0e8.zip
code cleaner for 16 bits.
Diffstat (limited to 'lzio.c')
-rw-r--r--lzio.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lzio.c b/lzio.c
index 7a05dba4..cecd16a1 100644
--- a/lzio.c
+++ b/lzio.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lzio.c,v 1.10 2000/02/08 16:39:42 roberto Exp roberto $ 2** $Id: lzio.c,v 1.11 2000/03/03 14:58:26 roberto Exp roberto $
3** a generic input stream interface 3** a generic input stream interface
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -21,7 +21,7 @@ static int zmfilbuf (ZIO* z) {
21} 21}
22 22
23 23
24ZIO* zmopen (ZIO* z, const char* b, int size, const char *name) { 24ZIO* zmopen (ZIO* z, const char* b, size_t size, const char *name) {
25 if (b==NULL) return NULL; 25 if (b==NULL) return NULL;
26 z->n = size; 26 z->n = size;
27 z->p = (const unsigned char *)b; 27 z->p = (const unsigned char *)b;
@@ -41,7 +41,7 @@ ZIO* zsopen (ZIO* z, const char* s, const char *name) {
41/* -------------------------------------------------------------- FILEs --- */ 41/* -------------------------------------------------------------- FILEs --- */
42 42
43static int zffilbuf (ZIO* z) { 43static int zffilbuf (ZIO* z) {
44 int n; 44 size_t n;
45 if (feof((FILE *)z->u)) return EOZ; 45 if (feof((FILE *)z->u)) return EOZ;
46 n = fread(z->buffer, 1, ZBSIZE, (FILE *)z->u); 46 n = fread(z->buffer, 1, ZBSIZE, (FILE *)z->u);
47 if (n==0) return EOZ; 47 if (n==0) return EOZ;
@@ -63,9 +63,9 @@ ZIO* zFopen (ZIO* z, FILE* f, const char *name) {
63 63
64 64
65/* --------------------------------------------------------------- read --- */ 65/* --------------------------------------------------------------- read --- */
66int zread (ZIO *z, void *b, int n) { 66size_t zread (ZIO *z, void *b, size_t n) {
67 while (n) { 67 while (n) {
68 int m; 68 size_t m;
69 if (z->n == 0) { 69 if (z->n == 0) {
70 if (z->filbuf(z) == EOZ) 70 if (z->filbuf(z) == EOZ)
71 return n; /* return number of missing bytes */ 71 return n; /* return number of missing bytes */