diff options
author | Lua Team <team@lua.org> | 2014-07-31 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2014-07-31 12:00:00 +0000 |
commit | d7648e85b78d53a2248de909868192598ad0eb69 (patch) | |
tree | c67708a14fd29f8ff7e4981aadb041c5ab577e08 /src/liolib.c | |
parent | 3907bda05b0e73eba86487ad703e832ca14b64ce (diff) | |
download | lua-github-5.3.0-alpha.tar.gz |
Lua 5.3.0-alpha5.3.0-alpha
Diffstat (limited to 'src/liolib.c')
-rw-r--r-- | src/liolib.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/liolib.c b/src/liolib.c index 5613aa1a..96cb1a31 100644 --- a/src/liolib.c +++ b/src/liolib.c @@ -1,5 +1,5 @@ /* -** $Id: liolib.c,v 2.126 2014/06/02 03:00:51 roberto Exp $ +** $Id: liolib.c,v 2.128 2014/07/29 16:01:00 roberto Exp $ ** Standard I/O (and system) library ** See Copyright Notice in lua.h */ @@ -402,11 +402,11 @@ static int test2 (RN *rn, const char *set) { /* -** Read a sequence of (hexa)digits +** Read a sequence of (hex)digits */ -static int readdigits (RN *rn, int hexa) { +static int readdigits (RN *rn, int hex) { int count = 0; - while ((hexa ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) + while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) count++; return count; } @@ -426,7 +426,7 @@ static int readdigits (RN *rn, int hexa) { static int read_number (lua_State *L, FILE *f) { RN rn; int count = 0; - int hexa = 0; + int hex = 0; char decp[2] = "."; rn.f = f; rn.n = 0; decp[0] = getlocaledecpoint(); /* get decimal point from locale */ @@ -434,13 +434,13 @@ static int read_number (lua_State *L, FILE *f) { do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ test2(&rn, "-+"); /* optional signal */ if (test2(&rn, "0")) { - if (test2(&rn, "xX")) hexa = 1; /* numeral is hexadecimal */ + if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ else count = 1; /* count initial '0' as a valid digit */ } - count += readdigits(&rn, hexa); /* integral part */ + count += readdigits(&rn, hex); /* integral part */ if (test2(&rn, decp)) /* decimal point? */ - count += readdigits(&rn, hexa); /* fractionary part */ - if (count > 0 && test2(&rn, (hexa ? "pP" : "eE"))) { /* exponent mark? */ + count += readdigits(&rn, hex); /* fractional part */ + if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ test2(&rn, "-+"); /* exponent signal */ readdigits(&rn, 0); /* exponent digits */ } @@ -654,7 +654,7 @@ static int f_setvbuf (lua_State *L) { FILE *f = tofile(L); int op = luaL_checkoption(L, 2, NULL, modenames); lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); - int res = setvbuf(f, NULL, mode[op], sz); + int res = setvbuf(f, NULL, mode[op], (size_t)sz); return luaL_fileresult(L, res == 0, NULL); } |