From: Steven Barth Date: Sat, 6 Jun 2009 10:09:52 +0000 (+0000) Subject: nixio: Use correct datatypes for base64 encode X-Git-Tag: 0.9.0~262 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c07ab17d59f9f897ce427eaf5910135d03079ece;p=oweals%2Fluci.git nixio: Use correct datatypes for base64 encode --- diff --git a/libs/nixio/src/binary.c b/libs/nixio/src/binary.c index 2466f9891..c2de38817 100644 --- a/libs/nixio/src/binary.c +++ b/libs/nixio/src/binary.c @@ -192,7 +192,7 @@ static int nixio_bin_unhexlify(lua_State *L) { static int nixio_bin_b64encode(lua_State *L) { size_t len, lenout, pad, i; - const char *data = luaL_checklstring(L, 1, &len); + const uint8_t *data = (const uint8_t*)luaL_checklstring(L, 1, &len); lenout = len / 3; lenout *= 4; @@ -213,7 +213,7 @@ static int nixio_bin_b64encode(lua_State *L) { return luaL_error(L, NIXIO_OOM); } - char *o = out; + uint8_t *o = (uint8_t*)out; for (i = 0; i < len; i += 3) { uint32_t cv = (data[i] << 16) | (data[i+1] << 8) | data[i+2]; *(o+3) = nixio__b64encode_tbl[ cv & 0x3f];