aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--llex.c6
-rw-r--r--lobject.c7
-rw-r--r--lobject.h4
-rw-r--r--lutf8lib.c8
4 files changed, 13 insertions, 12 deletions
diff --git a/llex.c b/llex.c
index 4f8756a6..66a3e3c4 100644
--- a/llex.c
+++ b/llex.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: llex.c,v 2.79 2014/07/18 12:17:54 roberto Exp roberto $ 2** $Id: llex.c,v 2.80 2014/07/18 13:36:14 roberto Exp roberto $
3** Lexical Analyzer 3** Lexical Analyzer
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -360,8 +360,8 @@ static int readhexaesc (LexState *ls) {
360} 360}
361 361
362 362
363static unsigned int readutf8esc (LexState *ls) { 363static unsigned long readutf8esc (LexState *ls) {
364 unsigned int r; 364 unsigned long r;
365 int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ 365 int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */
366 save_and_next(ls); /* skip 'u' */ 366 save_and_next(ls); /* skip 'u' */
367 esccheck(ls, ls->current == '{', "missing '{'"); 367 esccheck(ls, ls->current == '{', "missing '{'");
diff --git a/lobject.c b/lobject.c
index e7ce0141..0d59d344 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.c,v 2.88 2014/07/30 14:00:14 roberto Exp roberto $ 2** $Id: lobject.c,v 2.89 2014/08/01 17:24:02 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -310,8 +310,9 @@ size_t luaO_str2num (const char *s, TValue *o) {
310} 310}
311 311
312 312
313int luaO_utf8esc (char *buff, unsigned int x) { 313int luaO_utf8esc (char *buff, unsigned long x) {
314 int n = 1; /* number of bytes put in buffer (backwards) */ 314 int n = 1; /* number of bytes put in buffer (backwards) */
315 lua_assert(x <= 0x10FFFF);
315 if (x < 0x80) /* ascii? */ 316 if (x < 0x80) /* ascii? */
316 buff[UTF8BUFFSZ - 1] = x; 317 buff[UTF8BUFFSZ - 1] = x;
317 else { /* need continuation bytes */ 318 else { /* need continuation bytes */
@@ -402,7 +403,7 @@ const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) {
402 } 403 }
403 case 'U': { 404 case 'U': {
404 char buff[UTF8BUFFSZ]; 405 char buff[UTF8BUFFSZ];
405 int l = luaO_utf8esc(buff, va_arg(argp, int)); 406 int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long)));
406 pushstr(L, buff + UTF8BUFFSZ - l, l); 407 pushstr(L, buff + UTF8BUFFSZ - l, l);
407 break; 408 break;
408 } 409 }
diff --git a/lobject.h b/lobject.h
index 13fe3423..c721d3e8 100644
--- a/lobject.h
+++ b/lobject.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lobject.h,v 2.101 2014/07/30 14:00:14 roberto Exp roberto $ 2** $Id: lobject.h,v 2.102 2014/09/04 18:15:29 roberto Exp roberto $
3** Type definitions for Lua objects 3** Type definitions for Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -521,7 +521,7 @@ LUAI_DDEC const TValue luaO_nilobject_;
521 521
522LUAI_FUNC int luaO_int2fb (unsigned int x); 522LUAI_FUNC int luaO_int2fb (unsigned int x);
523LUAI_FUNC int luaO_fb2int (int x); 523LUAI_FUNC int luaO_fb2int (int x);
524LUAI_FUNC int luaO_utf8esc (char *buff, unsigned int x); 524LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x);
525LUAI_FUNC int luaO_ceillog2 (unsigned int x); 525LUAI_FUNC int luaO_ceillog2 (unsigned int x);
526LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, 526LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1,
527 const TValue *p2, TValue *res); 527 const TValue *p2, TValue *res);
diff --git a/lutf8lib.c b/lutf8lib.c
index e9557d61..3cf2f1cf 100644
--- a/lutf8lib.c
+++ b/lutf8lib.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lutf8lib.c,v 1.9 2014/05/14 18:33:37 roberto Exp roberto $ 2** $Id: lutf8lib.c,v 1.10 2014/07/16 13:56:14 roberto Exp roberto $
3** Standard library for UTF-8 manipulation 3** Standard library for UTF-8 manipulation
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -123,9 +123,9 @@ static int codepoint (lua_State *L) {
123 123
124 124
125static void pushutfchar (lua_State *L, int arg) { 125static void pushutfchar (lua_State *L, int arg) {
126 int code = luaL_checkint(L, arg); 126 lua_Integer code = luaL_checkinteger(L, arg);
127 luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); 127 luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range");
128 lua_pushfstring(L, "%U", code); 128 lua_pushfstring(L, "%U", (long)code);
129} 129}
130 130
131 131
@@ -157,7 +157,7 @@ static int utfchar (lua_State *L) {
157static int byteoffset (lua_State *L) { 157static int byteoffset (lua_State *L) {
158 size_t len; 158 size_t len;
159 const char *s = luaL_checklstring(L, 1, &len); 159 const char *s = luaL_checklstring(L, 1, &len);
160 int n = luaL_checkint(L, 2); 160 lua_Integer n = luaL_checkinteger(L, 2);
161 lua_Integer posi = (n >= 0) ? 1 : len + 1; 161 lua_Integer posi = (n >= 0) ? 1 : len + 1;
162 posi = u_posrelat(luaL_optinteger(L, 3, posi), len); 162 posi = u_posrelat(luaL_optinteger(L, 3, posi), len);
163 luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, 163 luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3,