Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
41193de1
Commit
41193de1
authored
Nov 18, 2010
by
David Hedberg
Committed by
Alexandre Julliard
Nov 23, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Avoid unneccessary stream conversion.
Truncating a large stream to less than 0x1000 bytes would cause an unnecessarily expensive conversion.
parent
8b913427
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
7 deletions
+10
-7
storage32.c
dlls/ole32/storage32.c
+8
-6
storage32.h
dlls/ole32/storage32.h
+2
-1
No files found.
dlls/ole32/storage32.c
View file @
41193de1
...
@@ -2489,7 +2489,7 @@ static HRESULT StorageImpl_StreamSetSize(StorageBaseImpl *base, DirRef index,
...
@@ -2489,7 +2489,7 @@ static HRESULT StorageImpl_StreamSetSize(StorageBaseImpl *base, DirRef index,
}
}
else
if
(
bigblock
&&
newsize
.
QuadPart
<
LIMIT_TO_USE_SMALL_BLOCK
)
else
if
(
bigblock
&&
newsize
.
QuadPart
<
LIMIT_TO_USE_SMALL_BLOCK
)
{
{
smallblock
=
Storage32Impl_BigBlocksToSmallBlocks
(
This
,
pbigblock
);
smallblock
=
Storage32Impl_BigBlocksToSmallBlocks
(
This
,
pbigblock
,
newsize
);
if
(
!
smallblock
)
if
(
!
smallblock
)
return
E_FAIL
;
return
E_FAIL
;
}
}
...
@@ -4132,12 +4132,13 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
...
@@ -4132,12 +4132,13 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
*/
*/
SmallBlockChainStream
*
Storage32Impl_BigBlocksToSmallBlocks
(
SmallBlockChainStream
*
Storage32Impl_BigBlocksToSmallBlocks
(
StorageImpl
*
This
,
StorageImpl
*
This
,
BlockChainStream
**
ppbbChain
)
BlockChainStream
**
ppbbChain
,
ULARGE_INTEGER
newSize
)
{
{
ULARGE_INTEGER
size
,
offset
,
cbTotalRead
;
ULARGE_INTEGER
size
,
offset
,
cbTotalRead
;
ULONG
cbRead
,
cbWritten
,
sbHeadOfChain
=
BLOCK_END_OF_CHAIN
;
ULONG
cbRead
,
cbWritten
,
sbHeadOfChain
=
BLOCK_END_OF_CHAIN
;
DirRef
streamEntryRef
;
DirRef
streamEntryRef
;
HRESULT
resWrite
=
S_OK
,
resRead
;
HRESULT
resWrite
=
S_OK
,
resRead
=
S_OK
;
DirEntry
streamEntry
;
DirEntry
streamEntry
;
BYTE
*
buffer
;
BYTE
*
buffer
;
SmallBlockChainStream
*
sbTempChain
;
SmallBlockChainStream
*
sbTempChain
;
...
@@ -4150,14 +4151,15 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
...
@@ -4150,14 +4151,15 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
if
(
!
sbTempChain
)
if
(
!
sbTempChain
)
return
NULL
;
return
NULL
;
SmallBlockChainStream_SetSize
(
sbTempChain
,
newSize
);
size
=
BlockChainStream_GetSize
(
*
ppbbChain
);
size
=
BlockChainStream_GetSize
(
*
ppbbChain
);
SmallBlockChainStream_SetSize
(
sbTempChain
,
size
);
size
.
QuadPart
=
min
(
size
.
QuadPart
,
newSize
.
QuadPart
);
offset
.
u
.
HighPart
=
0
;
offset
.
u
.
HighPart
=
0
;
offset
.
u
.
LowPart
=
0
;
offset
.
u
.
LowPart
=
0
;
cbTotalRead
.
QuadPart
=
0
;
cbTotalRead
.
QuadPart
=
0
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
bigBlockSize
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
This
->
bigBlockSize
);
do
while
(
cbTotalRead
.
QuadPart
<
size
.
QuadPart
)
{
{
resRead
=
BlockChainStream_ReadAt
(
*
ppbbChain
,
offset
,
resRead
=
BlockChainStream_ReadAt
(
*
ppbbChain
,
offset
,
min
(
This
->
bigBlockSize
,
size
.
u
.
LowPart
-
offset
.
u
.
LowPart
),
min
(
This
->
bigBlockSize
,
size
.
u
.
LowPart
-
offset
.
u
.
LowPart
),
...
@@ -4183,7 +4185,7 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
...
@@ -4183,7 +4185,7 @@ SmallBlockChainStream* Storage32Impl_BigBlocksToSmallBlocks(
resRead
=
STG_E_READFAULT
;
resRead
=
STG_E_READFAULT
;
break
;
break
;
}
}
}
while
(
cbTotalRead
.
QuadPart
<
size
.
QuadPart
);
}
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
HeapFree
(
GetProcessHeap
(),
0
,
buffer
);
size
.
u
.
HighPart
=
0
;
size
.
u
.
HighPart
=
0
;
...
...
dlls/ole32/storage32.h
View file @
41193de1
...
@@ -412,7 +412,8 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
...
@@ -412,7 +412,8 @@ BlockChainStream* Storage32Impl_SmallBlocksToBigBlocks(
SmallBlockChainStream
*
Storage32Impl_BigBlocksToSmallBlocks
(
SmallBlockChainStream
*
Storage32Impl_BigBlocksToSmallBlocks
(
StorageImpl
*
This
,
StorageImpl
*
This
,
BlockChainStream
**
ppbbChain
);
BlockChainStream
**
ppbbChain
,
ULARGE_INTEGER
newSize
);
/****************************************************************************
/****************************************************************************
* StgStreamImpl definitions.
* StgStreamImpl definitions.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment