Added support for anonymous structs/unions on compilers that implement it.
diff --git a/ole/antimoniker.c b/ole/antimoniker.c index f4a526b..dcb41e6 100644 --- a/ole/antimoniker.c +++ b/ole/antimoniker.c
@@ -261,9 +261,9 @@ /* Normaly the sizemax must be the size of DWORD ! but I tested this function it ususlly return 16 bytes */ /* more than the number of bytes used by AntiMoniker::Save function */ - pcbSize->LowPart = sizeof(DWORD)+16; + pcbSize->s.LowPart = sizeof(DWORD)+16; - pcbSize->HighPart=0; + pcbSize->s.HighPart=0; return S_OK; }
diff --git a/ole/compositemoniker.c b/ole/compositemoniker.c index 72d7b37..d727e4d 100644 --- a/ole/compositemoniker.c +++ b/ole/compositemoniker.c
@@ -409,8 +409,8 @@ if (pcbSize!=NULL) return E_POINTER; - pcbSize->LowPart =0; - pcbSize->HighPart=0; + pcbSize->s.LowPart =0; + pcbSize->s.HighPart=0; IMoniker_Enum(iface,TRUE,&enumMk); @@ -420,8 +420,8 @@ IMoniker_Release(pmk); - pcbSize->LowPart +=ptmpSize.LowPart; - pcbSize->HighPart+=ptmpSize.HighPart; + pcbSize->s.LowPart +=ptmpSize.s.LowPart; + pcbSize->s.HighPart+=ptmpSize.s.HighPart; } IEnumMoniker_Release(enumMk);
diff --git a/ole/datacache.c b/ole/datacache.c index 1a9e386..864f6d2 100644 --- a/ole/datacache.c +++ b/ole/datacache.c
@@ -773,8 +773,8 @@ /* * Skip the header */ - offset.HighPart = 0; - offset.LowPart = sizeof(PresentationDataHeader); + offset.s.HighPart = 0; + offset.s.LowPart = sizeof(PresentationDataHeader); hres = IStream_Seek( presStream, @@ -787,7 +787,7 @@ */ metafileBits = HeapAlloc(GetProcessHeap(), 0, - streamInfo.cbSize.LowPart); + streamInfo.cbSize.s.LowPart); /* * Read the metafile bits. @@ -795,7 +795,7 @@ hres = IStream_Read( presStream, metafileBits, - streamInfo.cbSize.LowPart, + streamInfo.cbSize.s.LowPart, NULL); /* @@ -803,7 +803,7 @@ */ if (SUCCEEDED(hres)) { - newMetafile = SetMetaFileBitsEx(streamInfo.cbSize.LowPart, metafileBits); + newMetafile = SetMetaFileBitsEx(streamInfo.cbSize.s.LowPart, metafileBits); } /*
diff --git a/ole/filemoniker.c b/ole/filemoniker.c index b56544b..4a399a4 100644 --- a/ole/filemoniker.c +++ b/ole/filemoniker.c
@@ -423,8 +423,8 @@ sizeof(WORD)+ /* constant : 0x3 */ len*sizeof(WCHAR); /* unicde filePath string */ - pcbSize->LowPart=sizeMAx; - pcbSize->HighPart=0; + pcbSize->s.LowPart=sizeMAx; + pcbSize->s.HighPart=0; return S_OK; }
diff --git a/ole/hglobalstream.c b/ole/hglobalstream.c index bcd6386..7361425 100644 --- a/ole/hglobalstream.c +++ b/ole/hglobalstream.c
@@ -257,14 +257,14 @@ /* * Start the stream at the begining. */ - newStream->currentPosition.HighPart = 0; - newStream->currentPosition.LowPart = 0; + newStream->currentPosition.s.HighPart = 0; + newStream->currentPosition.s.LowPart = 0; /* * Initialize the size of the stream to the size of the handle. */ - newStream->streamSize.HighPart = 0; - newStream->streamSize.LowPart = GlobalSize(newStream->supportHandle); + newStream->streamSize.s.HighPart = 0; + newStream->streamSize.s.LowPart = GlobalSize(newStream->supportHandle); } return newStream; @@ -420,19 +420,19 @@ * Using the known size of the stream, calculate the number of bytes * to read from the block chain */ - bytesToReadFromBuffer = MIN( This->streamSize.LowPart - This->currentPosition.LowPart, cb); + bytesToReadFromBuffer = MIN( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb); /* * Lock the buffer in position and copy the data. */ supportBuffer = GlobalLock(This->supportHandle); - memcpy(pv, (char *) supportBuffer+This->currentPosition.LowPart, bytesToReadFromBuffer); + memcpy(pv, (char *) supportBuffer+This->currentPosition.s.LowPart, bytesToReadFromBuffer); /* * Move the current position to the new position */ - This->currentPosition.LowPart+=bytesToReadFromBuffer; + This->currentPosition.s.LowPart+=bytesToReadFromBuffer; /* * Return the number of bytes read. @@ -493,14 +493,14 @@ } else { - newSize.HighPart = 0; - newSize.LowPart = This->currentPosition.LowPart + cb; + newSize.s.HighPart = 0; + newSize.s.LowPart = This->currentPosition.s.LowPart + cb; } /* * Verify if we need to grow the stream */ - if (newSize.LowPart > This->streamSize.LowPart) + if (newSize.s.LowPart > This->streamSize.s.LowPart) { /* grow stream */ IStream_SetSize(iface, newSize); @@ -511,12 +511,12 @@ */ supportBuffer = GlobalLock(This->supportHandle); - memcpy((char *) supportBuffer+This->currentPosition.LowPart, pv, cb); + memcpy((char *) supportBuffer+This->currentPosition.s.LowPart, pv, cb); /* * Move the current position to the new position */ - This->currentPosition.LowPart+=cb; + This->currentPosition.s.LowPart+=cb; /* * Return the number of bytes read. @@ -550,7 +550,7 @@ ULARGE_INTEGER newPosition; TRACE("(%p, %ld, %ld, %p)\n", iface, - dlibMove.LowPart, dwOrigin, plibNewPosition); + dlibMove.s.LowPart, dwOrigin, plibNewPosition); /* * The caller is allowed to pass in NULL as the new position return value. @@ -569,8 +569,8 @@ switch (dwOrigin) { case STREAM_SEEK_SET: - plibNewPosition->HighPart = 0; - plibNewPosition->LowPart = 0; + plibNewPosition->s.HighPart = 0; + plibNewPosition->s.LowPart = 0; break; case STREAM_SEEK_CUR: *plibNewPosition = This->currentPosition; @@ -585,13 +585,13 @@ /* * We don't support files with offsets of 64 bits. */ - assert(dlibMove.HighPart == 0); + assert(dlibMove.s.HighPart == 0); /* * Check if we end-up before the beginning of the file. That should trigger an * error. */ - if ( (dlibMove.LowPart<0) && (plibNewPosition->LowPart < (ULONG)(-dlibMove.LowPart)) ) + if ( (dlibMove.s.LowPart<0) && (plibNewPosition->s.LowPart < (ULONG)(-dlibMove.s.LowPart)) ) { /* * I don't know what error to send there. @@ -604,7 +604,7 @@ * If the file pointer ends-up after the end of the stream, the next Write operation will * make the file larger. This is how it is documented. */ - plibNewPosition->LowPart += dlibMove.LowPart; + plibNewPosition->s.LowPart += dlibMove.s.LowPart; This->currentPosition = *plibNewPosition; return S_OK; @@ -625,25 +625,25 @@ { HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; - TRACE("(%p, %ld)\n", iface, libNewSize.LowPart); + TRACE("(%p, %ld)\n", iface, libNewSize.s.LowPart); /* * As documented. */ - if (libNewSize.HighPart != 0) + if (libNewSize.s.HighPart != 0) return STG_E_INVALIDFUNCTION; - if (This->streamSize.LowPart == libNewSize.LowPart) + if (This->streamSize.s.LowPart == libNewSize.s.LowPart) return S_OK; /* * Re allocate the HGlobal to fit the new size of the stream. */ This->supportHandle = GlobalReAlloc(This->supportHandle, - libNewSize.LowPart, + libNewSize.s.LowPart, 0); - This->streamSize.LowPart = libNewSize.LowPart; + This->streamSize.s.LowPart = libNewSize.s.LowPart; return S_OK; } @@ -669,7 +669,7 @@ ULARGE_INTEGER totalBytesWritten; TRACE("(%p, %p, %ld, %p, %p)\n", iface, pstm, - cb.LowPart, pcbRead, pcbWritten); + cb.s.LowPart, pcbRead, pcbWritten); /* * Sanity check @@ -677,28 +677,28 @@ if ( pstm == 0 ) return STG_E_INVALIDPOINTER; - totalBytesRead.LowPart = totalBytesRead.HighPart = 0; - totalBytesWritten.LowPart = totalBytesWritten.HighPart = 0; + totalBytesRead.s.LowPart = totalBytesRead.s.HighPart = 0; + totalBytesWritten.s.LowPart = totalBytesWritten.s.HighPart = 0; /* * use stack to store data temporarly * there is surely more performant way of doing it, for now this basic * implementation will do the job */ - while ( cb.LowPart > 0 ) + while ( cb.s.LowPart > 0 ) { - if ( cb.LowPart >= 128 ) + if ( cb.s.LowPart >= 128 ) copySize = 128; else - copySize = cb.LowPart; + copySize = cb.s.LowPart; IStream_Read(iface, tmpBuffer, copySize, &bytesRead); - totalBytesRead.LowPart += bytesRead; + totalBytesRead.s.LowPart += bytesRead; IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten); - totalBytesWritten.LowPart += bytesWritten; + totalBytesWritten.s.LowPart += bytesWritten; /* * Check that read & write operations were succesfull @@ -710,9 +710,9 @@ } if (bytesRead!=copySize) - cb.LowPart = 0; + cb.s.LowPart = 0; else - cb.LowPart -= bytesRead; + cb.s.LowPart -= bytesRead; } /* @@ -720,14 +720,14 @@ */ if (pcbRead) { - pcbRead->LowPart = totalBytesRead.LowPart; - pcbRead->HighPart = totalBytesRead.HighPart; + pcbRead->s.LowPart = totalBytesRead.s.LowPart; + pcbRead->s.HighPart = totalBytesRead.s.HighPart; } if (pcbWritten) { - pcbWritten->LowPart = totalBytesWritten.LowPart; - pcbWritten->HighPart = totalBytesWritten.HighPart; + pcbWritten->s.LowPart = totalBytesWritten.s.LowPart; + pcbWritten->s.HighPart = totalBytesWritten.s.HighPart; } return hr; }
diff --git a/ole/itemmoniker.c b/ole/itemmoniker.c index d7d0648..d21a37d 100644 --- a/ole/itemmoniker.c +++ b/ole/itemmoniker.c
@@ -322,13 +322,13 @@ /* for more details see ItemMonikerImpl_Save coments */ - pcbSize->LowPart = sizeof(DWORD) + /* DWORD witch contains delimiter length */ + pcbSize->s.LowPart = sizeof(DWORD) + /* DWORD witch contains delimiter length */ delimiterLength + /* item delimiter string */ sizeof(DWORD) + /* DWORD witch contains item name length */ nameLength + /* item name string */ 34; /* this constant was added ! because when I tested this function it usually */ /* returns 34 bytes more than the number of bytes used by IMoniker::Save function */ - pcbSize->HighPart=0; + pcbSize->s.HighPart=0; return S_OK; }
diff --git a/ole/memlockbytes.c b/ole/memlockbytes.c index 5c1db00..e408035 100644 --- a/ole/memlockbytes.c +++ b/ole/memlockbytes.c
@@ -215,8 +215,8 @@ /* * Initialize the size of the array to the size of the handle. */ - newLockBytes->byteArraySize.HighPart = 0; - newLockBytes->byteArraySize.LowPart = GlobalSize( + newLockBytes->byteArraySize.s.HighPart = 0; + newLockBytes->byteArraySize.s.LowPart = GlobalSize( newLockBytes->supportHandle); } @@ -365,15 +365,15 @@ /* * Make sure the offset is valid. */ - if (ulOffset.LowPart > This->byteArraySize.LowPart) + if (ulOffset.s.LowPart > This->byteArraySize.s.LowPart) return E_FAIL; /* * Using the known size of the array, calculate the number of bytes * to read. */ - bytesToReadFromBuffer = MIN(This->byteArraySize.LowPart - - ulOffset.LowPart, cb); + bytesToReadFromBuffer = MIN(This->byteArraySize.s.LowPart - + ulOffset.s.LowPart, cb); /* * Lock the buffer in position and copy the data. @@ -381,7 +381,7 @@ supportBuffer = GlobalLock(This->supportHandle); memcpy(pv, - (char *) supportBuffer + ulOffset.LowPart, + (char *) supportBuffer + ulOffset.s.LowPart, bytesToReadFromBuffer); /* @@ -440,14 +440,14 @@ } else { - newSize.HighPart = 0; - newSize.LowPart = ulOffset.LowPart + cb; + newSize.s.HighPart = 0; + newSize.s.LowPart = ulOffset.s.LowPart + cb; } /* * Verify if we need to grow the stream */ - if (newSize.LowPart > This->byteArraySize.LowPart) + if (newSize.s.LowPart > This->byteArraySize.s.LowPart) { /* grow stream */ if (HGLOBALLockBytesImpl_SetSize(iface, newSize) == STG_E_MEDIUMFULL) @@ -459,7 +459,7 @@ */ supportBuffer = GlobalLock(This->supportHandle); - memcpy((char *) supportBuffer + ulOffset.LowPart, pv, cb); + memcpy((char *) supportBuffer + ulOffset.s.LowPart, pv, cb); /* * Return the number of bytes written. @@ -500,23 +500,23 @@ /* * As documented. */ - if (libNewSize.HighPart != 0) + if (libNewSize.s.HighPart != 0) return STG_E_INVALIDFUNCTION; - if (This->byteArraySize.LowPart == libNewSize.LowPart) + if (This->byteArraySize.s.LowPart == libNewSize.s.LowPart) return S_OK; /* * Re allocate the HGlobal to fit the new size of the stream. */ This->supportHandle = GlobalReAlloc(This->supportHandle, - libNewSize.LowPart, + libNewSize.s.LowPart, 0); if (This->supportHandle == 0) return STG_E_MEDIUMFULL; - This->byteArraySize.LowPart = libNewSize.LowPart; + This->byteArraySize.s.LowPart = libNewSize.s.LowPart; return S_OK; }
diff --git a/ole/olefont.c b/ole/olefont.c index 52464da..6a1c082 100644 --- a/ole/olefont.c +++ b/ole/olefont.c
@@ -540,8 +540,8 @@ if (psize==0) return E_POINTER; - psize->u.Hi = 0; - psize->u.Lo = this->description.cySize.u.Lo; + psize->s.Hi = 0; + psize->s.Lo = this->description.cySize.s.Lo; return S_OK; } @@ -557,8 +557,8 @@ { _ICOM_THIS(OLEFontImpl, iface); - this->description.cySize.u.Hi = 0; - this->description.cySize.u.Lo = this->description.cySize.u.Lo; + this->description.cySize.s.Hi = 0; + this->description.cySize.s.Lo = this->description.cySize.s.Lo; return S_OK; } @@ -810,7 +810,7 @@ */ IFont_get_Size(iface, &cySize); - fontHeight = MulDiv(cySize.u.Lo, 2540L, 72L); + fontHeight = MulDiv(cySize.s.Lo, 2540L, 72L); fontHeight = MulDiv(fontHeight, this->cyLogical,this->cyHimetric); memset(&logFont, 0, sizeof(LOGFONTW)); @@ -1232,12 +1232,12 @@ /* * Size */ - IStream_Read(pLoadStream, &this->description.cySize.u.Lo, 4, &cbRead); + IStream_Read(pLoadStream, &this->description.cySize.s.Lo, 4, &cbRead); if (cbRead!=4) return E_FAIL; - this->description.cySize.u.Hi = 0; + this->description.cySize.s.Hi = 0; /* * FontName @@ -1327,7 +1327,7 @@ /* * Size */ - IStream_Write(pOutStream, &this->description.cySize.u.Lo, 4, &cbWritten); + IStream_Write(pOutStream, &this->description.cySize.s.Lo, 4, &cbWritten); if (cbWritten!=4) return E_FAIL; @@ -1379,18 +1379,18 @@ if (pcbSize==NULL) return E_POINTER; - pcbSize->HighPart = 0; - pcbSize->LowPart = 0; + pcbSize->s.HighPart = 0; + pcbSize->s.LowPart = 0; - pcbSize->LowPart += sizeof(BYTE); /* Version */ - pcbSize->LowPart += sizeof(WORD); /* Lang code */ - pcbSize->LowPart += sizeof(BYTE); /* Flags */ - pcbSize->LowPart += sizeof(WORD); /* Weight */ - pcbSize->LowPart += sizeof(DWORD); /* Size */ - pcbSize->LowPart += sizeof(BYTE); /* StrLength */ + pcbSize->s.LowPart += sizeof(BYTE); /* Version */ + pcbSize->s.LowPart += sizeof(WORD); /* Lang code */ + pcbSize->s.LowPart += sizeof(BYTE); /* Flags */ + pcbSize->s.LowPart += sizeof(WORD); /* Weight */ + pcbSize->s.LowPart += sizeof(DWORD); /* Size */ + pcbSize->s.LowPart += sizeof(BYTE); /* StrLength */ if (this->description.lpstrName!=0) - pcbSize->LowPart += lstrlenW(this->description.lpstrName); + pcbSize->s.LowPart += lstrlenW(this->description.lpstrName); return S_OK; }
diff --git a/ole/stg_bigblockfile.c b/ole/stg_bigblockfile.c index 04e7279..d251738 100644 --- a/ole/stg_bigblockfile.c +++ b/ole/stg_bigblockfile.c
@@ -175,7 +175,7 @@ return FALSE; } - This->filesize.LowPart = GetFileSize(This->hfile, NULL); + This->filesize.s.LowPart = GetFileSize(This->hfile, NULL); /* create the mapped pages list */ @@ -221,8 +221,8 @@ */ ILockBytes_AddRef(This->pLkbyt); - This->filesize.LowPart = GlobalSize(This->hbytearray); - This->filesize.HighPart = 0; + This->filesize.s.LowPart = GlobalSize(This->hbytearray); + This->filesize.s.HighPart = 0; This->pbytearray = GlobalLock(This->hbytearray); @@ -289,8 +289,8 @@ * */ if ((This->blocksize * (index + 1)) > - (This->filesize.LowPart + - (This->blocksize - (This->filesize.LowPart % This->blocksize)))) + (This->filesize.s.LowPart + + (This->blocksize - (This->filesize.s.LowPart % This->blocksize)))) return 0; return BIGBLOCKFILE_GetBigBlockPointer(This, index, FILE_MAP_READ); @@ -316,12 +316,12 @@ /* * make sure that the block physically exists */ - if ((This->blocksize * (index + 1)) > This->filesize.LowPart) + if ((This->blocksize * (index + 1)) > This->filesize.s.LowPart) { ULARGE_INTEGER newSize; - newSize.HighPart = 0; - newSize.LowPart = This->blocksize * (index + 1); + newSize.s.HighPart = 0; + newSize.s.LowPart = This->blocksize * (index + 1); BIGBLOCKFILE_SetSize(This, newSize); } @@ -377,7 +377,7 @@ */ void BIGBLOCKFILE_SetSize(LPBIGBLOCKFILE This, ULARGE_INTEGER newSize) { - if (This->filesize.LowPart == newSize.LowPart) + if (This->filesize.s.LowPart == newSize.s.LowPart) return; if (This->fileBased) @@ -396,7 +396,7 @@ /* * set the new end of file */ - SetFilePointer(This->hfile, newSize.LowPart, NULL, FILE_BEGIN); + SetFilePointer(This->hfile, newSize.s.LowPart, NULL, FILE_BEGIN); SetEndOfFile(This->hfile); /* @@ -429,8 +429,8 @@ */ BIGBLOCKFILE_RemoveAllBlocks(This); - This->filesize.LowPart = newSize.LowPart; - This->filesize.HighPart = newSize.HighPart; + This->filesize.s.LowPart = newSize.s.LowPart; + This->filesize.s.HighPart = newSize.s.HighPart; } /****************************************************************************** @@ -811,8 +811,8 @@ newMappedPage->next = This->maplisthead->next; This->maplisthead->next = newMappedPage; - if (((pagenum + 1) * PAGE_SIZE) > This->filesize.LowPart) - numBytesToMap = This->filesize.LowPart - (pagenum * PAGE_SIZE); + if (((pagenum + 1) * PAGE_SIZE) > This->filesize.s.LowPart) + numBytesToMap = This->filesize.s.LowPart - (pagenum * PAGE_SIZE); else numBytesToMap = PAGE_SIZE;
diff --git a/ole/stg_stream.c b/ole/stg_stream.c index 65167a2..101cce2 100644 --- a/ole/stg_stream.c +++ b/ole/stg_stream.c
@@ -84,14 +84,14 @@ /* * Start the stream at the begining. */ - newStream->currentPosition.HighPart = 0; - newStream->currentPosition.LowPart = 0; + newStream->currentPosition.s.HighPart = 0; + newStream->currentPosition.s.LowPart = 0; /* * Initialize the rest of the data. */ - newStream->streamSize.HighPart = 0; - newStream->streamSize.LowPart = 0; + newStream->streamSize.s.HighPart = 0; + newStream->streamSize.s.LowPart = 0; newStream->bigBlockChain = 0; newStream->smallBlockChain = 0; @@ -272,16 +272,16 @@ /* * This code supports only streams that are <32 bits in size. */ - assert(This->streamSize.HighPart == 0); + assert(This->streamSize.s.HighPart == 0); if(curProperty.startingBlock == BLOCK_END_OF_CHAIN) { - assert( (This->streamSize.HighPart == 0) && (This->streamSize.LowPart == 0) ); + assert( (This->streamSize.s.HighPart == 0) && (This->streamSize.s.LowPart == 0) ); } else { - if ( (This->streamSize.HighPart == 0) && - (This->streamSize.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) + if ( (This->streamSize.s.HighPart == 0) && + (This->streamSize.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) { This->smallBlockChain = SmallBlockChainStream_Construct( This->parentStorage->ancestorStorage, @@ -332,7 +332,7 @@ * Using the known size of the stream, calculate the number of bytes * to read from the block chain */ - bytesToReadFromBuffer = MIN( This->streamSize.LowPart - This->currentPosition.LowPart, cb); + bytesToReadFromBuffer = MIN( This->streamSize.s.LowPart - This->currentPosition.s.LowPart, cb); /* * Depending on the type of chain that was opened when the stream was constructed, @@ -375,7 +375,7 @@ /* * Advance the pointer for the number of positions read. */ - This->currentPosition.LowPart += *pcbRead; + This->currentPosition.s.LowPart += *pcbRead; /* * The function returns S_OK if the buffer was filled completely @@ -430,14 +430,14 @@ } else { - newSize.HighPart = 0; - newSize.LowPart = This->currentPosition.LowPart + cb; + newSize.s.HighPart = 0; + newSize.s.LowPart = This->currentPosition.s.LowPart + cb; } /* * Verify if we need to grow the stream */ - if (newSize.LowPart > This->streamSize.LowPart) + if (newSize.s.LowPart > This->streamSize.s.LowPart) { /* grow stream */ IStream_SetSize(iface, newSize); @@ -470,7 +470,7 @@ /* * Advance the position pointer for the number of positions written. */ - This->currentPosition.LowPart += *pcbWritten; + This->currentPosition.s.LowPart += *pcbWritten; return S_OK; } @@ -494,7 +494,7 @@ ULARGE_INTEGER newPosition; TRACE("(%p, %ld, %ld, %p)\n", - iface, dlibMove.LowPart, dwOrigin, plibNewPosition); + iface, dlibMove.s.LowPart, dwOrigin, plibNewPosition); /* * The caller is allowed to pass in NULL as the new position return value. @@ -513,8 +513,8 @@ switch (dwOrigin) { case STREAM_SEEK_SET: - plibNewPosition->HighPart = 0; - plibNewPosition->LowPart = 0; + plibNewPosition->s.HighPart = 0; + plibNewPosition->s.LowPart = 0; break; case STREAM_SEEK_CUR: *plibNewPosition = This->currentPosition; @@ -529,13 +529,13 @@ /* * We don't support files with offsets of 64 bits. */ - assert(dlibMove.HighPart == 0); + assert(dlibMove.s.HighPart == 0); /* * Check if we end-up before the beginning of the file. That should trigger an * error. */ - if ( (dlibMove.LowPart<0) && (plibNewPosition->LowPart < (ULONG)(-dlibMove.LowPart)) ) + if ( (dlibMove.s.LowPart<0) && (plibNewPosition->s.LowPart < (ULONG)(-dlibMove.s.LowPart)) ) { /* * I don't know what error to send there. @@ -548,7 +548,7 @@ * If the file pointer ends-up after the end of the stream, the next Write operation will * make the file larger. This is how it is documented. */ - plibNewPosition->LowPart += dlibMove.LowPart; + plibNewPosition->s.LowPart += dlibMove.s.LowPart; This->currentPosition = *plibNewPosition; return S_OK; @@ -572,15 +572,15 @@ StgProperty curProperty; BOOL Success; - TRACE("(%p, %ld)\n", iface, libNewSize.LowPart); + TRACE("(%p, %ld)\n", iface, libNewSize.s.LowPart); /* * As documented. */ - if (libNewSize.HighPart != 0) + if (libNewSize.s.HighPart != 0) return STG_E_INVALIDFUNCTION; - if (This->streamSize.LowPart == libNewSize.LowPart) + if (This->streamSize.s.LowPart == libNewSize.s.LowPart) return S_OK; /* @@ -588,7 +588,7 @@ */ if ((This->smallBlockChain == 0) && (This->bigBlockChain == 0)) { - if (libNewSize.LowPart < LIMIT_TO_USE_SMALL_BLOCK) + if (libNewSize.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) { This->smallBlockChain = SmallBlockChainStream_Construct( This->parentStorage->ancestorStorage, @@ -613,9 +613,9 @@ * Determine if we have to switch from small to big blocks or vice versa */ if ( (This->smallBlockChain!=0) && - (curProperty.size.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) + (curProperty.size.s.LowPart < LIMIT_TO_USE_SMALL_BLOCK) ) { - if (libNewSize.LowPart >= LIMIT_TO_USE_SMALL_BLOCK) + if (libNewSize.s.LowPart >= LIMIT_TO_USE_SMALL_BLOCK) { /* * Transform the small block chain into a big block chain @@ -642,8 +642,8 @@ This->ownerProperty, &curProperty); - curProperty.size.HighPart = libNewSize.HighPart; - curProperty.size.LowPart = libNewSize.LowPart; + curProperty.size.s.HighPart = libNewSize.s.HighPart; + curProperty.size.s.LowPart = libNewSize.s.LowPart; if (Success) { @@ -678,7 +678,7 @@ ULARGE_INTEGER totalBytesWritten; TRACE("(%p, %p, %ld, %p, %p)\n", - iface, pstm, cb.LowPart, pcbRead, pcbWritten); + iface, pstm, cb.s.LowPart, pcbRead, pcbWritten); /* * Sanity check @@ -686,28 +686,28 @@ if ( pstm == 0 ) return STG_E_INVALIDPOINTER; - totalBytesRead.LowPart = totalBytesRead.HighPart = 0; - totalBytesWritten.LowPart = totalBytesWritten.HighPart = 0; + totalBytesRead.s.LowPart = totalBytesRead.s.HighPart = 0; + totalBytesWritten.s.LowPart = totalBytesWritten.s.HighPart = 0; /* * use stack to store data temporarly * there is surely more performant way of doing it, for now this basic * implementation will do the job */ - while ( cb.LowPart > 0 ) + while ( cb.s.LowPart > 0 ) { - if ( cb.LowPart >= 128 ) + if ( cb.s.LowPart >= 128 ) copySize = 128; else - copySize = cb.LowPart; + copySize = cb.s.LowPart; IStream_Read(iface, tmpBuffer, copySize, &bytesRead); - totalBytesRead.LowPart += bytesRead; + totalBytesRead.s.LowPart += bytesRead; IStream_Write(pstm, tmpBuffer, bytesRead, &bytesWritten); - totalBytesWritten.LowPart += bytesWritten; + totalBytesWritten.s.LowPart += bytesWritten; /* * Check that read & write operations were succesfull @@ -719,9 +719,9 @@ } if (bytesRead!=copySize) - cb.LowPart = 0; + cb.s.LowPart = 0; else - cb.LowPart -= bytesRead; + cb.s.LowPart -= bytesRead; } /* @@ -729,14 +729,14 @@ */ if (pcbRead) { - pcbRead->LowPart = totalBytesRead.LowPart; - pcbRead->HighPart = totalBytesRead.HighPart; + pcbRead->s.LowPart = totalBytesRead.s.LowPart; + pcbRead->s.HighPart = totalBytesRead.s.HighPart; } if (pcbWritten) { - pcbWritten->LowPart = totalBytesWritten.LowPart; - pcbWritten->HighPart = totalBytesWritten.HighPart; + pcbWritten->s.LowPart = totalBytesWritten.s.LowPart; + pcbWritten->s.HighPart = totalBytesWritten.s.HighPart; } return hr; }
diff --git a/ole/storage.c b/ole/storage.c index d1dcc4a..5962f12 100644 --- a/ole/storage.c +++ b/ole/storage.c
@@ -732,7 +732,7 @@ IStream16* iface,LARGE_INTEGER offset,DWORD whence,ULARGE_INTEGER *newpos ) { ICOM_THIS(IStream16Impl,iface); - TRACE_(relay)("(%p)->([%ld.%ld],%ld,%p)\n",This,offset.HighPart,offset.LowPart,whence,newpos); + TRACE_(relay)("(%p)->([%ld.%ld],%ld,%p)\n",This,offset.s.HighPart,offset.s.LowPart,whence,newpos); switch (whence) { /* unix SEEK_xx should be the same as win95 ones */ @@ -740,31 +740,31 @@ /* offset must be ==0 (<0 is invalid, and >0 cannot be handled * right now. */ - assert(offset.HighPart==0); - This->offset.HighPart = offset.HighPart; - This->offset.LowPart = offset.LowPart; + assert(offset.s.HighPart==0); + This->offset.s.HighPart = offset.s.HighPart; + This->offset.s.LowPart = offset.s.LowPart; break; case SEEK_CUR: - if (offset.HighPart < 0) { + if (offset.s.HighPart < 0) { /* FIXME: is this negation correct ? */ - offset.HighPart = -offset.HighPart; - offset.LowPart = (0xffffffff ^ offset.LowPart)+1; + offset.s.HighPart = -offset.s.HighPart; + offset.s.LowPart = (0xffffffff ^ offset.s.LowPart)+1; - assert(offset.HighPart==0); - assert(This->offset.LowPart >= offset.LowPart); - This->offset.LowPart -= offset.LowPart; + assert(offset.s.HighPart==0); + assert(This->offset.s.LowPart >= offset.s.LowPart); + This->offset.s.LowPart -= offset.s.LowPart; } else { - assert(offset.HighPart==0); - This->offset.LowPart+= offset.LowPart; + assert(offset.s.HighPart==0); + This->offset.s.LowPart+= offset.s.LowPart; } break; case SEEK_END: - assert(offset.HighPart==0); - This->offset.LowPart = This->stde.pps_size-offset.LowPart; + assert(offset.s.HighPart==0); + This->offset.s.LowPart = This->stde.pps_size-offset.s.LowPart; break; } - if (This->offset.LowPart>This->stde.pps_size) - This->offset.LowPart=This->stde.pps_size; + if (This->offset.s.LowPart>This->stde.pps_size) + This->offset.s.LowPart=This->stde.pps_size; if (newpos) *newpos = This->offset; return S_OK; } @@ -784,11 +784,11 @@ if (!pcbRead) bytesread=&xxread; *bytesread = 0; - if (cb>This->stde.pps_size-This->offset.LowPart) - cb=This->stde.pps_size-This->offset.LowPart; + if (cb>This->stde.pps_size-This->offset.s.LowPart) + cb=This->stde.pps_size-This->offset.s.LowPart; if (This->stde.pps_size < 0x1000) { /* use small block reader */ - blocknr = STORAGE_get_nth_next_small_blocknr(This->hf,This->stde.pps_sb,This->offset.LowPart/SMALLSIZE); + blocknr = STORAGE_get_nth_next_small_blocknr(This->hf,This->stde.pps_sb,This->offset.s.LowPart/SMALLSIZE); while (cb) { int cc; @@ -797,10 +797,10 @@ return E_FAIL; } cc = cb; - if (cc>SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1))) - cc=SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1)); - memcpy((LPBYTE)pv,block+(This->offset.LowPart&(SMALLSIZE-1)),cc); - This->offset.LowPart+=cc; + if (cc>SMALLSIZE-(This->offset.s.LowPart&(SMALLSIZE-1))) + cc=SMALLSIZE-(This->offset.s.LowPart&(SMALLSIZE-1)); + memcpy((LPBYTE)pv,block+(This->offset.s.LowPart&(SMALLSIZE-1)),cc); + This->offset.s.LowPart+=cc; (LPBYTE)pv+=cc; *bytesread+=cc; cb-=cc; @@ -808,7 +808,7 @@ } } else { /* use big block reader */ - blocknr = STORAGE_get_nth_next_big_blocknr(This->hf,This->stde.pps_sb,This->offset.LowPart/BIGSIZE); + blocknr = STORAGE_get_nth_next_big_blocknr(This->hf,This->stde.pps_sb,This->offset.s.LowPart/BIGSIZE); while (cb) { int cc; @@ -817,10 +817,10 @@ return E_FAIL; } cc = cb; - if (cc>BIGSIZE-(This->offset.LowPart&(BIGSIZE-1))) - cc=BIGSIZE-(This->offset.LowPart&(BIGSIZE-1)); - memcpy((LPBYTE)pv,block+(This->offset.LowPart&(BIGSIZE-1)),cc); - This->offset.LowPart+=cc; + if (cc>BIGSIZE-(This->offset.s.LowPart&(BIGSIZE-1))) + cc=BIGSIZE-(This->offset.s.LowPart&(BIGSIZE-1)); + memcpy((LPBYTE)pv,block+(This->offset.s.LowPart&(BIGSIZE-1)),cc); + This->offset.s.LowPart+=cc; (LPBYTE)pv+=cc; *bytesread+=cc; cb-=cc; @@ -847,7 +847,7 @@ TRACE_(relay)("(%p)->(%p,%ld,%p)\n",This,pv,cb,pcbWrite); /* do we need to junk some blocks? */ - newsize = This->offset.LowPart+cb; + newsize = This->offset.s.LowPart+cb; oldsize = This->stde.pps_size; if (newsize < oldsize) { if (oldsize < 0x1000) { @@ -1033,7 +1033,7 @@ /* finally the write pass */ if (This->stde.pps_size < 0x1000) { - blocknr = STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,This->offset.LowPart/SMALLSIZE); + blocknr = STORAGE_get_nth_next_small_blocknr(hf,This->stde.pps_sb,This->offset.s.LowPart/SMALLSIZE); assert(blocknr>=0); while (cb>0) { /* we ensured that it is allocated above */ @@ -1044,10 +1044,10 @@ if (!STORAGE_get_small_block(hf,blocknr,block)) return E_FAIL; - cc = SMALLSIZE-(This->offset.LowPart&(SMALLSIZE-1)); + cc = SMALLSIZE-(This->offset.s.LowPart&(SMALLSIZE-1)); if (cc>cb) cc=cb; - memcpy( ((LPBYTE)block)+(This->offset.LowPart&(SMALLSIZE-1)), + memcpy( ((LPBYTE)block)+(This->offset.s.LowPart&(SMALLSIZE-1)), (LPBYTE)((char *) pv+curoffset), cc ); @@ -1056,12 +1056,12 @@ cb -= cc; curoffset += cc; (LPBYTE)pv += cc; - This->offset.LowPart += cc; + This->offset.s.LowPart += cc; *byteswritten += cc; blocknr = STORAGE_get_next_small_blocknr(hf,blocknr); } } else { - blocknr = STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,This->offset.LowPart/BIGSIZE); + blocknr = STORAGE_get_nth_next_big_blocknr(hf,This->stde.pps_sb,This->offset.s.LowPart/BIGSIZE); assert(blocknr>=0); while (cb>0) { /* we ensured that it is allocated above, so it better is */ @@ -1072,10 +1072,10 @@ if (!STORAGE_get_big_block(hf,blocknr,block)) return E_FAIL; - cc = BIGSIZE-(This->offset.LowPart&(BIGSIZE-1)); + cc = BIGSIZE-(This->offset.s.LowPart&(BIGSIZE-1)); if (cc>cb) cc=cb; - memcpy( ((LPBYTE)block)+(This->offset.LowPart&(BIGSIZE-1)), + memcpy( ((LPBYTE)block)+(This->offset.s.LowPart&(BIGSIZE-1)), (LPBYTE)((char *) pv+curoffset), cc ); @@ -1084,7 +1084,7 @@ cb -= cc; curoffset += cc; (LPBYTE)pv += cc; - This->offset.LowPart += cc; + This->offset.s.LowPart += cc; *byteswritten += cc; blocknr = STORAGE_get_next_big_blocknr(hf,blocknr); } @@ -1272,7 +1272,7 @@ ); pstatstg->pwcsName=(LPOLESTR16)SEGPTR_GET(SEGPTR_STRDUP_WtoA(This->stde.pps_rawname)); pstatstg->type = This->stde.pps_type; - pstatstg->cbSize.LowPart = This->stde.pps_size; + pstatstg->cbSize.s.LowPart = This->stde.pps_size; pstatstg->mtime = This->stde.pps_ft1; /* FIXME */ /* why? */ pstatstg->atime = This->stde.pps_ft2; /* FIXME */ pstatstg->ctime = This->stde.pps_ft2; /* FIXME */ @@ -1395,8 +1395,8 @@ lpstr = (IStream16Impl*)PTR_SEG_TO_LIN(*ppstm); DuplicateHandle( GetCurrentProcess(), This->hf, GetCurrentProcess(), &lpstr->hf, 0, TRUE, DUPLICATE_SAME_ACCESS ); - lpstr->offset.LowPart = 0; - lpstr->offset.HighPart = 0; + lpstr->offset.s.LowPart = 0; + lpstr->offset.s.HighPart = 0; ppsent=STORAGE_get_free_pps_entry(lpstr->hf); if (ppsent<0) @@ -1494,8 +1494,8 @@ IStream16_fnRelease((IStream16*)lpstr); return E_FAIL; } - lpstr->offset.LowPart = 0; - lpstr->offset.HighPart = 0; + lpstr->offset.s.LowPart = 0; + lpstr->offset.s.HighPart = 0; lpstr->ppsent = newpps; return S_OK; }
diff --git a/ole/storage32.c b/ole/storage32.c index ca2bbb7..18996a2 100644 --- a/ole/storage32.c +++ b/ole/storage32.c
@@ -630,8 +630,8 @@ renamedProperty.propertyType = currentProperty.propertyType; renamedProperty.startingBlock = currentProperty.startingBlock; - renamedProperty.size.LowPart = currentProperty.size.LowPart; - renamedProperty.size.HighPart = currentProperty.size.HighPart; + renamedProperty.size.s.LowPart = currentProperty.size.s.LowPart; + renamedProperty.size.s.HighPart = currentProperty.size.s.HighPart; renamedProperty.previousProperty = PROPERTY_NULL; renamedProperty.nextProperty = PROPERTY_NULL; @@ -800,8 +800,8 @@ newStreamProperty.propertyType = PROPTYPE_STREAM; newStreamProperty.startingBlock = BLOCK_END_OF_CHAIN; - newStreamProperty.size.LowPart = 0; - newStreamProperty.size.HighPart = 0; + newStreamProperty.size.s.LowPart = 0; + newStreamProperty.size.s.HighPart = 0; newStreamProperty.previousProperty = PROPERTY_NULL; newStreamProperty.nextProperty = PROPERTY_NULL; @@ -985,8 +985,8 @@ newProperty.propertyType = PROPTYPE_STORAGE; newProperty.startingBlock = BLOCK_END_OF_CHAIN; - newProperty.size.LowPart = 0; - newProperty.size.HighPart = 0; + newProperty.size.s.LowPart = 0; + newProperty.size.s.HighPart = 0; newProperty.previousProperty = PROPERTY_NULL; newProperty.nextProperty = PROPERTY_NULL; @@ -1107,8 +1107,8 @@ /* * initialize the size used by the property stream */ - newSize.HighPart = 0; - newSize.LowPart = storage->bigBlockSize * blockCount; + newSize.s.HighPart = 0; + newSize.s.LowPart = storage->bigBlockSize * blockCount; /* * add a property block to the property chain @@ -1699,8 +1699,8 @@ HRESULT hr; ULARGE_INTEGER size; - size.HighPart = 0; - size.LowPart = 0; + size.s.HighPart = 0; + size.s.LowPart = 0; hr = StorageBaseImpl_OpenStream( (IStorage*)parentStorage, @@ -2094,8 +2094,8 @@ /* * Add one block for the big block depot and one block for the properties */ - size.HighPart = 0; - size.LowPart = This->bigBlockSize * 3; + size.s.HighPart = 0; + size.s.LowPart = This->bigBlockSize * 3; BIGBLOCKFILE_SetSize(This->bigBlockFile, size); /* @@ -2161,8 +2161,8 @@ rootProp.nextProperty = PROPERTY_NULL; rootProp.dirProperty = PROPERTY_NULL; rootProp.startingBlock = BLOCK_END_OF_CHAIN; - rootProp.size.HighPart = 0; - rootProp.size.LowPart = 0; + rootProp.size.s.HighPart = 0; + rootProp.size.s.LowPart = 0; StorageImpl_WriteProperty(This, 0, &rootProp); } @@ -2924,8 +2924,8 @@ BOOL readSucessful; ULONG bytesRead; - offsetInPropSet.HighPart = 0; - offsetInPropSet.LowPart = index * PROPSET_BLOCK_SIZE; + offsetInPropSet.s.HighPart = 0; + offsetInPropSet.s.LowPart = index * PROPSET_BLOCK_SIZE; readSucessful = BlockChainStream_ReadAt( This->rootBlockChain, @@ -2997,9 +2997,9 @@ StorageUtl_ReadDWord( currentProperty, OFFSET_PS_SIZE, - &buffer->size.LowPart); + &buffer->size.s.LowPart); - buffer->size.HighPart = 0; + buffer->size.s.HighPart = 0; } return readSucessful; @@ -3018,8 +3018,8 @@ BOOL writeSucessful; ULONG bytesWritten; - offsetInPropSet.HighPart = 0; - offsetInPropSet.LowPart = index * PROPSET_BLOCK_SIZE; + offsetInPropSet.s.HighPart = 0; + offsetInPropSet.s.LowPart = index * PROPSET_BLOCK_SIZE; memset(currentProperty, 0, PROPSET_BLOCK_SIZE); @@ -3088,7 +3088,7 @@ StorageUtl_WriteDWord( currentProperty, OFFSET_PS_SIZE, - buffer->size.LowPart); + buffer->size.s.LowPart); writeSucessful = BlockChainStream_WriteAt(This->rootBlockChain, offsetInPropSet, @@ -3200,8 +3200,8 @@ * Copy the contents of the small block chain to the big block chain * by small block size increments. */ - offset.LowPart = 0; - offset.HighPart = 0; + offset.s.LowPart = 0; + offset.s.HighPart = 0; cbTotalRead = 0; cbTotalWritten = 0; @@ -3222,7 +3222,7 @@ &cbWritten); cbTotalWritten += cbWritten; - offset.LowPart += This->smallBlockSize; + offset.s.LowPart += This->smallBlockSize; } while (successRead && successWrite); free(buffer); @@ -3233,8 +3233,8 @@ * Destroy the small block chain. */ propertyIndex = (*ppsbChain)->ownerPropertyIndex; - size.HighPart = 0; - size.LowPart = 0; + size.s.HighPart = 0; + size.s.LowPart = 0; SmallBlockChainStream_SetSize(*ppsbChain, size); SmallBlockChainStream_Destroy(*ppsbChain); *ppsbChain = 0; @@ -4054,8 +4054,8 @@ void* buffer, ULONG* bytesRead) { - ULONG blockNoInSequence = offset.LowPart / This->parentStorage->bigBlockSize; - ULONG offsetInBlock = offset.LowPart % This->parentStorage->bigBlockSize; + ULONG blockNoInSequence = offset.s.LowPart / This->parentStorage->bigBlockSize; + ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->bigBlockSize; ULONG bytesToReadInBuffer; ULONG blockIndex; BYTE* bufferWalker; @@ -4143,8 +4143,8 @@ const void* buffer, ULONG* bytesWritten) { - ULONG blockNoInSequence = offset.LowPart / This->parentStorage->bigBlockSize; - ULONG offsetInBlock = offset.LowPart % This->parentStorage->bigBlockSize; + ULONG blockNoInSequence = offset.s.LowPart / This->parentStorage->bigBlockSize; + ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->bigBlockSize; ULONG bytesToWrite; ULONG blockIndex; BYTE* bufferWalker; @@ -4239,9 +4239,9 @@ /* * Figure out how many blocks are needed to contain the new size */ - numBlocks = newSize.LowPart / This->parentStorage->bigBlockSize; + numBlocks = newSize.s.LowPart / This->parentStorage->bigBlockSize; - if ((newSize.LowPart % This->parentStorage->bigBlockSize) != 0) + if ((newSize.s.LowPart % This->parentStorage->bigBlockSize) != 0) numBlocks++; blockIndex = BlockChainStream_GetHeadOfChain(This); @@ -4338,9 +4338,9 @@ /* * Figure out how many blocks are needed to contain this stream */ - newNumBlocks = newSize.LowPart / This->parentStorage->bigBlockSize; + newNumBlocks = newSize.s.LowPart / This->parentStorage->bigBlockSize; - if ((newSize.LowPart % This->parentStorage->bigBlockSize) != 0) + if ((newSize.s.LowPart % This->parentStorage->bigBlockSize) != 0) newNumBlocks++; /* @@ -4411,10 +4411,10 @@ { ULARGE_INTEGER size = BlockChainStream_GetSize(This); - if (newSize.LowPart == size.LowPart) + if (newSize.s.LowPart == size.s.LowPart) return TRUE; - if (newSize.LowPart < size.LowPart) + if (newSize.s.LowPart < size.s.LowPart) { BlockChainStream_Shrink(This, newSize); } @@ -4423,7 +4423,7 @@ ULARGE_INTEGER fileSize = BIGBLOCKFILE_GetSize(This->parentStorage->bigBlockFile); - ULONG diff = newSize.LowPart - size.LowPart; + ULONG diff = newSize.s.LowPart - size.s.LowPart; /* * Make sure the file stays a multiple of blocksize @@ -4432,7 +4432,7 @@ diff += (This->parentStorage->bigBlockSize - (diff % This->parentStorage->bigBlockSize) ); - fileSize.LowPart += diff; + fileSize.s.LowPart += diff; BIGBLOCKFILE_SetSize(This->parentStorage->bigBlockFile, fileSize); BlockChainStream_Enlarge(This, newSize); @@ -4472,9 +4472,9 @@ * size of them */ ULARGE_INTEGER result; - result.HighPart = 0; + result.s.HighPart = 0; - result.LowPart = + result.s.LowPart = BlockChainStream_GetCount(This) * This->parentStorage->bigBlockSize; @@ -4553,8 +4553,8 @@ ULONG bytesRead; BOOL success; - offsetOfBlockInDepot.HighPart = 0; - offsetOfBlockInDepot.LowPart = blockIndex * sizeof(ULONG); + offsetOfBlockInDepot.s.HighPart = 0; + offsetOfBlockInDepot.s.LowPart = blockIndex * sizeof(ULONG); /* * Read those bytes in the buffer from the small block file. @@ -4591,8 +4591,8 @@ DWORD buffer; ULONG bytesWritten; - offsetOfBlockInDepot.HighPart = 0; - offsetOfBlockInDepot.LowPart = blockIndex * sizeof(ULONG); + offsetOfBlockInDepot.s.HighPart = 0; + offsetOfBlockInDepot.s.LowPart = blockIndex * sizeof(ULONG); StorageUtl_WriteDWord(&buffer, 0, nextBlock); @@ -4637,14 +4637,14 @@ BOOL success = TRUE; ULONG smallBlocksPerBigBlock; - offsetOfBlockInDepot.HighPart = 0; + offsetOfBlockInDepot.s.HighPart = 0; /* * Scan the small block depot for a free block */ while (nextBlockIndex != BLOCK_UNUSED) { - offsetOfBlockInDepot.LowPart = blockIndex * sizeof(ULONG); + offsetOfBlockInDepot.s.LowPart = blockIndex * sizeof(ULONG); success = BlockChainStream_ReadAt( This->parentStorage->smallBlockDepotChain, @@ -4732,8 +4732,8 @@ &rootProp); rootProp.startingBlock = sbStartIndex; - rootProp.size.HighPart = 0; - rootProp.size.LowPart = This->parentStorage->bigBlockSize; + rootProp.size.s.HighPart = 0; + rootProp.size.s.LowPart = This->parentStorage->bigBlockSize; StorageImpl_WriteProperty( This->parentStorage, @@ -4759,10 +4759,10 @@ This->parentStorage->rootPropertySetIndex, &rootProp); - if (rootProp.size.LowPart < + if (rootProp.size.s.LowPart < (blocksRequired * This->parentStorage->bigBlockSize)) { - rootProp.size.LowPart += This->parentStorage->bigBlockSize; + rootProp.size.s.LowPart += This->parentStorage->bigBlockSize; BlockChainStream_SetSize( This->parentStorage->smallBlockRootChain, @@ -4794,9 +4794,9 @@ { ULARGE_INTEGER offsetInBigBlockFile; ULONG blockNoInSequence = - offset.LowPart / This->parentStorage->smallBlockSize; + offset.s.LowPart / This->parentStorage->smallBlockSize; - ULONG offsetInBlock = offset.LowPart % This->parentStorage->smallBlockSize; + ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->smallBlockSize; ULONG bytesToReadInBuffer; ULONG blockIndex; ULONG bytesReadFromBigBlockFile; @@ -4805,7 +4805,7 @@ /* * This should never happen on a small block file. */ - assert(offset.HighPart==0); + assert(offset.s.HighPart==0); /* * Find the first block in the stream that contains part of the buffer. @@ -4836,11 +4836,11 @@ /* * Calculate the offset of the small block in the small block file. */ - offsetInBigBlockFile.HighPart = 0; - offsetInBigBlockFile.LowPart = + offsetInBigBlockFile.s.HighPart = 0; + offsetInBigBlockFile.s.LowPart = blockIndex * This->parentStorage->smallBlockSize; - offsetInBigBlockFile.LowPart += offsetInBlock; + offsetInBigBlockFile.s.LowPart += offsetInBlock; /* * Read those bytes in the buffer from the small block file. @@ -4882,9 +4882,9 @@ { ULARGE_INTEGER offsetInBigBlockFile; ULONG blockNoInSequence = - offset.LowPart / This->parentStorage->smallBlockSize; + offset.s.LowPart / This->parentStorage->smallBlockSize; - ULONG offsetInBlock = offset.LowPart % This->parentStorage->smallBlockSize; + ULONG offsetInBlock = offset.s.LowPart % This->parentStorage->smallBlockSize; ULONG bytesToWriteInBuffer; ULONG blockIndex; ULONG bytesWrittenFromBigBlockFile; @@ -4893,7 +4893,7 @@ /* * This should never happen on a small block file. */ - assert(offset.HighPart==0); + assert(offset.s.HighPart==0); /* * Find the first block in the stream that contains part of the buffer. @@ -4926,11 +4926,11 @@ /* * Calculate the offset of the small block in the small block file. */ - offsetInBigBlockFile.HighPart = 0; - offsetInBigBlockFile.LowPart = + offsetInBigBlockFile.s.HighPart = 0; + offsetInBigBlockFile.s.LowPart = blockIndex * This->parentStorage->smallBlockSize; - offsetInBigBlockFile.LowPart += offsetInBlock; + offsetInBigBlockFile.s.LowPart += offsetInBlock; /* * Write those bytes in the buffer to the small block file. @@ -4969,9 +4969,9 @@ ULONG numBlocks; ULONG count = 0; - numBlocks = newSize.LowPart / This->parentStorage->smallBlockSize; + numBlocks = newSize.s.LowPart / This->parentStorage->smallBlockSize; - if ((newSize.LowPart % This->parentStorage->smallBlockSize) != 0) + if ((newSize.s.LowPart % This->parentStorage->smallBlockSize) != 0) numBlocks++; blockIndex = SmallBlockChainStream_GetHeadOfChain(This); @@ -5076,9 +5076,9 @@ /* * Figure out how many blocks are needed to contain this stream */ - newNumBlocks = newSize.LowPart / This->parentStorage->smallBlockSize; + newNumBlocks = newSize.s.LowPart / This->parentStorage->smallBlockSize; - if ((newSize.LowPart % This->parentStorage->smallBlockSize) != 0) + if ((newSize.s.LowPart % This->parentStorage->smallBlockSize) != 0) newNumBlocks++; /* @@ -5150,10 +5150,10 @@ { ULARGE_INTEGER size = SmallBlockChainStream_GetSize(This); - if (newSize.LowPart == size.LowPart) + if (newSize.s.LowPart == size.s.LowPart) return TRUE; - if (newSize.LowPart < size.LowPart) + if (newSize.s.LowPart < size.s.LowPart) { SmallBlockChainStream_Shrink(This, newSize); } @@ -5514,8 +5514,8 @@ BYTE sig[8]; ULARGE_INTEGER offset; - offset.HighPart = 0; - offset.LowPart = 0; + offset.s.HighPart = 0; + offset.s.LowPart = 0; ILockBytes_ReadAt(plkbyt, offset, sig, sizeof(sig), NULL);
diff --git a/ole/variant.c b/ole/variant.c index b9233a9..b3a81d89 100644 --- a/ole/variant.c +++ b/ole/variant.c
@@ -2206,7 +2206,7 @@ * Convert currency to unsigned char */ HRESULT WINAPI VarUI1FromCy(CY cyIn, BYTE* pbOut) { - double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (t > UI1_MAX || t < UI1_MIN) return DISP_E_OVERFLOW; @@ -2412,7 +2412,7 @@ * Convert currency to signed short */ HRESULT WINAPI VarI2FromCy(CY cyIn, short* psOut) { - double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (t > I2_MAX || t < I2_MIN) return DISP_E_OVERFLOW; @@ -2605,7 +2605,7 @@ * Convert currency to signed long */ HRESULT WINAPI VarI4FromCy(CY cyIn, LONG* plOut) { - double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (t > I4_MAX || t < I4_MIN) return DISP_E_OVERFLOW; @@ -2779,7 +2779,7 @@ * Convert currency to float */ HRESULT WINAPI VarR4FromCy(CY cyIn, FLOAT* pfltOut) { - *pfltOut = (FLOAT)((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + *pfltOut = (FLOAT)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); return S_OK; } @@ -2929,7 +2929,7 @@ * Convert currency to double */ HRESULT WINAPI VarR8FromCy(CY cyIn, double* pdblOut) { - *pdblOut = (double)((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + *pdblOut = (double)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); return S_OK; } @@ -3120,7 +3120,7 @@ * Convert currency to date */ HRESULT WINAPI VarDateFromCy(CY cyIn, DATE* pdateOut) { - *pdateOut = (DATE)((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + *pdateOut = (DATE)((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (*pdateOut > DATE_MAX || *pdateOut < DATE_MIN) return DISP_E_TYPEMISMATCH; return S_OK; @@ -3537,7 +3537,7 @@ * Convert currency to boolean */ HRESULT WINAPI VarBoolFromCy(CY cyIn, VARIANT_BOOL* pboolOut) { - if (cyIn.u.Hi || cyIn.u.Lo) *pboolOut = -1; + if (cyIn.s.Hi || cyIn.s.Lo) *pboolOut = -1; else *pboolOut = 0; return S_OK; @@ -3741,7 +3741,7 @@ * Convert currency to signed char */ HRESULT WINAPI VarI1FromCy(CY cyIn, CHAR* pcOut) { - double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (t > CHAR_MAX || t < CHAR_MIN) return DISP_E_OVERFLOW; @@ -3975,7 +3975,7 @@ * Convert currency to unsigned short */ HRESULT WINAPI VarUI2FromCy(CY cyIn, USHORT* pusOut) { - double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (t > UI2_MAX || t < UI2_MIN) return DISP_E_OVERFLOW; @@ -4123,7 +4123,7 @@ * Convert currency to unsigned long */ HRESULT WINAPI VarUI4FromCy(CY cyIn, ULONG* pulOut) { - double t = round((((double)cyIn.u.Hi * 4294967296.0) + (double)cyIn.u.Lo) / 10000); + double t = round((((double)cyIn.s.Hi * 4294967296.0) + (double)cyIn.s.Lo) / 10000); if (t > UI4_MAX || t < UI4_MIN) return DISP_E_OVERFLOW; @@ -4137,8 +4137,8 @@ * Convert unsigned char to currency */ HRESULT WINAPI VarCyFromUI1(BYTE bIn, CY* pcyOut) { - pcyOut->u.Hi = 0; - pcyOut->u.Lo = ((ULONG)bIn) * 10000; + pcyOut->s.Hi = 0; + pcyOut->s.Lo = ((ULONG)bIn) * 10000; return S_OK; } @@ -4148,9 +4148,9 @@ * Convert signed short to currency */ HRESULT WINAPI VarCyFromI2(short sIn, CY* pcyOut) { - if (sIn < 0) pcyOut->u.Hi = -1; - else pcyOut->u.Hi = 0; - pcyOut->u.Lo = ((ULONG)sIn) * 10000; + if (sIn < 0) pcyOut->s.Hi = -1; + else pcyOut->s.Hi = 0; + pcyOut->s.Lo = ((ULONG)sIn) * 10000; return S_OK; } @@ -4161,9 +4161,9 @@ */ HRESULT WINAPI VarCyFromI4(LONG lIn, CY* pcyOut) { double t = (double)lIn * (double)10000; - pcyOut->u.Hi = (LONG)(t / (double)4294967296.0); - pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0); - if (lIn < 0) pcyOut->u.Hi--; + pcyOut->s.Hi = (LONG)(t / (double)4294967296.0); + pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0); + if (lIn < 0) pcyOut->s.Hi--; return S_OK; } @@ -4174,9 +4174,9 @@ */ HRESULT WINAPI VarCyFromR4(FLOAT fltIn, CY* pcyOut) { double t = round((double)fltIn * (double)10000); - pcyOut->u.Hi = (LONG)(t / (double)4294967296.0); - pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0); - if (fltIn < 0) pcyOut->u.Hi--; + pcyOut->s.Hi = (LONG)(t / (double)4294967296.0); + pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0); + if (fltIn < 0) pcyOut->s.Hi--; return S_OK; } @@ -4187,9 +4187,9 @@ */ HRESULT WINAPI VarCyFromR8(double dblIn, CY* pcyOut) { double t = round(dblIn * (double)10000); - pcyOut->u.Hi = (LONG)(t / (double)4294967296.0); - pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0); - if (dblIn < 0) pcyOut->u.Hi--; + pcyOut->s.Hi = (LONG)(t / (double)4294967296.0); + pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0); + if (dblIn < 0) pcyOut->s.Hi--; return S_OK; } @@ -4200,9 +4200,9 @@ */ HRESULT WINAPI VarCyFromDate(DATE dateIn, CY* pcyOut) { double t = round((double)dateIn * (double)10000); - pcyOut->u.Hi = (LONG)(t / (double)4294967296.0); - pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0); - if (dateIn < 0) pcyOut->u.Hi--; + pcyOut->s.Hi = (LONG)(t / (double)4294967296.0); + pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0); + if (dateIn < 0) pcyOut->s.Hi--; return S_OK; } @@ -4221,9 +4221,9 @@ * Convert boolean to currency */ HRESULT WINAPI VarCyFromBool(VARIANT_BOOL boolIn, CY* pcyOut) { - if (boolIn < 0) pcyOut->u.Hi = -1; - else pcyOut->u.Hi = 0; - pcyOut->u.Lo = (ULONG)boolIn * (ULONG)10000; + if (boolIn < 0) pcyOut->s.Hi = -1; + else pcyOut->s.Hi = 0; + pcyOut->s.Lo = (ULONG)boolIn * (ULONG)10000; return S_OK; } @@ -4233,9 +4233,9 @@ * Convert signed char to currency */ HRESULT WINAPI VarCyFromI1(CHAR cIn, CY* pcyOut) { - if (cIn < 0) pcyOut->u.Hi = -1; - else pcyOut->u.Hi = 0; - pcyOut->u.Lo = (ULONG)cIn * (ULONG)10000; + if (cIn < 0) pcyOut->s.Hi = -1; + else pcyOut->s.Hi = 0; + pcyOut->s.Lo = (ULONG)cIn * (ULONG)10000; return S_OK; } @@ -4245,8 +4245,8 @@ * Convert unsigned short to currency */ HRESULT WINAPI VarCyFromUI2(USHORT usIn, CY* pcyOut) { - pcyOut->u.Hi = 0; - pcyOut->u.Lo = (ULONG)usIn * (ULONG)10000; + pcyOut->s.Hi = 0; + pcyOut->s.Lo = (ULONG)usIn * (ULONG)10000; return S_OK; } @@ -4257,8 +4257,8 @@ */ HRESULT WINAPI VarCyFromUI4(ULONG ulIn, CY* pcyOut) { double t = (double)ulIn * (double)10000; - pcyOut->u.Hi = (LONG)(t / (double)4294967296.0); - pcyOut->u.Lo = (ULONG)fmod(t, (double)4294967296.0); + pcyOut->s.Hi = (LONG)(t / (double)4294967296.0); + pcyOut->s.Lo = (ULONG)fmod(t, (double)4294967296.0); return S_OK; }