Software /
code /
prosody
Comparison
util-src/encodings.c @ 1854:7e055cc6bc90
util.encodings: Fixed: Last change was not ANSI C compatible.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Fri, 02 Oct 2009 16:44:14 +0500 |
parent | 1829:3d0db768be2f |
child | 1855:63b5e7ec6840 |
comparison
equal
deleted
inserted
replaced
1838:8abe1d19c878 | 1854:7e055cc6bc90 |
---|---|
123 #include <stringprep.h> | 123 #include <stringprep.h> |
124 | 124 |
125 static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) | 125 static int stringprep_prep(lua_State *L, const Stringprep_profile *profile) |
126 { | 126 { |
127 size_t len; | 127 size_t len; |
128 const char *s = luaL_checklstring(L, 1, &len); | 128 const char *s; |
129 char string[1024]; | 129 char string[1024]; |
130 int ret; | 130 int ret; |
131 if(!lua_isstring(L, 1)) { | |
132 lua_pushnil(L); | |
133 return 1; | |
134 } | |
135 s = lua_tolstring(L, 1, &len); | |
131 if (len >= 1024) { | 136 if (len >= 1024) { |
132 lua_pushnil(L); | 137 lua_pushnil(L); |
133 return 1; // TODO return error message | 138 return 1; // TODO return error message |
134 } | 139 } |
135 strcpy(string, s); | 140 strcpy(string, s); |