msvcrt: Simplify fseek implementation.

oldstable
Piotr Caban 2013-01-10 11:44:02 +01:00 committed by Alexandre Julliard
parent 568a3be869
commit 4ffa9364eb
2 changed files with 4 additions and 12 deletions

View File

@ -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;

View File

@ -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);