giowin32: use gint64 and _lseeki64

off_t on windows is 32bit which means that it will not be able
to handle big offsets
This commit is contained in:
Ignacio Casal Quinteiro 2022-01-20 11:07:20 +01:00
parent cc2b28b68c
commit 08017c0d6c

View File

@ -1291,8 +1291,7 @@ g_io_win32_fd_seek (GIOChannel *channel,
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
int whence, errsv;
off_t tmp_offset;
off_t result;
gint64 result;
switch (type)
{
@ -1311,16 +1310,7 @@ g_io_win32_fd_seek (GIOChannel *channel,
g_abort ();
}
tmp_offset = offset;
if (tmp_offset != offset)
{
g_set_error_literal (err, G_IO_CHANNEL_ERROR,
g_io_channel_error_from_errno (EINVAL),
g_strerror (EINVAL));
return G_IO_STATUS_ERROR;
}
result = lseek (win32_channel->fd, tmp_offset, whence);
result = _lseeki64 (win32_channel->fd, offset, whence);
errsv = errno;
if (result < 0)