diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-04-12 17:13:52 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2006-04-12 17:13:52 -0300 |
commit | 84879136970b76e5d1782f3b4664c7c8f9076821 (patch) | |
tree | d7cba2b3b7032c9bff3a01208c74b5d83a0209a6 | |
parent | 672bb67ee6b3f1c705fca4537824e6190c4a8d57 (diff) | |
download | lua-github-84879136970b76e5d1782f3b4664c7c8f9076821.tar.gz |
BUG: option '%q' for string.format does not handle '\r' correctly
-rw-r--r-- | bugs | 48 | ||||
-rw-r--r-- | lstrlib.c | 6 |
2 files changed, 52 insertions, 2 deletions
@@ -806,7 +806,7 @@ Bug{ what = [[In 16-bit machines, expressions and/or with numeric constants as the right operand may result in weird values]], -report = [[Andreas Stenius, 15/03/2006]], +report = [[Andreas Stenius/Kein-Hong Man, 15/03/2006]], example = [[ print(false or 0) -- on 16-bit machines @@ -877,3 +877,49 @@ patch = [[ } + +Bug{ +what = [[ +In Windows, +when Lua is used in an application that also uses DirectX, +it may present an erractic behavior. +THIS IS NOT A LUA BUG! +The problem is that DirectX violates an ABI that Lua depends on.]], + +patch = [[ +The simplest solution is to use DirectX with +the D3DCREATE_FPU_PRESERVE flag. + +Otherwise, you can change the definition of lua_number2int, +in luaconf.h, to this one: +#define lua_number2int(i,d) __asm fld d __asm fistp i +]], + +} + + +Bug{ +what = [[option '%q' in string.format does not handle '\r' correctly.]], + +example = [[ +local s = "a string with \r and \n and \r\n and \n\r" +local c = string.format("return %q", s) +assert(assert(loadstring(c))() == s) +]], + +patch = [[ +* lstrlib.c: +@@ -703,6 +703,10 @@ + luaL_addchar(b, *s); + break; + } ++ case '\r': { ++ luaL_addlstring(b, "\\r", 2); ++ break; ++ } + case '\0': { + luaL_addlstring(b, "\\000", 4); + break; +]], + +} @@ -1,5 +1,5 @@ /* -** $Id: lstrlib.c,v 1.129 2005/12/21 12:59:43 roberto Exp roberto $ +** $Id: lstrlib.c,v 1.130 2005/12/29 15:32:11 roberto Exp roberto $ ** Standard library for string operations and pattern-matching ** See Copyright Notice in lua.h */ @@ -703,6 +703,10 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { luaL_addchar(b, *s); break; } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } case '\0': { luaL_addlstring(b, "\\000", 4); break; |