OLE32: fix more incorrect uses of STGM_ enumerations

Mike McCormack mike at codeweavers.com
Sun Mar 6 22:44:43 CST 2005


ChangeLog:
* fix more incorrect uses of STGM_ enumerations
-------------- next part --------------
Index: dlls/ole32/stg_bigblockfile.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/stg_bigblockfile.c,v
retrieving revision 1.15
diff -u -p -r1.15 stg_bigblockfile.c
--- dlls/ole32/stg_bigblockfile.c	22 Dec 2004 18:38:32 -0000	1.15
+++ dlls/ole32/stg_bigblockfile.c	7 Mar 2005 04:42:50 -0000
@@ -866,8 +866,11 @@ static void BIGBLOCKFILE_RemapAllMappedP
  */
 static DWORD BIGBLOCKFILE_GetProtectMode(DWORD openFlags)
 {
-    if (openFlags & (STGM_WRITE | STGM_READWRITE))
-	return PAGE_READWRITE;
-    else
-	return PAGE_READONLY;
+    switch(STGM_ACCESS_MODE(openFlags))
+    {
+    case STGM_WRITE:
+    case STGM_READWRITE:
+        return PAGE_READWRITE;
+    }
+    return PAGE_READONLY;
 }
Index: dlls/ole32/stg_stream.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/stg_stream.c,v
retrieving revision 1.24
diff -u -p -r1.24 stg_stream.c
--- dlls/ole32/stg_stream.c	11 Jan 2005 10:44:28 -0000	1.24
+++ dlls/ole32/stg_stream.c	7 Mar 2005 04:42:50 -0000
@@ -443,7 +443,12 @@ HRESULT WINAPI StgStreamImpl_Write(
   /*
    * Do we have permission to write to this stream?
    */
-  if (!(This->grfMode & (STGM_WRITE | STGM_READWRITE))) {
+  switch(STGM_ACCESS_MODE(This->grfMode))
+  {
+  case STGM_WRITE:
+  case STGM_READWRITE:
+      break;
+  default:
       return STG_E_ACCESSDENIED;
   }
 
Index: dlls/ole32/storage32.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage32.c,v
retrieving revision 1.72
diff -u -p -r1.72 storage32.c
--- dlls/ole32/storage32.c	5 Mar 2005 10:48:11 -0000	1.72
+++ dlls/ole32/storage32.c	7 Mar 2005 04:42:51 -0000
@@ -52,14 +52,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(storage);
 
 #define FILE_BEGIN 0
 
-#define STGM_ACCESS_MODE(stgm)   ((stgm)&0x0000f)
-#define STGM_SHARE_MODE(stgm)    ((stgm)&0x000f0)
-#define STGM_CREATE_MODE(stgm)   ((stgm)&0x0f000)
-
-#define STGM_KNOWN_FLAGS (0xf0ff | \
-     STGM_TRANSACTED | STGM_CONVERT | STGM_PRIORITY | STGM_NOSCRATCH | \
-     STGM_NOSNAPSHOT | STGM_DIRECT_SWMR | STGM_DELETEONRELEASE | STGM_SIMPLE)
-
 /* Used for OleConvertIStorageToOLESTREAM and OleConvertOLESTREAMToIStorage */
 #define OLESTREAM_ID 0x501
 #define OLESTREAM_MAX_STR_LEN 255
Index: dlls/ole32/storage32.h
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage32.h,v
retrieving revision 1.17
diff -u -p -r1.17 storage32.h
--- dlls/ole32/storage32.h	24 Feb 2005 19:39:27 -0000	1.17
+++ dlls/ole32/storage32.h	7 Mar 2005 04:42:51 -0000
@@ -100,6 +100,14 @@ static const ULONG PROPERTY_NULL        
 #define LIMIT_TO_USE_SMALL_BLOCK 0x1000
 #define NUM_BLOCKS_PER_DEPOT_BLOCK 128
 
+#define STGM_ACCESS_MODE(stgm)   ((stgm)&0x0000f)
+#define STGM_SHARE_MODE(stgm)    ((stgm)&0x000f0)
+#define STGM_CREATE_MODE(stgm)   ((stgm)&0x0f000)
+
+#define STGM_KNOWN_FLAGS (0xf0ff | \
+     STGM_TRANSACTED | STGM_CONVERT | STGM_PRIORITY | STGM_NOSCRATCH | \
+     STGM_NOSNAPSHOT | STGM_DIRECT_SWMR | STGM_DELETEONRELEASE | STGM_SIMPLE)
+
 /*
  * These are signatures to detect the type of Document file.
  */


More information about the wine-patches mailing list