Commit 4ffa9364 authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Simplify fseek implementation.

parent 568a3be8
......@@ -1169,19 +1169,10 @@ int CDECL MSVCRT__fseeki64(MSVCRT_FILE* file, __int64 offset, int whence)
msvcrt_flush_buffer(file);
if(whence == SEEK_CUR && file->_flag & MSVCRT__IOREAD ) {
offset -= file->_cnt;
if (msvcrt_get_ioinfo(file->_file)->wxflag & WX_TEXT) {
/* Black magic correction for CR removal */
int i;
for (i=0; i<file->_cnt; i++) {
if (file->_ptr[i] == '\n')
offset--;
}
/* Black magic when reading CR at buffer boundary*/
if(msvcrt_get_ioinfo(file->_file)->wxflag & WX_READCR)
offset--;
}
whence = SEEK_SET;
offset += MSVCRT__ftelli64(file);
}
/* Discard buffered input */
file->_cnt = 0;
file->_ptr = file->_base;
......
......@@ -885,6 +885,7 @@ int __cdecl MSVCRT_fgetc(MSVCRT_FILE*);
int __cdecl MSVCRT_ungetc(int,MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT_fgetwc(MSVCRT_FILE*);
MSVCRT_wint_t __cdecl MSVCRT_ungetwc(MSVCRT_wint_t,MSVCRT_FILE*);
__int64 __cdecl MSVCRT__ftelli64(MSVCRT_FILE* file);
void __cdecl MSVCRT__exit(int);
void __cdecl MSVCRT_abort(void);
MSVCRT_ulong* __cdecl MSVCRT___doserrno(void);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment