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

Alexandre Julliard julliard at winehq.org
Fri Jan 11 13:46:58 CST 2013


Module: wine
Branch: master
Commit: c1792e1a8acbd00d5cfc4f9c94718a84d4732761
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c1792e1a8acbd00d5cfc4f9c94718a84d4732761

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Jan 11 11:19:44 2013 +0100

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

---

 dlls/msvcrt/file.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index a1e4320..60af1a7 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -3798,6 +3798,14 @@ __int64 CDECL MSVCRT__ftelli64(MSVCRT_FILE* file)
     if(file->_bufsiz)  {
         if(file->_flag & MSVCRT__IOWRT) {
             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(MSVCRT__lseeki64(file->_file, 0, SEEK_END)==pos) {
             int i;




More information about the wine-cvs mailing list