Msvcrt _IOXXX fix

François Gouget fgouget at codeweavers.com
Mon Oct 15 01:19:11 CDT 2001


Changelog:

   François Gouget <fgouget at codeweavers.com>

 * include/msvcrt/stdio.h,
   dlls/msvcrt/file.c

   The _IOXXX macros conflict with system headers on Solaris. Prefix
them.

-- 
François Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: include/msvcrt/stdio.h
===================================================================
RCS file: /home/wine/wine/include/msvcrt/stdio.h,v
retrieving revision 1.2
diff -u -r1.2 stdio.h
--- include/msvcrt/stdio.h	2001/05/07 18:18:34	1.2
+++ include/msvcrt/stdio.h	2001/10/15 04:50:47
@@ -15,14 +15,25 @@
 
 
 /* file._flag flags */
-#define _IOREAD   0x0001
-#define _IOWRT    0x0002
-#define _IOMYBUF  0x0008
-#define _IOEOF    0x0010
-#define _IOERR    0x0020
-#define _IOSTRG   0x0040
-#define _IORW     0x0080
-#define _IOAPPEND 0x0200
+#ifndef USE_MSVCRT_PREFIX
+#define _IOREAD          0x0001
+#define _IOWRT           0x0002
+#define _IOMYBUF         0x0008
+#define _IOEOF           0x0010
+#define _IOERR           0x0020
+#define _IOSTRG          0x0040
+#define _IORW            0x0080
+#define _IOAPPEND        0x0200
+#else
+#define MSVCRT__IOREAD   0x0001 
+#define MSVCRT__IOWRT    0x0002 
+#define MSVCRT__IOMYBUF  0x0008 
+#define MSVCRT__IOEOF    0x0010 
+#define MSVCRT__IOERR    0x0020 
+#define MSVCRT__IOSTRG   0x0040 
+#define MSVCRT__IORW     0x0080 
+#define MSVCRT__IOAPPEND 0x0200 
+#endif /* USE_MSVCRT_PREFIX */
 
 
 #ifndef USE_MSVCRT_PREFIX
Index: dlls/msvcrt/file.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/file.c,v
retrieving revision 1.10
diff -u -r1.10 file.c
--- dlls/msvcrt/file.c	2001/09/26 23:04:02	1.10
+++ dlls/msvcrt/file.c	2001/10/15 04:50:32
@@ -148,7 +148,7 @@
     {
       MSVCRT_files[fd]->_file = fd;
       MSVCRT_files[fd]->_flag = MSVCRT_flags[fd];
-      MSVCRT_files[fd]->_flag &= ~_IOAPPEND; /* mask out, see above */
+      MSVCRT_files[fd]->_flag &= ~MSVCRT__IOAPPEND; /* mask out, see above */
     }
   }
   TRACE(":got FILE* (%p)\n",MSVCRT_files[fd]);
@@ -162,11 +162,11 @@
   int i;
   memset(MSVCRT__iob,0,3*sizeof(MSVCRT_FILE));
   MSVCRT_handles[0] = GetStdHandle(STD_INPUT_HANDLE);
-  MSVCRT_flags[0] = MSVCRT__iob[0]._flag = _IOREAD;
+  MSVCRT_flags[0] = MSVCRT__iob[0]._flag = MSVCRT__IOREAD;
   MSVCRT_handles[1] = GetStdHandle(STD_OUTPUT_HANDLE);
-  MSVCRT_flags[1] = MSVCRT__iob[1]._flag = _IOWRT;
+  MSVCRT_flags[1] = MSVCRT__iob[1]._flag = MSVCRT__IOWRT;
   MSVCRT_handles[2] = GetStdHandle(STD_ERROR_HANDLE);
-  MSVCRT_flags[2] = MSVCRT__iob[2]._flag = _IOWRT;
+  MSVCRT_flags[2] = MSVCRT__iob[2]._flag = MSVCRT__IOWRT;
 
   TRACE(":handles (%d)(%d)(%d)\n",MSVCRT_handles[0],
 	MSVCRT_handles[1],MSVCRT_handles[2]);
@@ -376,7 +376,7 @@
    * will be set by the read()/write() functions.
    */
   if (MSVCRT_files[fd])
-    return MSVCRT_files[fd]->_flag & _IOEOF;
+    return MSVCRT_files[fd]->_flag & MSVCRT__IOEOF;
 
   /* Otherwise we do it the hard way */
   curpos = SetFilePointer(hand, 0, NULL, SEEK_CUR);
@@ -433,7 +433,7 @@
   if ((ret = SetFilePointer(hand, offset, NULL, whence)) != 0xffffffff)
   {
     if (MSVCRT_files[fd])
-      MSVCRT_files[fd]->_flag &= ~_IOEOF;
+      MSVCRT_files[fd]->_flag &= ~MSVCRT__IOEOF;
     /* FIXME: What if we seek _to_ EOF - is EOF set? */
     return ret;
   }
