+ } else {
+ /* The current file stream position differs from the last one, so
+ caller must have called ftell/o(). Adjust accordingly. */
+ if (m->readpos + pos_movement >= m->msg_buf &&
+ m->readpos + pos_movement < m->end) {
+ /* We can shift readpos and remain within the bounds of
+ msg_buf. */
+ m->readpos += pos_movement;
+ m->total_bytes_read += pos_movement;
+ pos = m->last_internal_pos;
+ } else {
+ size_t num_read;
+
+ /* This seek skips past an integral number of chunks of
+ size MSG_INPUT_SIZE. */
+ fseeko (iob, pos / MSG_INPUT_SIZE * MSG_INPUT_SIZE, SEEK_SET);
+ num_read = fread (m->msg_buf, 1, MSG_INPUT_SIZE, iob);
+ m->readpos = m->msg_buf + pos % MSG_INPUT_SIZE;
+ m->end = m->msg_buf + num_read;
+ m->total_bytes_read = pos;
+ }