Piotr Caban : msvcrt: Call ftell function in fgetpos.
Alexandre Julliard
julliard at winehq.org
Thu Jan 10 13:36:11 CST 2013
Module: wine
Branch: master
Commit: 568a3be86938d850a8aaa05220feeb39d8a154f1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=568a3be86938d850a8aaa05220feeb39d8a154f1
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Jan 10 11:43:49 2013 +0100
msvcrt: Call ftell function in fgetpos.
---
dlls/msvcrt/file.c | 29 ++---------------------------
1 files changed, 2 insertions(+), 27 deletions(-)
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index feabbca..8b5ec29 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -3591,34 +3591,9 @@ LONG CDECL MSVCRT_ftell(MSVCRT_FILE* file)
*/
int CDECL MSVCRT_fgetpos(MSVCRT_FILE* file, MSVCRT_fpos_t *pos)
{
- int off=0;
-
- MSVCRT__lock_file(file);
- *pos = MSVCRT__lseeki64(file->_file,0,SEEK_CUR);
- if(*pos == -1) {
- MSVCRT__unlock_file(file);
+ *pos = MSVCRT__ftelli64(file);
+ if(*pos == -1)
return -1;
- }
- if(file->_bufsiz) {
- if( file->_flag & MSVCRT__IOWRT ) {
- off = file->_ptr - file->_base;
- } else {
- off = -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')
- off--;
- }
- /* Black magic when reading CR at buffer boundary*/
- if(msvcrt_get_ioinfo(file->_file)->wxflag & WX_READCR)
- off--;
- }
- }
- }
- *pos += off;
- MSVCRT__unlock_file(file);
return 0;
}
More information about the wine-cvs
mailing list