One more empty body tweak

Francois Gouget fgouget at free.fr
Sun Sep 25 17:29:14 CDT 2005


While grepping I also found this construct:

     if (oflags & MSVCRT__O_APPEND)              wxflags |= WX_APPEND;
     if (oflags & MSVCRT__O_BINARY)              ;
     else if (oflags & MSVCRT__O_TEXT)           wxflags |= WX_TEXT;
     else if (*__p__fmode() & MSVCRT__O_BINARY)  ;
     else                                        wxflags |= WX_TEXT; /* default to TEXT*/
     if (oflags & MSVCRT__O_NOINHERIT)           wxflags |= WX_DONTINHERIT;
...


This one does not trigger the compiler warning and, short of rewriting 
this part of the code, I don't have an alternative that avoids the empty 
body. So I'm merely proposing to make the code's intent more explicit:

     if (oflags & MSVCRT__O_APPEND)              wxflags |= WX_APPEND;
     if (oflags & MSVCRT__O_BINARY)              {/* Nothing to do */}
     else if (oflags & MSVCRT__O_TEXT)           wxflags |= WX_TEXT;
     else if (*__p__fmode() & MSVCRT__O_BINARY)  {/* Nothing to do */}
     else                                        wxflags |= WX_TEXT; /* default to TEXT*/
     if (oflags & MSVCRT__O_NOINHERIT)           wxflags |= WX_DONTINHERIT;
...


Changelog:
  * dlls/msvcrt/file.c

    Francois Gouget <fgouget at free.fr>
    Make it clear the empty body sections are not accidental.

-- 
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
            Demander si un ordinateur peut penser revient à demander
                           si un sous-marin peut nager.
-------------- next part --------------
Index: dlls/msvcrt/file.c
===================================================================
RCS file: /var/cvs/wine/dlls/msvcrt/file.c,v
retrieving revision 1.89
diff -u -p -r1.89 file.c
--- dlls/msvcrt/file.c	2 Sep 2005 12:26:21 -0000	1.89
+++ dlls/msvcrt/file.c	21 Sep 2005 20:01:42 -0000
@@ -1314,9 +1314,9 @@ static unsigned split_oflags(unsigned of
     unsigned unsupp; /* until we support everything */
 
     if (oflags & MSVCRT__O_APPEND)              wxflags |= WX_APPEND;
-    if (oflags & MSVCRT__O_BINARY)              ;
+    if (oflags & MSVCRT__O_BINARY)              {/* Nothing to do */}
     else if (oflags & MSVCRT__O_TEXT)           wxflags |= WX_TEXT;
-    else if (*__p__fmode() & MSVCRT__O_BINARY)  ;
+    else if (*__p__fmode() & MSVCRT__O_BINARY)  {/* Nothing to do */}
     else                                        wxflags |= WX_TEXT; /* default to TEXT*/
     if (oflags & MSVCRT__O_NOINHERIT)           wxflags |= WX_DONTINHERIT;
 


More information about the wine-patches mailing list