diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2009-05-27 09:31:38 +0000 |
commit | bce60be30fe8e9c1b0eb33128c23c93d7bca5303 (patch) | |
tree | 3927343c777fcb7764a0f2f89754a0ceab141c21 /src/mime.c | |
parent | d1a72435d5bd3528f3c334cd4d1da16dcead47bf (diff) | |
download | luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.gz luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.tar.bz2 luasocket-bce60be30fe8e9c1b0eb33128c23c93d7bca5303.zip |
Decent makefiles!
Diffstat (limited to 'src/mime.c')
-rw-r--r-- | src/mime.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -272,9 +272,12 @@ static int mime_global_b64(lua_State *L) | |||
272 | input = (UC *) luaL_optlstring(L, 2, NULL, &isize); | 272 | input = (UC *) luaL_optlstring(L, 2, NULL, &isize); |
273 | /* if second part is nil, we are done */ | 273 | /* if second part is nil, we are done */ |
274 | if (!input) { | 274 | if (!input) { |
275 | size_t osize = 0; | ||
275 | asize = b64pad(atom, asize, &buffer); | 276 | asize = b64pad(atom, asize, &buffer); |
276 | luaL_pushresult(&buffer); | 277 | luaL_pushresult(&buffer); |
277 | if (!(*lua_tostring(L, -1))) lua_pushnil(L); | 278 | /* if the output is empty and the input is nil, return nil */ |
279 | lua_tolstring(L, -1, &osize); | ||
280 | if (osize == 0) lua_pushnil(L); | ||
278 | lua_pushnil(L); | 281 | lua_pushnil(L); |
279 | return 2; | 282 | return 2; |
280 | } | 283 | } |
@@ -313,8 +316,11 @@ static int mime_global_unb64(lua_State *L) | |||
313 | input = (UC *) luaL_optlstring(L, 2, NULL, &isize); | 316 | input = (UC *) luaL_optlstring(L, 2, NULL, &isize); |
314 | /* if second is nil, we are done */ | 317 | /* if second is nil, we are done */ |
315 | if (!input) { | 318 | if (!input) { |
319 | size_t osize = 0; | ||
316 | luaL_pushresult(&buffer); | 320 | luaL_pushresult(&buffer); |
317 | if (!(*lua_tostring(L, -1))) lua_pushnil(L); | 321 | /* if the output is empty and the input is nil, return nil */ |
322 | lua_tolstring(L, -1, &osize); | ||
323 | if (osize == 0) lua_pushnil(L); | ||
318 | lua_pushnil(L); | 324 | lua_pushnil(L); |
319 | return 2; | 325 | return 2; |
320 | } | 326 | } |