msvcrt: Simplify fseek implementation.
This commit is contained in:
parent
568a3be869
commit
4ffa9364eb
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue