Cast all the number types to signed values before making PHP longs out of them.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@773974
13f79535-47bb-0310-9956-
ffa450edef68
case T_BYTE: {
uint8_t c;
transport.readBytes(&c, 1);
- RETURN_LONG(c);
+ RETURN_LONG((int8_t)c);
}
case T_I16: {
uint16_t c;
transport.readBytes(&c, 2);
- RETURN_LONG(ntohs(c));
+ RETURN_LONG((int16_t)ntohs(c));
}
case T_I32: {
uint32_t c;
transport.readBytes(&c, 4);
- RETURN_LONG(ntohl(c));
+ RETURN_LONG((int32_t)ntohl(c));
}
case T_U64:
case T_I64: {
uint64_t c;
transport.readBytes(&c, 8);
- RETURN_LONG(ntohll(c));
+ RETURN_LONG((int64_t)ntohll(c));
}
case T_DOUBLE: {
union {