Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ac24801d
Commit
ac24801d
authored
Mar 17, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Mar 17, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a comment about byte order, change types to reduce casting and not
cast away constness.
parent
3475dcdb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
21 deletions
+23
-21
storage32.c
dlls/ole32/storage32.c
+17
-15
storage32.h
dlls/ole32/storage32.h
+6
-6
No files found.
dlls/ole32/storage32.c
View file @
ac24801d
...
@@ -4064,44 +4064,46 @@ ULONG IEnumSTATSTGImpl_PopSearchNode(
...
@@ -4064,44 +4064,46 @@ ULONG IEnumSTATSTGImpl_PopSearchNode(
/******************************************************************************
/******************************************************************************
** StorageUtl implementation
** StorageUtl implementation
* FIXME: these should read and write in little-endian order on all
* architectures, but right now just assume the host is little-endian.
*/
*/
void
StorageUtl_ReadWord
(
void
*
buffer
,
ULONG
offset
,
WORD
*
value
)
void
StorageUtl_ReadWord
(
const
BYTE
*
buffer
,
ULONG
offset
,
WORD
*
value
)
{
{
memcpy
(
value
,
(
BYTE
*
)
buffer
+
offset
,
sizeof
(
WORD
));
memcpy
(
value
,
buffer
+
offset
,
sizeof
(
WORD
));
}
}
void
StorageUtl_WriteWord
(
void
*
buffer
,
ULONG
offset
,
WORD
value
)
void
StorageUtl_WriteWord
(
BYTE
*
buffer
,
ULONG
offset
,
WORD
value
)
{
{
memcpy
(
(
BYTE
*
)
buffer
+
offset
,
&
value
,
sizeof
(
WORD
));
memcpy
(
buffer
+
offset
,
&
value
,
sizeof
(
WORD
));
}
}
void
StorageUtl_ReadDWord
(
void
*
buffer
,
ULONG
offset
,
DWORD
*
value
)
void
StorageUtl_ReadDWord
(
const
BYTE
*
buffer
,
ULONG
offset
,
DWORD
*
value
)
{
{
memcpy
(
value
,
(
BYTE
*
)
buffer
+
offset
,
sizeof
(
DWORD
));
memcpy
(
value
,
buffer
+
offset
,
sizeof
(
DWORD
));
}
}
void
StorageUtl_WriteDWord
(
void
*
buffer
,
ULONG
offset
,
DWORD
value
)
void
StorageUtl_WriteDWord
(
BYTE
*
buffer
,
ULONG
offset
,
DWORD
value
)
{
{
memcpy
(
(
BYTE
*
)
buffer
+
offset
,
&
value
,
sizeof
(
DWORD
));
memcpy
(
buffer
+
offset
,
&
value
,
sizeof
(
DWORD
));
}
}
void
StorageUtl_ReadGUID
(
void
*
buffer
,
ULONG
offset
,
GUID
*
value
)
void
StorageUtl_ReadGUID
(
const
BYTE
*
buffer
,
ULONG
offset
,
GUID
*
value
)
{
{
StorageUtl_ReadDWord
(
buffer
,
offset
,
&
(
value
->
Data1
));
StorageUtl_ReadDWord
(
buffer
,
offset
,
&
(
value
->
Data1
));
StorageUtl_ReadWord
(
buffer
,
offset
+
4
,
&
(
value
->
Data2
));
StorageUtl_ReadWord
(
buffer
,
offset
+
4
,
&
(
value
->
Data2
));
StorageUtl_ReadWord
(
buffer
,
offset
+
6
,
&
(
value
->
Data3
));
StorageUtl_ReadWord
(
buffer
,
offset
+
6
,
&
(
value
->
Data3
));
memcpy
(
value
->
Data4
,
(
BYTE
*
)
buffer
+
offset
+
8
,
sizeof
(
value
->
Data4
));
memcpy
(
value
->
Data4
,
buffer
+
offset
+
8
,
sizeof
(
value
->
Data4
));
}
}
void
StorageUtl_WriteGUID
(
void
*
buffer
,
ULONG
offset
,
GUID
*
value
)
void
StorageUtl_WriteGUID
(
BYTE
*
buffer
,
ULONG
offset
,
const
GUID
*
value
)
{
{
StorageUtl_WriteDWord
(
buffer
,
offset
,
value
->
Data1
);
StorageUtl_WriteDWord
(
buffer
,
offset
,
value
->
Data1
);
StorageUtl_WriteWord
(
buffer
,
offset
+
4
,
value
->
Data2
);
StorageUtl_WriteWord
(
buffer
,
offset
+
4
,
value
->
Data2
);
StorageUtl_WriteWord
(
buffer
,
offset
+
6
,
value
->
Data3
);
StorageUtl_WriteWord
(
buffer
,
offset
+
6
,
value
->
Data3
);
memcpy
(
(
BYTE
*
)
buffer
+
offset
+
8
,
value
->
Data4
,
sizeof
(
value
->
Data4
));
memcpy
(
buffer
+
offset
+
8
,
value
->
Data4
,
sizeof
(
value
->
Data4
));
}
}
void
StorageUtl_CopyPropertyToSTATSTG
(
void
StorageUtl_CopyPropertyToSTATSTG
(
...
@@ -4789,7 +4791,7 @@ HRESULT SmallBlockChainStream_GetNextBlockInChain(
...
@@ -4789,7 +4791,7 @@ HRESULT SmallBlockChainStream_GetNextBlockInChain(
if
(
success
)
if
(
success
)
{
{
StorageUtl_ReadDWord
(
&
buffer
,
0
,
nextBlockInChain
);
StorageUtl_ReadDWord
(
(
BYTE
*
)
&
buffer
,
0
,
nextBlockInChain
);
return
S_OK
;
return
S_OK
;
}
}
...
@@ -4816,7 +4818,7 @@ void SmallBlockChainStream_SetNextBlockInChain(
...
@@ -4816,7 +4818,7 @@ void SmallBlockChainStream_SetNextBlockInChain(
offsetOfBlockInDepot
.
u
.
HighPart
=
0
;
offsetOfBlockInDepot
.
u
.
HighPart
=
0
;
offsetOfBlockInDepot
.
u
.
LowPart
=
blockIndex
*
sizeof
(
ULONG
);
offsetOfBlockInDepot
.
u
.
LowPart
=
blockIndex
*
sizeof
(
ULONG
);
StorageUtl_WriteDWord
(
&
buffer
,
0
,
nextBlock
);
StorageUtl_WriteDWord
(
(
BYTE
*
)
&
buffer
,
0
,
nextBlock
);
/*
/*
* Read those bytes in the buffer from the small block file.
* Read those bytes in the buffer from the small block file.
...
@@ -4880,7 +4882,7 @@ ULONG SmallBlockChainStream_GetNextFreeBlock(
...
@@ -4880,7 +4882,7 @@ ULONG SmallBlockChainStream_GetNextFreeBlock(
*/
*/
if
(
success
)
if
(
success
)
{
{
StorageUtl_ReadDWord
(
&
buffer
,
0
,
&
nextBlockIndex
);
StorageUtl_ReadDWord
(
(
BYTE
*
)
&
buffer
,
0
,
&
nextBlockIndex
);
if
(
nextBlockIndex
!=
BLOCK_UNUSED
)
if
(
nextBlockIndex
!=
BLOCK_UNUSED
)
blockIndex
++
;
blockIndex
++
;
...
...
dlls/ole32/storage32.h
View file @
ac24801d
...
@@ -747,12 +747,12 @@ HRESULT WINAPI StgStreamImpl_Clone(
...
@@ -747,12 +747,12 @@ HRESULT WINAPI StgStreamImpl_Clone(
* abstractions used to read values from file buffers without having to worry
* abstractions used to read values from file buffers without having to worry
* about bit order
* about bit order
*/
*/
void
StorageUtl_ReadWord
(
void
*
buffer
,
ULONG
offset
,
WORD
*
value
);
void
StorageUtl_ReadWord
(
const
BYTE
*
buffer
,
ULONG
offset
,
WORD
*
value
);
void
StorageUtl_WriteWord
(
void
*
buffer
,
ULONG
offset
,
WORD
value
);
void
StorageUtl_WriteWord
(
BYTE
*
buffer
,
ULONG
offset
,
WORD
value
);
void
StorageUtl_ReadDWord
(
void
*
buffer
,
ULONG
offset
,
DWORD
*
value
);
void
StorageUtl_ReadDWord
(
const
BYTE
*
buffer
,
ULONG
offset
,
DWORD
*
value
);
void
StorageUtl_WriteDWord
(
void
*
buffer
,
ULONG
offset
,
DWORD
value
);
void
StorageUtl_WriteDWord
(
BYTE
*
buffer
,
ULONG
offset
,
DWORD
value
);
void
StorageUtl_ReadGUID
(
void
*
buffer
,
ULONG
offset
,
GUID
*
value
);
void
StorageUtl_ReadGUID
(
const
BYTE
*
buffer
,
ULONG
offset
,
GUID
*
value
);
void
StorageUtl_WriteGUID
(
void
*
buffer
,
ULONG
offset
,
GUID
*
value
);
void
StorageUtl_WriteGUID
(
BYTE
*
buffer
,
ULONG
offset
,
const
GUID
*
value
);
void
StorageUtl_CopyPropertyToSTATSTG
(
STATSTG
*
destination
,
void
StorageUtl_CopyPropertyToSTATSTG
(
STATSTG
*
destination
,
StgProperty
*
source
,
StgProperty
*
source
,
int
statFlags
);
int
statFlags
);
...
...
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