@@ -444,7 +444,7 @@
     case ERROR_NEGATIVE_SEEK:
     case ERROR_SEEK_ON_DEVICE:
       MSVCRT__set_errno(GetLastError());
-      MSVCRT_files[fd]->_flag |= _IOERR;
+      MSVCRT_files[fd]->_flag |= MSVCRT__IOERR;
       break;
     default:
       break;
@@ -459,7 +459,7 @@
 {
   TRACE(":file (%p) fd (%d)\n",file,file->_file);
   _lseek(file->_file,0,SEEK_SET);
-  file->_flag &= ~(_IOEOF | _IOERR);
+  file->_flag &= ~(MSVCRT__IOEOF | MSVCRT__IOERR);
 }
 
 /*********************************************************************
@@ -530,7 +530,7 @@
     {
       if (_commit(i) == -1)
 	if (MSVCRT_files[i])
-	  MSVCRT_files[i]->_flag |= _IOERR;
+	  MSVCRT_files[i]->_flag |= MSVCRT__IOERR;
       num_flushed++;
     }
 
@@ -732,15 +732,15 @@
   {
   case _O_RDONLY:
     access |= GENERIC_READ;
-    ioflag |= _IOREAD;
+    ioflag |= MSVCRT__IOREAD;
     break;
   case _O_WRONLY:
     access |= GENERIC_WRITE;
-    ioflag |= _IOWRT;
+    ioflag |= MSVCRT__IOWRT;
     break;
   case _O_RDWR:
     access |= GENERIC_WRITE | GENERIC_READ;
-    ioflag |= _IORW;
+    ioflag |= MSVCRT__IORW;
     break;
   }
 
@@ -761,7 +761,7 @@
       creation = OPEN_EXISTING;
   }
   if (flags & _O_APPEND)
-    ioflag |= _IOAPPEND;
+    ioflag |= MSVCRT__IOAPPEND;
 
 
   flags |= _O_BINARY; /* FIXME: Default to text */
@@ -800,7 +800,7 @@
   {
     if (flags & _O_TEMPORARY)
       MSVCRT_tempfiles[fd] = _strdup(path);
-    if (ioflag & _IOAPPEND)
+    if (ioflag & MSVCRT__IOAPPEND)
       _lseek(fd, 0, FILE_END);
   }
 
@@ -905,13 +905,13 @@
     if (num_read != count && MSVCRT_files[fd])
     {
       TRACE(":EOF\n");
-      MSVCRT_files[fd]->_flag |= _IOEOF;
+      MSVCRT_files[fd]->_flag |= MSVCRT__IOEOF;
     }
     return num_read;
   }
   TRACE(":failed-last error (%ld)\n",GetLastError());
   if (MSVCRT_files[fd])
-     MSVCRT_files[fd]->_flag |= _IOERR;
+     MSVCRT_files[fd]->_flag |= MSVCRT__IOERR;
   return -1;
 }
 
@@ -1158,7 +1158,7 @@
     return -1;
 
   /* If appending, go to EOF */
-  if (MSVCRT_flags[fd] & _IOAPPEND)
+  if (MSVCRT_flags[fd] & MSVCRT__IOAPPEND)
     _lseek(fd, 0, FILE_END);
 
   /* Set _cnt to 0 so optimised binaries will call our implementation
@@ -1173,7 +1173,7 @@
 
   TRACE(":failed-last error (%ld)\n",GetLastError());
   if (MSVCRT_files[fd])
-     MSVCRT_files[fd]->_flag |= _IOERR;
+     MSVCRT_files[fd]->_flag |= MSVCRT__IOERR;
 
   return -1;
 }
@@ -1192,7 +1192,7 @@
 void MSVCRT_clearerr(MSVCRT_FILE* file)
 {
   TRACE(":file (%p) fd (%d)\n",file,file->_file);
-  file->_flag &= ~(_IOERR | _IOEOF);
+  file->_flag &= ~(MSVCRT__IOERR | MSVCRT__IOEOF);
 }
 
 /*********************************************************************
@@ -1202,7 +1202,7 @@
 {
   int r;
   r=_close(file->_file);
-  return ((r==MSVCRT_EOF) || (file->_flag & _IOERR) ? MSVCRT_EOF : 0);
+  return ((r==MSVCRT_EOF) || (file->_flag & MSVCRT__IOERR) ? MSVCRT_EOF : 0);
 }
 
 /*********************************************************************
@@ -1210,7 +1210,7 @@
  */
 int MSVCRT_feof(MSVCRT_FILE* file)
 {
-  return file->_flag & _IOEOF;
+  return file->_flag & MSVCRT__IOEOF;
 }
 
 /*********************************************************************
@@ -1218,7 +1218,7 @@
  */
 int MSVCRT_ferror(MSVCRT_FILE* file)
 {
-  return file->_flag & _IOERR;
+  return file->_flag & MSVCRT__IOERR;
 }
 
 /*********************************************************************


More information about the wine-patches mailing list