// If necessary, seek to the exact file position we're supposed to be
if (file->buff_ind != file->buff_len)
- lseek (file->handle, file->buff_ind - file->buff_len, SEEK_CUR);
+ lseek (file->handle, (fs_offset_t)(file->buff_ind - file->buff_len), SEEK_CUR);
// Purge cached data
FS_Purge (file);
// Write the buffer and update the position
- result = write (file->handle, data, datasize);
+ result = write (file->handle, data, (fs_offset_t)datasize);
file->position = lseek (file->handle, 0, SEEK_CUR);
if (file->real_length < file->position)
file->real_length = file->position;
// First, we copy as many bytes as we can from "buff"
if (file->buff_ind < file->buff_len)
{
- count = file->buff_len - file->buff_ind;
+ count = (fs_offset_t)(file->buff_len - file->buff_ind);
done += ((fs_offset_t)buffersize > count) ? count : (fs_offset_t)buffersize;
memcpy (buffer, &file->buff[file->buff_ind], done);
file->position += nb;
// Copy the requested data in "buffer" (as much as we can)
- count = (buffersize > file->buff_len) ? file->buff_len : buffersize;
+ count = (fs_offset_t)((buffersize > file->buff_len) ? file->buff_len : buffersize);
memcpy (&((qbyte*)buffer)[done], file->buff, count);
file->buff_ind = count;
done += count;
if (file->position == file->real_length)
return done;
- count = ztk->comp_length - ztk->in_position;
+ count = (fs_offset_t)(ztk->comp_length - ztk->in_position);
if (count > (fs_offset_t)sizeof (ztk->input))
count = (fs_offset_t)sizeof (ztk->input);
- lseek (file->handle, file->offset + ztk->in_position, SEEK_SET);
- if (read (file->handle, ztk->input, count) != (fs_offset_t)count)
+ lseek (file->handle, file->offset + (fs_offset_t)ztk->in_position, SEEK_SET);
+ if (read (file->handle, ztk->input, count) != count)
{
Con_Printf ("FS_Read: unexpected end of file");
break;
ztk->in_ind = ztk->in_len - ztk->zstream.avail_in;
file->buff_len = sizeof (file->buff) - ztk->zstream.avail_out;
- file->position += file->buff_len;
+ file->position += (fs_offset_t)file->buff_len;
// Copy the requested data in "buffer" (as much as we can)
- count = (buffersize > file->buff_len) ? file->buff_len : buffersize;
+ count = (fs_offset_t)((buffersize > file->buff_len) ? file->buff_len : buffersize);
memcpy (&((qbyte*)buffer)[done], file->buff, count);
file->buff_ind = count;
}
ztk->in_ind = ztk->in_len - ztk->zstream.avail_in;
// How much data did it inflate?
- count = buffersize - ztk->zstream.avail_out;
+ count = (fs_offset_t)(buffersize - ztk->zstream.avail_out);
file->position += count;
// Purge cached data
*/
fs_offset_t FS_Tell (qfile_t* file)
{
- return file->position - file->buff_len + file->buff_ind;
+ return file->position - (fs_offset_t)(file->buff_len + file->buff_ind);
}