Re: [PATCH v3] Fix variadic type mismatch in pushutfchar -- passes long but %U expects unsigned long

Halalaluyafail3 <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
I think the code is fine as is, because va_arg allows mixing corresponding 
singed and unsigned types as long as the value is representable in both 
types. 

On Wednesday, February 25, 2026 at 11:12:01 AM UTC-5 Weixie Cui wrote:

From: Weixie Cui <[email protected]> 

--- 
lutf8lib.c | 2 +- 
1 file changed, 1 insertion(+), 1 deletion(-) 

diff --git a/lutf8lib.c b/lutf8lib.c 
index b7f3fe1e..732f51b0 100644 
--- a/lutf8lib.c 
+++ b/lutf8lib.c 
@@ -146,7 +146,7 @@ static int codepoint (lua_State *L) { 
static void pushutfchar (lua_State *L, int arg) { 
lua_Unsigned code = (lua_Unsigned)luaL_checkinteger(L, arg); 
luaL_argcheck(L, code <= MAXUTF, arg, "value out of range"); 
- lua_pushfstring(L, "%U", (long)code); 
+ lua_pushfstring(L, "%U", (unsigned long)code); 
} 


-- 
2.39.5 (Apple Git-154) 

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/d8142463-f76c-46ce-955b-a00ffe6c4557n%40googlegroups.com.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.