Author: akhaldi Date: Thu May 22 14:10:49 2014 New Revision: 63410
URL: http://svn.reactos.org/svn/reactos?rev=63410&view=rev Log: [CRT] * Update fgetpos(). CORE-8080
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c
Modified: trunk/reactos/lib/sdk/crt/stdio/file.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdio/file.c?re... ============================================================================== --- trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] (original) +++ trunk/reactos/lib/sdk/crt/stdio/file.c [iso-8859-1] Thu May 22 14:10:49 2014 @@ -3416,34 +3416,9 @@ */ int CDECL fgetpos(FILE* file, fpos_t *pos) { - int off=0; - - _lock_file(file); - *pos = _lseeki64(file->_file,0,SEEK_CUR); - if(*pos == -1) { - _unlock_file(file); + *pos = _ftelli64(file); + if(*pos == -1) return -1; - } - if(file->_bufsiz) { - if( file->_flag & _IOWRT ) { - off = file->_ptr - file->_base; - } else { - off = -file->_cnt; - if (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') - off--; - } - /* Black magic when reading CR at buffer boundary*/ - if(get_ioinfo(file->_file)->wxflag & WX_READCR) - off--; - } - } - } - *pos += off; - _unlock_file(file); return 0; }