details (from lhf)
This commit is contained in:
11
lzio.c
11
lzio.c
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lzio.c,v 1.3 1997/12/22 20:57:18 roberto Exp roberto $
|
||||
** $Id: lzio.c,v 1.4 1998/12/28 13:44:54 roberto Exp roberto $
|
||||
** a generic input stream interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@@ -64,16 +64,15 @@ ZIO* zFopen (ZIO* z, FILE* f, char *name)
|
||||
|
||||
|
||||
/* --------------------------------------------------------------- read --- */
|
||||
int zread (ZIO *z, void *b, int n)
|
||||
{
|
||||
int zread (ZIO *z, void *b, int n) {
|
||||
while (n) {
|
||||
int m;
|
||||
if (z->n == 0) {
|
||||
if (z->filbuf(z) == EOZ)
|
||||
return n; /* retorna quantos faltaram ler */
|
||||
zungetc(z); /* poe o resultado de filbuf no buffer */
|
||||
return n; /* return number of missing bytes */
|
||||
zungetc(z); /* put result from 'filbuf' in the buffer */
|
||||
}
|
||||
m = (n <= z->n) ? n : z->n; /* minimo de n e z->n */
|
||||
m = (n <= z->n) ? n : z->n; /* min. between n and z->n */
|
||||
memcpy(b, z->p, m);
|
||||
z->n -= m;
|
||||
z->p += m;
|
||||
|
||||
Reference in New Issue
Block a user