diff --git a/lauxlib.c b/lauxlib.c index f2ba704f..e6d74168 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -476,7 +476,7 @@ static void *resizebox (lua_State *L, int idx, size_t newsize) { UBox *box = (UBox *)lua_touserdata(L, idx); void *temp = allocf(ud, box->box, box->bsize, newsize); if (temp == NULL && newsize > 0) /* allocation error? */ - luaL_error(L, "not enough memory for buffer allocation"); + luaL_error(L, "not enough memory"); box->box = temp; box->bsize = newsize; return temp; diff --git a/lutf8lib.c b/lutf8lib.c index 3b36a60e..901d985f 100644 --- a/lutf8lib.c +++ b/lutf8lib.c @@ -97,9 +97,9 @@ static int utflen (lua_State *L) { lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); int lax = lua_toboolean(L, 4); luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, - "initial position out of string"); + "initial position out of bounds"); luaL_argcheck(L, --posj < (lua_Integer)len, 3, - "final position out of string"); + "final position out of bounds"); while (posi <= posj) { const char *s1 = utf8_decode(s + posi, NULL, !lax); if (s1 == NULL) { /* conversion error? */ @@ -127,8 +127,8 @@ static int codepoint (lua_State *L) { int lax = lua_toboolean(L, 4); int n; const char *se; - luaL_argcheck(L, posi >= 1, 2, "out of range"); - luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); + luaL_argcheck(L, posi >= 1, 2, "out of bounds"); + luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of bounds"); if (posi > pose) return 0; /* empty interval; return no values */ if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ return luaL_error(L, "string slice too long"); @@ -187,7 +187,7 @@ static int byteoffset (lua_State *L) { lua_Integer posi = (n >= 0) ? 1 : len + 1; posi = u_posrelat(luaL_optinteger(L, 3, posi), len); luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, - "position out of range"); + "position out of bounds"); if (n == 0) { /* find beginning of current byte sequence */ while (posi > 0 && iscont(s + posi)) posi--; diff --git a/testes/utf8.lua b/testes/utf8.lua index 5954f6e8..6010d1ad 100644 --- a/testes/utf8.lua +++ b/testes/utf8.lua @@ -115,17 +115,17 @@ do end -- error in initial position for offset -checkerror("position out of range", utf8.offset, "abc", 1, 5) -checkerror("position out of range", utf8.offset, "abc", 1, -4) -checkerror("position out of range", utf8.offset, "", 1, 2) -checkerror("position out of range", utf8.offset, "", 1, -1) +checkerror("position out of bounds", utf8.offset, "abc", 1, 5) +checkerror("position out of bounds", utf8.offset, "abc", 1, -4) +checkerror("position out of bounds", utf8.offset, "", 1, 2) +checkerror("position out of bounds", utf8.offset, "", 1, -1) checkerror("continuation byte", utf8.offset, "𦧺", 1, 2) checkerror("continuation byte", utf8.offset, "𦧺", 1, 2) checkerror("continuation byte", utf8.offset, "\x80", 1) -- error in indices for len -checkerror("out of string", utf8.len, "abc", 0, 2) -checkerror("out of string", utf8.len, "abc", 1, 4) +checkerror("out of bounds", utf8.len, "abc", 0, 2) +checkerror("out of bounds", utf8.len, "abc", 1, 4) local s = "hello World" @@ -140,11 +140,11 @@ do local t = {utf8.codepoint(s,1,#s - 1)} assert(#t == 3 and t[1] == 225 and t[2] == 233 and t[3] == 237) checkerror("invalid UTF%-8 code", utf8.codepoint, s, 1, #s) - checkerror("out of range", utf8.codepoint, s, #s + 1) + checkerror("out of bounds", utf8.codepoint, s, #s + 1) t = {utf8.codepoint(s, 4, 3)} assert(#t == 0) - checkerror("out of range", utf8.codepoint, s, -(#s + 1), 1) - checkerror("out of range", utf8.codepoint, s, 1, #s + 1) + checkerror("out of bounds", utf8.codepoint, s, -(#s + 1), 1) + checkerror("out of bounds", utf8.codepoint, s, 1, #s + 1) -- surrogates assert(utf8.codepoint("\u{D7FF}") == 0xD800 - 1) assert(utf8.codepoint("\u{E000}") == 0xDFFF + 1)