Robert Shearman : ole: Fix mis-handling of return value in StgStreamImpl_Read.

Alexandre Julliard julliard at wine.codeweavers.com
Tue Jan 3 06:37:32 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 8f604e925d016a694e8f9d4ee1bf0505f409df23
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=8f604e925d016a694e8f9d4ee1bf0505f409df23

Author: Robert Shearman <rob at codeweavers.com>
Date:   Tue Jan  3 12:07:34 2006 +0100

ole: Fix mis-handling of return value in StgStreamImpl_Read.
BlockChainStream_ReadAt returns a BOOL, not an HRESULT so change
StgStreamImpl_Read to handle this, by returning STG_E_READFAULT on
failure.

---

 dlls/ole32/stg_stream.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/dlls/ole32/stg_stream.c b/dlls/ole32/stg_stream.c
index 40f0e81..19b8bda 100644
--- a/dlls/ole32/stg_stream.c
+++ b/dlls/ole32/stg_stream.c
@@ -249,7 +249,7 @@ static HRESULT WINAPI StgStreamImpl_Read
 
   ULONG bytesReadBuffer;
   ULONG bytesToReadFromBuffer;
-  HRESULT res = S_FALSE;
+  HRESULT res;
 
   TRACE("(%p, %p, %ld, %p)\n",
 	iface, pv, cb, pcbRead);
@@ -282,11 +282,15 @@ static HRESULT WINAPI StgStreamImpl_Read
   }
   else if (This->bigBlockChain!=0)
   {
-    res = BlockChainStream_ReadAt(This->bigBlockChain,
-			    This->currentPosition,
-			    bytesToReadFromBuffer,
-			    pv,
-			    pcbRead);
+    BOOL success = BlockChainStream_ReadAt(This->bigBlockChain,
+                                           This->currentPosition,
+                                           bytesToReadFromBuffer,
+                                           pv,
+                                           pcbRead);
+    if (success)
+      res = S_OK;
+    else
+      res = STG_E_READFAULT;
   }
   else
   {




More information about the wine-cvs mailing list