aboutsummaryrefslogtreecommitdiff
path: root/src/mime.c
diff options
context:
space:
mode:
authorDiego Nehab <diego@tecgraf.puc-rio.br>2004-11-28 02:36:07 +0000
committerDiego Nehab <diego@tecgraf.puc-rio.br>2004-11-28 02:36:07 +0000
commit297b32e828b76ee544c9d4f89f996eda78830cc0 (patch)
tree312ca3a296b1e959acddeca9303cb238ac8324dc /src/mime.c
parent05e8f243851049cebda6c5b690d3cde0f1e2c874 (diff)
downloadluasocket-297b32e828b76ee544c9d4f89f996eda78830cc0.tar.gz
luasocket-297b32e828b76ee544c9d4f89f996eda78830cc0.tar.bz2
luasocket-297b32e828b76ee544c9d4f89f996eda78830cc0.zip
LTN12 bug removed.
Diffstat (limited to 'src/mime.c')
-rw-r--r--src/mime.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/mime.c b/src/mime.c
index 8bc20d3..bd48920 100644
--- a/src/mime.c
+++ b/src/mime.c
@@ -267,6 +267,7 @@ static int mime_global_b64(lua_State *L)
267 if (!input) { 267 if (!input) {
268 asize = b64pad(atom, asize, &buffer); 268 asize = b64pad(atom, asize, &buffer);
269 luaL_pushresult(&buffer); 269 luaL_pushresult(&buffer);
270 if (!(*lua_tostring(L, -1))) lua_pushnil(L);
270 lua_pushnil(L); 271 lua_pushnil(L);
271 return 2; 272 return 2;
272 } 273 }
@@ -306,6 +307,7 @@ static int mime_global_unb64(lua_State *L)
306 /* if second is nil, we are done */ 307 /* if second is nil, we are done */
307 if (!input) { 308 if (!input) {
308 luaL_pushresult(&buffer); 309 luaL_pushresult(&buffer);
310 if (!(*lua_tostring(L, -1))) lua_pushnil(L);
309 lua_pushnil(L); 311 lua_pushnil(L);
310 return 2; 312 return 2;
311 } 313 }
@@ -418,7 +420,7 @@ static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer)
418 if (qpclass[input[i]] == QP_PLAIN) luaL_putchar(buffer, input[i]); 420 if (qpclass[input[i]] == QP_PLAIN) luaL_putchar(buffer, input[i]);
419 else qpquote(input[i], buffer); 421 else qpquote(input[i], buffer);
420 } 422 }
421 luaL_addstring(buffer, EQCRLF); 423 if (size > 0) luaL_addstring(buffer, EQCRLF);
422 return 0; 424 return 0;
423} 425}
424 426
@@ -454,7 +456,9 @@ static int mime_global_qp(lua_State *L)
454 if (!input) { 456 if (!input) {
455 asize = qppad(atom, asize, &buffer); 457 asize = qppad(atom, asize, &buffer);
456 luaL_pushresult(&buffer); 458 luaL_pushresult(&buffer);
459 if (!(*lua_tostring(L, -1))) lua_pushnil(L);
457 lua_pushnil(L); 460 lua_pushnil(L);
461 return 2;
458 } 462 }
459 /* otherwise process rest of input */ 463 /* otherwise process rest of input */
460 last = input + isize; 464 last = input + isize;
@@ -531,6 +535,7 @@ static int mime_global_unqp(lua_State *L)
531 /* if second part is nil, we are done */ 535 /* if second part is nil, we are done */
532 if (!input) { 536 if (!input) {
533 luaL_pushresult(&buffer); 537 luaL_pushresult(&buffer);
538 if (!(*lua_tostring(L, -1))) lua_pushnil(L);
534 lua_pushnil(L); 539 lua_pushnil(L);
535 return 2; 540 return 2;
536 } 541 }