Closed zhuoyikang closed 9 years ago
static inline int32_t reader_check_size(buffer_reader *reader,uint32_t size) { uint32_t tmp = reader->pos + size; return reader->cur->size >= tmp && tmp > size; }
初始化的时候reader->pos为0,是不是应该是 tmp>=size ?
return reader->cur->size >= tmp && tmp >= size;
tmp > size 是判断 reader->pos + size是否出现回绕的
应该加个assert(size > 0);检查是否有0空间应该是逻辑错误
static inline int32_t reader_check_size(buffer_reader *reader,uint32_t size) { uint32_t tmp = reader->pos + size; return reader->cur->size >= tmp && tmp > size; }
初始化的时候reader->pos为0,是不是应该是 tmp>=size ?
return reader->cur->size >= tmp && tmp >= size;