Commit 925d6027 authored by Alexandre Julliard's avatar Alexandre Julliard

CodeWeavers

Small fixes.
parent bb2eab5f
...@@ -246,7 +246,7 @@ void StgStreamImpl_OpenBlockChain( ...@@ -246,7 +246,7 @@ void StgStreamImpl_OpenBlockChain(
BOOL readSucessful; BOOL readSucessful;
/* /*
* Make sure no old object is staying behind. * Make sure no old object is left over.
*/ */
if (This->smallBlockChain != 0) if (This->smallBlockChain != 0)
{ {
...@@ -303,7 +303,7 @@ void StgStreamImpl_OpenBlockChain( ...@@ -303,7 +303,7 @@ void StgStreamImpl_OpenBlockChain(
/*** /***
* This method is part of the ISequentialStream interface. * This method is part of the ISequentialStream interface.
* *
* If reads a block of information from the stream at the current * It reads a block of information from the stream at the current
* position. It then moves the current position at the end of the * position. It then moves the current position at the end of the
* read block * read block
* *
...@@ -319,12 +319,13 @@ HRESULT WINAPI StgStreamImpl_Read( ...@@ -319,12 +319,13 @@ HRESULT WINAPI StgStreamImpl_Read(
ULONG bytesReadBuffer; ULONG bytesReadBuffer;
ULONG bytesToReadFromBuffer; ULONG bytesToReadFromBuffer;
HRESULT res = S_FALSE;
TRACE("(%p, %p, %ld, %p)\n", TRACE("(%p, %p, %ld, %p)\n",
iface, pv, cb, pcbRead); iface, pv, cb, pcbRead);
/* /*
* If the caller is not interested in the nubmer of bytes read, * If the caller is not interested in the number of bytes read,
* we use another buffer to avoid "if" statements in the code. * we use another buffer to avoid "if" statements in the code.
*/ */
if (pcbRead==0) if (pcbRead==0)
...@@ -338,7 +339,7 @@ HRESULT WINAPI StgStreamImpl_Read( ...@@ -338,7 +339,7 @@ HRESULT WINAPI StgStreamImpl_Read(
/* /*
* Depending on the type of chain that was opened when the stream was constructed, * Depending on the type of chain that was opened when the stream was constructed,
* we delegate the work to the method that read the block chains. * we delegate the work to the method that reads the block chains.
*/ */
if (This->smallBlockChain!=0) if (This->smallBlockChain!=0)
{ {
...@@ -365,7 +366,8 @@ HRESULT WINAPI StgStreamImpl_Read( ...@@ -365,7 +366,8 @@ HRESULT WINAPI StgStreamImpl_Read(
*/ */
*pcbRead = 0; *pcbRead = 0;
return S_OK; res = S_OK;
goto end;
} }
/* /*
...@@ -379,14 +381,23 @@ HRESULT WINAPI StgStreamImpl_Read( ...@@ -379,14 +381,23 @@ HRESULT WINAPI StgStreamImpl_Read(
*/ */
This->currentPosition.s.LowPart += *pcbRead; This->currentPosition.s.LowPart += *pcbRead;
/* if(*pcbRead != cb)
* The function returns S_OK if at least one byte could be read. {
* FIXME: What should be returned if pcbRead argument is NULL? WARN("read %ld instead of the required %ld bytes !\n", *pcbRead, cb);
*/ /*
if (*pcbRead > 0) * this used to return S_FALSE, however MSDN docu says that an app should
return S_OK; * be prepared to handle error in case of stream end reached, as *some*
* implementations *might* return an error (IOW: most do *not*).
* As some program fails on returning S_FALSE, I better use S_OK here.
*/
res = S_OK;
}
else
res = S_OK;
return S_FALSE; end:
TRACE("<-- %08lx\n", res);
return res;
} }
/*** /***
...@@ -632,7 +643,7 @@ HRESULT WINAPI StgStreamImpl_SetSize( ...@@ -632,7 +643,7 @@ HRESULT WINAPI StgStreamImpl_SetSize(
} }
/* /*
* Write to the property the new information about this stream * Write the new information about this stream to the property
*/ */
Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage,
This->ownerProperty, This->ownerProperty,
...@@ -686,8 +697,8 @@ HRESULT WINAPI StgStreamImpl_CopyTo( ...@@ -686,8 +697,8 @@ HRESULT WINAPI StgStreamImpl_CopyTo(
totalBytesWritten.s.LowPart = totalBytesWritten.s.HighPart = 0; totalBytesWritten.s.LowPart = totalBytesWritten.s.HighPart = 0;
/* /*
* use stack to store data temporarly * use stack to store data temporarily
* there is surely more performant way of doing it, for now this basic * there is surely a more performant way of doing it, for now this basic
* implementation will do the job * implementation will do the job
*/ */
while ( cb.s.LowPart > 0 ) while ( cb.s.LowPart > 0 )
...@@ -706,7 +717,7 @@ HRESULT WINAPI StgStreamImpl_CopyTo( ...@@ -706,7 +717,7 @@ HRESULT WINAPI StgStreamImpl_CopyTo(
totalBytesWritten.s.LowPart += bytesWritten; totalBytesWritten.s.LowPart += bytesWritten;
/* /*
* Check that read & write operations were succesfull * Check that read & write operations were successful
*/ */
if (bytesRead != bytesWritten) if (bytesRead != bytesWritten)
{ {
......
...@@ -179,15 +179,15 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName ...@@ -179,15 +179,15 @@ HRESULT OLECONVERT_CreateCompObjStream(LPSTORAGE pStorage, LPCSTR strOleTypeName
/**************************************************************************** /****************************************************************************
* Storage32BaseImpl definitions. * Storage32BaseImpl definitions.
* *
* This stucture defines the base information contained in all implementations * This structure defines the base information contained in all implementations
* of IStorage32 contained in this filee storage implementation. * of IStorage32 contained in this file storage implementation.
* *
* In OOP terms, this is the base class for all the IStorage32 implementations * In OOP terms, this is the base class for all the IStorage32 implementations
* contained in this file. * contained in this file.
*/ */
struct StorageBaseImpl struct StorageBaseImpl
{ {
ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct
* since we want to cast this in a Storage32 pointer */ * since we want to cast this in a Storage32 pointer */
/* /*
...@@ -281,8 +281,8 @@ HRESULT WINAPI StorageBaseImpl_SetClass( ...@@ -281,8 +281,8 @@ HRESULT WINAPI StorageBaseImpl_SetClass(
*/ */
struct StorageImpl struct StorageImpl
{ {
ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct
* since we want to cast this in a Storage32 pointer */ * since we want to cast this in a Storage32 pointer */
/* /*
* Declare the member of the Storage32BaseImpl class to allow * Declare the member of the Storage32BaseImpl class to allow
...@@ -300,6 +300,9 @@ struct StorageImpl ...@@ -300,6 +300,9 @@ struct StorageImpl
HANDLE hFile; /* Physical support for the Docfile */ HANDLE hFile; /* Physical support for the Docfile */
LPOLESTR pwcsName; /* Full path of the document file */ LPOLESTR pwcsName; /* Full path of the document file */
/* FIXME: should this be in Storage32BaseImpl ? */
WCHAR filename[PROPERTY_NAME_BUFFER_LEN];
/* /*
* File header * File header
*/ */
...@@ -477,7 +480,7 @@ void Storage32Impl_SetExtDepotBlock(StorageImpl* This, ...@@ -477,7 +480,7 @@ void Storage32Impl_SetExtDepotBlock(StorageImpl* This,
*/ */
struct StorageInternalImpl struct StorageInternalImpl
{ {
ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct
* since we want to cast this in a Storage32 pointer */ * since we want to cast this in a Storage32 pointer */
/* /*
...@@ -521,7 +524,7 @@ HRESULT WINAPI StorageInternalImpl_Revert( ...@@ -521,7 +524,7 @@ HRESULT WINAPI StorageInternalImpl_Revert(
*/ */
struct IEnumSTATSTGImpl struct IEnumSTATSTGImpl
{ {
ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the stuct ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the struct
* since we want to cast this in a IEnumSTATSTG pointer */ * since we want to cast this in a IEnumSTATSTG pointer */
ULONG ref; /* Reference count */ ULONG ref; /* Reference count */
...@@ -606,7 +609,7 @@ INT IEnumSTATSTGImpl_FindParentProperty( ...@@ -606,7 +609,7 @@ INT IEnumSTATSTGImpl_FindParentProperty(
*/ */
struct StgStreamImpl struct StgStreamImpl
{ {
ICOM_VFIELD(IStream); /* Needs to be the first item in the stuct ICOM_VFIELD(IStream); /* Needs to be the first item in the struct
* since we want to cast this in a IStream pointer */ * since we want to cast this in a IStream pointer */
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment