[PATCH 1/2] msvcrt: Clean _open, _wopen, _sopen, _wsopen.

Lauri Kenttä lauri.kentta at gmail.com
Sat Feb 4 08:38:02 CST 2017


This doesn't have any functional effect.

Signed-off-by: Lauri Kenttä <lauri.kentta at gmail.com>
---
 dlls/msvcrt/file.c | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 1ef2ec92b2..b5aa20b548 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -2321,20 +2321,15 @@ int CDECL MSVCRT__wsopen_s( int *fd, const MSVCRT_wchar_t* path, int oflags, int
  */
 int CDECL MSVCRT__wsopen( const MSVCRT_wchar_t *path, int oflags, int shflags, ... )
 {
-  int pmode;
-  int fd;
+  int fd, pmode = 0;
 
   if (oflags & MSVCRT__O_CREAT)
   {
     __ms_va_list ap;
-
     __ms_va_start(ap, shflags);
     pmode = va_arg(ap, int);
     __ms_va_end(ap);
   }
-  else
-    pmode = 0;
-
   return MSVCRT__wsopen_dispatch(path, oflags, shflags, pmode, &fd, 0) ? -1 : fd;
 }
 
@@ -2372,20 +2367,15 @@ int CDECL MSVCRT__sopen_s( int *fd, const char *path, int oflags, int shflags, i
  */
 int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... )
 {
-  int pmode;
-  int fd;
+  int fd, pmode = 0;
 
   if (oflags & MSVCRT__O_CREAT)
   {
     __ms_va_list ap;
-
     __ms_va_start(ap, shflags);
     pmode = va_arg(ap, int);
     __ms_va_end(ap);
   }
-  else
-    pmode = 0;
-
   return MSVCRT__sopen_dispatch(path, oflags, shflags, pmode, &fd, 0) ? -1 : fd;
 }
 
@@ -2394,18 +2384,16 @@ int CDECL MSVCRT__sopen( const char *path, int oflags, int shflags, ... )
  */
 int CDECL MSVCRT__open( const char *path, int flags, ... )
 {
-  __ms_va_list ap;
+  int fd, pmode = 0;
 
   if (flags & MSVCRT__O_CREAT)
   {
-    int pmode;
+    __ms_va_list ap;
     __ms_va_start(ap, flags);
     pmode = va_arg(ap, int);
     __ms_va_end(ap);
-    return MSVCRT__sopen( path, flags, MSVCRT__SH_DENYNO, pmode );
   }
-  else
-    return MSVCRT__sopen( path, flags, MSVCRT__SH_DENYNO);
+  return MSVCRT__sopen_dispatch(path, flags, MSVCRT__SH_DENYNO, pmode, &fd, 0) ? -1 : fd;
 }
 
 /*********************************************************************
@@ -2413,18 +2401,16 @@ int CDECL MSVCRT__open( const char *path, int flags, ... )
  */
 int CDECL MSVCRT__wopen(const MSVCRT_wchar_t *path,int flags,...)
 {
-  __ms_va_list ap;
+  int fd, pmode = 0;
 
   if (flags & MSVCRT__O_CREAT)
   {
-    int pmode;
+    __ms_va_list ap;
     __ms_va_start(ap, flags);
     pmode = va_arg(ap, int);
     __ms_va_end(ap);
-    return MSVCRT__wsopen( path, flags, MSVCRT__SH_DENYNO, pmode );
   }
-  else
-    return MSVCRT__wsopen( path, flags, MSVCRT__SH_DENYNO);
+  return MSVCRT__wsopen_dispatch(path, flags, MSVCRT__SH_DENYNO, pmode, &fd, 0) ? -1 : fd;
 }
 
 /*********************************************************************
-- 
2.11.1




More information about the wine-patches mailing list