diff options
Diffstat (limited to 'lobject.c')
-rw-r--r-- | lobject.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -366,8 +366,8 @@ int luaO_utf8esc (char *buff, unsigned long x) { | |||
366 | /* | 366 | /* |
367 | ** Convert a number object to a string, adding it to a buffer | 367 | ** Convert a number object to a string, adding it to a buffer |
368 | */ | 368 | */ |
369 | static size_t tostringbuff (TValue *obj, char *buff) { | 369 | static int tostringbuff (TValue *obj, char *buff) { |
370 | size_t len; | 370 | int len; |
371 | lua_assert(ttisnumber(obj)); | 371 | lua_assert(ttisnumber(obj)); |
372 | if (ttisinteger(obj)) | 372 | if (ttisinteger(obj)) |
373 | len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj)); | 373 | len = lua_integer2str(buff, MAXNUMBER2STR, ivalue(obj)); |
@@ -387,7 +387,7 @@ static size_t tostringbuff (TValue *obj, char *buff) { | |||
387 | */ | 387 | */ |
388 | void luaO_tostring (lua_State *L, TValue *obj) { | 388 | void luaO_tostring (lua_State *L, TValue *obj) { |
389 | char buff[MAXNUMBER2STR]; | 389 | char buff[MAXNUMBER2STR]; |
390 | size_t len = tostringbuff(obj, buff); | 390 | int len = tostringbuff(obj, buff); |
391 | setsvalue(L, obj, luaS_newlstr(L, buff, len)); | 391 | setsvalue(L, obj, luaS_newlstr(L, buff, len)); |
392 | } | 392 | } |
393 | 393 | ||
@@ -439,11 +439,11 @@ static void clearbuff (BuffFS *buff) { | |||
439 | 439 | ||
440 | /* | 440 | /* |
441 | ** Get a space of size 'sz' in the buffer. If buffer has not enough | 441 | ** Get a space of size 'sz' in the buffer. If buffer has not enough |
442 | ** space, empty it. 'sz' must fit in an empty space. | 442 | ** space, empty it. 'sz' must fit in an empty buffer. |
443 | */ | 443 | */ |
444 | static char *getbuff (BuffFS *buff, size_t sz) { | 444 | static char *getbuff (BuffFS *buff, int sz) { |
445 | lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS); | 445 | lua_assert(buff->blen <= BUFVFS); lua_assert(sz <= BUFVFS); |
446 | if (sz > BUFVFS - cast_sizet(buff->blen)) /* string does not fit? */ | 446 | if (sz > BUFVFS - buff->blen) /* not enough space? */ |
447 | clearbuff(buff); | 447 | clearbuff(buff); |
448 | return buff->space + buff->blen; | 448 | return buff->space + buff->blen; |
449 | } | 449 | } |
@@ -458,9 +458,9 @@ static char *getbuff (BuffFS *buff, size_t sz) { | |||
458 | */ | 458 | */ |
459 | static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { | 459 | static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { |
460 | if (slen <= BUFVFS) { /* does string fit into buffer? */ | 460 | if (slen <= BUFVFS) { /* does string fit into buffer? */ |
461 | char *bf = getbuff(buff, slen); | 461 | char *bf = getbuff(buff, cast_int(slen)); |
462 | memcpy(bf, str, slen); /* add string to buffer */ | 462 | memcpy(bf, str, slen); /* add string to buffer */ |
463 | addsize(buff, slen); | 463 | addsize(buff, cast_int(slen)); |
464 | } | 464 | } |
465 | else { /* string larger than buffer */ | 465 | else { /* string larger than buffer */ |
466 | clearbuff(buff); /* string comes after buffer's content */ | 466 | clearbuff(buff); /* string comes after buffer's content */ |
@@ -474,7 +474,7 @@ static void addstr2buff (BuffFS *buff, const char *str, size_t slen) { | |||
474 | */ | 474 | */ |
475 | static void addnum2buff (BuffFS *buff, TValue *num) { | 475 | static void addnum2buff (BuffFS *buff, TValue *num) { |
476 | char *numbuff = getbuff(buff, MAXNUMBER2STR); | 476 | char *numbuff = getbuff(buff, MAXNUMBER2STR); |
477 | size_t len = tostringbuff(num, numbuff); /* format number into 'numbuff' */ | 477 | int len = tostringbuff(num, numbuff); /* format number into 'numbuff' */ |
478 | addsize(buff, len); | 478 | addsize(buff, len); |
479 | } | 479 | } |
480 | 480 | ||