msvcrt: Fixed ftell behaviour when file is opened for writing in text mode.

This commit is contained in:
Piotr Caban 2013-01-11 11:19:44 +01:00 committed by Alexandre Julliard
parent 1fae72e759
commit c1792e1a8a
1 changed files with 8 additions and 0 deletions

View File

@ -3798,6 +3798,14 @@ __int64 CDECL MSVCRT__ftelli64(MSVCRT_FILE* file)
if(file->_bufsiz) { if(file->_bufsiz) {
if(file->_flag & MSVCRT__IOWRT) { if(file->_flag & MSVCRT__IOWRT) {
pos += file->_ptr - file->_base; pos += file->_ptr - file->_base;
if(msvcrt_get_ioinfo(file->_file)->wxflag & WX_TEXT) {
char *p;
for(p=file->_base; p<file->_ptr; p++)
if(*p == '\n')
pos++;
}
} else if(!file->_cnt) { /* nothing to do */ } else if(!file->_cnt) { /* nothing to do */
} else if(MSVCRT__lseeki64(file->_file, 0, SEEK_END)==pos) { } else if(MSVCRT__lseeki64(file->_file, 0, SEEK_END)==pos) {
int i; int i;