diff options
author | Steven Barth <steven@midlink.org> | 2009-06-06 10:09:52 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2009-06-06 10:09:52 +0000 |
commit | c07ab17d59f9f897ce427eaf5910135d03079ece (patch) | |
tree | 4587e28f4298b39fd1d8fa322bdcf1d619d3053c /libs/nixio | |
parent | d1b7f94ce07f7741a96e017eb995d9dfcf84c0f3 (diff) |
nixio: Use correct datatypes for base64 encode
Diffstat (limited to 'libs/nixio')
-rw-r--r-- | libs/nixio/src/binary.c | 4 |
1 files changed, 2 insertions, 2 deletions
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]; |