antirez / lua-cmsgpack

A self contained Lua MessagePack C implementation.
355 stars 118 forks source link

use (signed char) instead of (char), this fixes for platforms that treat... #33

Closed tinglei8 closed 9 years ago

tinglei8 commented 10 years ago

On Android, char is interpreted as unsigned by default.

When decoding "int 8" format on Android, the following type conversion produces incorrect result: lua_pushnumber(L,(char)c->p[1]); // (e.g. -39 -> 217)

Changing (char) to (signed char) fixes this on Android and other platforms that treat char as unsigned by default.

antirez commented 9 years ago

Thanks, merged.