summaryrefslogtreecommitdiff
path: root/core/src/xmake/base64/decode.c
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/xmake/base64/decode.c')
-rw-r--r--core/src/xmake/base64/decode.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/core/src/xmake/base64/decode.c b/core/src/xmake/base64/decode.c
index abb9abcbd..cb1b7eb82 100644
--- a/core/src/xmake/base64/decode.c
+++ b/core/src/xmake/base64/decode.c
@@ -22,8 +22,8 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* trace
*/
-#define TB_TRACE_MODULE_NAME "base64"
-#define TB_TRACE_MODULE_DEBUG (0)
+#define TB_TRACE_MODULE_NAME "base64"
+#define TB_TRACE_MODULE_DEBUG (0)
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
@@ -33,24 +33,20 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_int_t xm_base64_decode(lua_State* lua)
-{
- // check
+tb_int_t xm_base64_decode(lua_State *lua) {
tb_assert_and_check_return_val(lua, 0);
// get the string
- size_t size = 0;
- tb_char_t const* cstr = luaL_checklstring(lua, 1, &size);
+ size_t size = 0;
+ tb_char_t const *cstr = luaL_checklstring(lua, 1, &size);
tb_check_return_val(cstr && size, 0);
// decode it
tb_byte_t buff[8192];
- if (size < sizeof(buff))
- {
+ if (size < sizeof(buff)) {
tb_size_t real = tb_base64_decode(cstr, size, buff, sizeof(buff));
- if (real > 0)
- {
- lua_pushlstring(lua, (tb_char_t const*)buff, (tb_int_t)real);
+ if (real > 0) {
+ lua_pushlstring(lua, (tb_char_t const *)buff, (tb_int_t)real);
return 1;
}
}