aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lvm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lvm.c b/lvm.c
index 787130ff..da851516 100644
--- a/lvm.c
+++ b/lvm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lvm.c,v 1.107 2000/05/22 18:44:46 roberto Exp roberto $ 2** $Id: lvm.c,v 1.108 2000/05/24 13:54:49 roberto Exp roberto $
3** Lua virtual machine 3** Lua virtual machine
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -282,7 +282,8 @@ static void strconc (lua_State *L, int total, StkId top) {
282 call_binTM(L, top, IM_CONCAT, "unexpected type for concatenation"); 282 call_binTM(L, top, IM_CONCAT, "unexpected type for concatenation");
283 else if (tsvalue(top-1)->u.s.len > 0) { /* if len=0, do nothing */ 283 else if (tsvalue(top-1)->u.s.len > 0) { /* if len=0, do nothing */
284 /* at least two string values; get as many as possible */ 284 /* at least two string values; get as many as possible */
285 lint32 tl = tsvalue(top-1)->u.s.len + tsvalue(top-2)->u.s.len; 285 lint32 tl = (lint32)tsvalue(top-1)->u.s.len +
286 (lint32)tsvalue(top-2)->u.s.len;
286 char *buffer; 287 char *buffer;
287 int i; 288 int i;
288 while (n < total && !tostring(L, top-n-1)) { /* collect total length */ 289 while (n < total && !tostring(L, top-n-1)) { /* collect total length */
@@ -293,7 +294,7 @@ static void strconc (lua_State *L, int total, StkId top) {
293 buffer = luaL_openspace(L, tl); 294 buffer = luaL_openspace(L, tl);
294 tl = 0; 295 tl = 0;
295 for (i=n; i>0; i--) { /* concat all strings */ 296 for (i=n; i>0; i--) { /* concat all strings */
296 lint32 l = tsvalue(top-i)->u.s.len; 297 size_t l = tsvalue(top-i)->u.s.len;
297 memcpy(buffer+tl, tsvalue(top-i)->str, l); 298 memcpy(buffer+tl, tsvalue(top-i)->str, l);
298 tl += l; 299 tl += l;
299 } 300 }