diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-03-20 13:00:56 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2003-03-20 13:00:56 -0300 |
| commit | b518d1407149a23d31b486f5bd3ef9e6daae93c1 (patch) | |
| tree | c3dfc35a5aa3612e6657e065233d4b92f0a0fe64 | |
| parent | 15dbb5346143a0af082fa96477db788a78fa6c61 (diff) | |
| download | lua-b518d1407149a23d31b486f5bd3ef9e6daae93c1.tar.gz lua-b518d1407149a23d31b486f5bd3ef9e6daae93c1.tar.bz2 lua-b518d1407149a23d31b486f5bd3ef9e6daae93c1.zip | |
bug: zio mixes a 255 as first char in a buffer with EOZ
| -rw-r--r-- | bugs | 5 | ||||
| -rw-r--r-- | lzio.c | 6 | ||||
| -rw-r--r-- | lzio.h | 9 |
3 files changed, 13 insertions, 7 deletions
| @@ -329,3 +329,8 @@ Fri Feb 28 14:20:33 EST 2003 | |||
| 329 | >> GC metamethod calls could mess C/Lua stack syncronization | 329 | >> GC metamethod calls could mess C/Lua stack syncronization |
| 330 | (by Roberto; since 5.0b) | 330 | (by Roberto; since 5.0b) |
| 331 | 331 | ||
| 332 | ** lzio.h/zlio.c | ||
| 333 | Thu Mar 20 11:40:12 EST 2003 | ||
| 334 | >> zio mixes a 255 as first char in a buffer with EOZ | ||
| 335 | (by lhf; since 5.0a) | ||
| 336 | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lzio.c,v 1.22 2002/10/08 18:46:08 roberto Exp roberto $ | 2 | ** $Id: lzio.c,v 1.23 2002/12/04 17:38:31 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 | */ |
| @@ -22,7 +22,7 @@ int luaZ_fill (ZIO *z) { | |||
| 22 | if (buff == NULL || size == 0) return EOZ; | 22 | if (buff == NULL || size == 0) return EOZ; |
| 23 | z->n = size - 1; | 23 | z->n = size - 1; |
| 24 | z->p = buff; | 24 | z->p = buff; |
| 25 | return *(z->p++); | 25 | return char2int(*(z->p++)); |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | 28 | ||
| @@ -33,7 +33,7 @@ int luaZ_lookahead (ZIO *z) { | |||
| 33 | z->n++; | 33 | z->n++; |
| 34 | z->p--; | 34 | z->p--; |
| 35 | } | 35 | } |
| 36 | return *z->p; | 36 | return char2int(*z->p); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | 39 | ||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lzio.h,v 1.13 2002/08/05 18:45:02 roberto Exp roberto $ | 2 | ** $Id: lzio.h,v 1.14 2002/10/08 18:46:08 roberto Exp roberto $ |
| 3 | ** Buffered streams | 3 | ** Buffered streams |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -15,9 +15,10 @@ | |||
| 15 | 15 | ||
| 16 | typedef struct Zio ZIO; | 16 | typedef struct Zio ZIO; |
| 17 | 17 | ||
| 18 | #define zgetc(z) (((z)->n--)>0 ? \ | 18 | |
| 19 | cast(int, cast(unsigned char, *(z)->p++)) : \ | 19 | #define char2int(c) cast(int, cast(unsigned char, (c))) |
| 20 | luaZ_fill(z)) | 20 | |
| 21 | #define zgetc(z) (((z)->n--)>0 ? char2int(*(z)->p++) : luaZ_fill(z)) | ||
| 21 | 22 | ||
| 22 | #define zname(z) ((z)->name) | 23 | #define zname(z) ((z)->name) |
| 23 | 24 | ||
