when calculation the max_offset the (unsigned) leads to a cast
to a 32-bit unsigned integer depending on the platform. as a result
we update the max_offset everytime when it grows beyond 2^32.
this leads to a wrong return max_offset value if the callbacks
are received out of order.
Signed-off-by: Peter Lieven <pl@kamp.de>
if (res->READ3res_u.resok.count > 0) {
if (res->READ3res_u.resok.count <= mdata->count) {
memcpy(&data->buffer[mdata->offset - data->start_offset], res->READ3res_u.resok.data.data_val, res->READ3res_u.resok.count);
- if ((unsigned)data->max_offset < mdata->offset + res->READ3res_u.resok.count) {
+ if (data->max_offset < mdata->offset + res->READ3res_u.resok.count) {
data->max_offset = mdata->offset + res->READ3res_u.resok.count;
}
} else {
data->error = 1;
} else {
if (res->WRITE3res_u.resok.count > 0) {
- if ((unsigned)data->max_offset < mdata->offset + res->WRITE3res_u.resok.count) {
+ if (data->max_offset < mdata->offset + res->WRITE3res_u.resok.count) {
data->max_offset = mdata->offset + res->WRITE3res_u.resok.count;
}
}