From 27766b1c030702960601094c113c0494cfac7676 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 2 Oct 2009 16:44:14 +0500 Subject: util.encodings: Fixed: Last change was not ANSI C compatible. --- util-src/encodings.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'util-src') diff --git a/util-src/encodings.c b/util-src/encodings.c index 65d7d501..6c6e53ea 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -125,9 +125,14 @@ static const luaL_Reg Reg_base64[] = static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) { size_t len; - const char *s = luaL_checklstring(L, 1, &len); + const char *s; char string[1024]; int ret; + if(!lua_isstring(L, 1)) { + lua_pushnil(L); + return 1; + } + s = lua_tolstring(L, 1, &len); if (len >= 1024) { lua_pushnil(L); return 1; // TODO return error message -- cgit v1.2.3 From eadb0d45b9be41a23841ded94b45209753f96257 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 2 Oct 2009 16:45:54 +0500 Subject: util.encodings: Included idn-free.h, which explicitly declares the idn_free function. --- util-src/encodings.c | 1 + 1 file changed, 1 insertion(+) (limited to 'util-src') diff --git a/util-src/encodings.c b/util-src/encodings.c index 6c6e53ea..704c7cf8 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -168,6 +168,7 @@ static const luaL_Reg Reg_stringprep[] = /***************** IDNA *****************/ #include +#include static int Lidna_to_ascii(lua_State *L) /** idna.to_ascii(s) */ { -- cgit v1.2.3 From 724ffca435bed3c9bbd6dbfa048c922a2b48a05e Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 2 Oct 2009 16:46:39 +0500 Subject: util.encodings: Removed a bit of unreachable code. --- util-src/encodings.c | 1 - 1 file changed, 1 deletion(-) (limited to 'util-src') diff --git a/util-src/encodings.c b/util-src/encodings.c index 704c7cf8..5147512f 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -108,7 +108,6 @@ static int Lbase64_decode(lua_State *L) /** decode(s) */ break; } } - return 0; } static const luaL_Reg Reg_base64[] = -- cgit v1.2.3