assert(buf->ptr);
assert(data);
- if(packmsg_likely(buf->len >= dlen)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= dlen)) {
memcpy(buf->ptr, data, dlen);
buf->ptr += dlen;
buf->len -= dlen;
assert(buf->ptr);
assert(data);
- if(packmsg_likely(buf->len > dlen)) {
+ if(packmsg_likely(buf->len > 0 && (uint32_t)buf->len > dlen)) {
*buf->ptr = hdr;
buf->ptr++;
buf->len--;
assert(buf);
assert(buf->ptr);
- if(packmsg_likely(buf->len >= len)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= len)) {
void *ptr = buf->ptr;
buf->ptr += len;
buf->len -= len;
assert(buf->ptr);
assert(data);
- if(packmsg_likely(buf->len >= dlen)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= dlen)) {
memcpy(data, buf->ptr, dlen);
buf->ptr += dlen;
buf->len -= dlen;
return 0;
}
- if(packmsg_likely(buf->len >= slen)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= slen)) {
*str = (const char *)buf->ptr;
buf->ptr += slen;
buf->len -= slen;
return 0;
}
- if(packmsg_likely(buf->len >= dlen)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= dlen)) {
*data = buf->ptr;
buf->ptr += dlen;
buf->len -= dlen;
*type = packmsg_read_hdr_(buf);
- if(packmsg_likely(buf->len >= dlen)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= dlen)) {
*data = buf->ptr;
buf->ptr += dlen;
buf->len -= dlen;
dlen = skip;
}
- if(packmsg_likely(buf->len >= dlen)) {
+ if(packmsg_likely(buf->len >= 0 && (uint32_t)buf->len >= dlen)) {
buf->ptr += dlen;
buf->len -= dlen;
} else {