aboutsummaryrefslogtreecommitdiff
path: root/liolib.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-06 16:05:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2002-05-06 16:05:10 -0300
commit71144e3ff0cb81bd9b8bb56d94dc76074c638c64 (patch)
tree8098675276d0640684898d4302ea98ae91e2c430 /liolib.c
parent0dbf0c5953a3d72deebc7e41840a0e73b46de8bc (diff)
downloadlua-71144e3ff0cb81bd9b8bb56d94dc76074c638c64.tar.gz
lua-71144e3ff0cb81bd9b8bb56d94dc76074c638c64.tar.bz2
lua-71144e3ff0cb81bd9b8bb56d94dc76074c638c64.zip
errors `return' int, to avoid warnings
+ home-made `sprintf' (first version)
Diffstat (limited to 'liolib.c')
-rw-r--r--liolib.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/liolib.c b/liolib.c
index bdfe380d..6d6024cf 100644
--- a/liolib.c
+++ b/liolib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: liolib.c,v 2.3 2002/04/12 19:56:25 roberto Exp roberto $ 2** $Id: liolib.c,v 2.4 2002/05/02 17:12:27 roberto Exp roberto $
3** Standard I/O (and system) library 3** Standard I/O (and system) library
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -257,7 +257,7 @@ static int g_read (lua_State *L, FILE *f, int first) {
257 else { 257 else {
258 const char *p = lua_tostring(L, n); 258 const char *p = lua_tostring(L, n);
259 if (!p || p[0] != '*') 259 if (!p || p[0] != '*')
260 luaL_verror(L, "invalid `read' option"); 260 return luaL_verror(L, "invalid `read' option");
261 switch (p[1]) { 261 switch (p[1]) {
262 case 'n': /* number */ 262 case 'n': /* number */
263 success = read_number(L, f); 263 success = read_number(L, f);
@@ -270,11 +270,10 @@ static int g_read (lua_State *L, FILE *f, int first) {
270 success = 1; /* always success */ 270 success = 1; /* always success */
271 break; 271 break;
272 case 'w': /* word */ 272 case 'w': /* word */
273 luaL_verror(L, "obsolete option `*w'"); 273 return luaL_verror(L, "obsolete option `*w'");
274 break; 274 break;
275 default: 275 default:
276 luaL_argerror(L, n, "invalid format"); 276 return luaL_argerror(L, n, "invalid format");
277 success = 0; /* to avoid warnings */
278 } 277 }
279 } 278 }
280 } 279 }
@@ -430,7 +429,7 @@ static int io_rename (lua_State *L) {
430static int io_tmpname (lua_State *L) { 429static int io_tmpname (lua_State *L) {
431 char buff[L_tmpnam]; 430 char buff[L_tmpnam];
432 if (tmpnam(buff) != buff) 431 if (tmpnam(buff) != buff)
433 luaL_verror(L, "unable to generate a unique filename"); 432 return luaL_verror(L, "unable to generate a unique filename");
434 lua_pushstring(L, buff); 433 lua_pushstring(L, buff);
435 return 1; 434 return 1;
436} 435}
@@ -471,7 +470,7 @@ static int getfield (lua_State *L, const char *key, int d) {
471 res = (int)(lua_tonumber(L, -1)); 470 res = (int)(lua_tonumber(L, -1));
472 else { 471 else {
473 if (d == -2) 472 if (d == -2)
474 luaL_verror(L, "field `%.20s' missing in date table", key); 473 return luaL_verror(L, "field `%s' missing in date table", key);
475 res = d; 474 res = d;
476 } 475 }
477 lua_pop(L, 1); 476 lua_pop(L, 1);
@@ -510,7 +509,7 @@ static int io_date (lua_State *L) {
510 if (strftime(b, sizeof(b), s, stm)) 509 if (strftime(b, sizeof(b), s, stm))
511 lua_pushstring(L, b); 510 lua_pushstring(L, b);
512 else 511 else
513 luaL_verror(L, "invalid `date' format"); 512 return luaL_verror(L, "invalid `date' format");
514 } 513 }
515 return 1; 514 return 1;
516} 515}