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
b99dfb0c
Commit
b99dfb0c
authored
Apr 24, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Apr 24, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define and use endian conversion macros for big-endian machines.
parent
576aa4a6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
8 deletions
+35
-8
storage32.c
dlls/ole32/storage32.c
+10
-4
storage32.h
dlls/ole32/storage32.h
+25
-4
No files found.
dlls/ole32/storage32.c
View file @
b99dfb0c
...
...
@@ -4051,27 +4051,33 @@ StorageInternalImpl* StorageInternalImpl_Construct(
/******************************************************************************
** 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
(
const
BYTE
*
buffer
,
ULONG
offset
,
WORD
*
value
)
{
memcpy
(
value
,
buffer
+
offset
,
sizeof
(
WORD
));
WORD
tmp
;
memcpy
(
&
tmp
,
buffer
+
offset
,
sizeof
(
WORD
));
*
value
=
le16toh
(
tmp
);
}
void
StorageUtl_WriteWord
(
BYTE
*
buffer
,
ULONG
offset
,
WORD
value
)
{
value
=
htole16
(
value
);
memcpy
(
buffer
+
offset
,
&
value
,
sizeof
(
WORD
));
}
void
StorageUtl_ReadDWord
(
const
BYTE
*
buffer
,
ULONG
offset
,
DWORD
*
value
)
{
memcpy
(
value
,
buffer
+
offset
,
sizeof
(
DWORD
));
DWORD
tmp
;
memcpy
(
&
tmp
,
buffer
+
offset
,
sizeof
(
DWORD
));
*
value
=
le32toh
(
tmp
);
}
void
StorageUtl_WriteDWord
(
BYTE
*
buffer
,
ULONG
offset
,
DWORD
value
)
{
value
=
htole32
(
value
);
memcpy
(
buffer
+
offset
,
&
value
,
sizeof
(
DWORD
));
}
...
...
dlls/ole32/storage32.h
View file @
b99dfb0c
...
...
@@ -35,6 +35,8 @@
#include "winbase.h"
#include "winnt.h"
#include "objbase.h"
#include "winreg.h"
#include "winternl.h"
/*
* Definitions for the file format offsets.
...
...
@@ -524,10 +526,29 @@ StgStreamImpl* StgStreamImpl_Construct(
ULONG
ownerProperty
);
/********************************************************************************
* The StorageUtl_ functions are miscelaneous utility functions. Most of which are
* abstractions used to read values from file buffers without having to worry
* about bit order
/******************************************************************************
* Endian conversion macros
*/
#ifdef WORDS_BIGENDIAN
#define htole32(x) RtlUlongByteSwap(x)
#define htole16(x) RtlUshortByteSwap(x)
#define le32toh(x) RtlUlongByteSwap(x)
#define le16toh(x) RtlUshortByteSwap(x)
#else
#define htole32(x) (x)
#define htole16(x) (x)
#define le32toh(x) (x)
#define le16toh(x) (x)
#endif
/******************************************************************************
* The StorageUtl_ functions are miscellaneous utility functions. Most of which
* are abstractions used to read values from file buffers without having to
* worry about bit order
*/
void
StorageUtl_ReadWord
(
const
BYTE
*
buffer
,
ULONG
offset
,
WORD
*
value
);
void
StorageUtl_WriteWord
(
BYTE
*
buffer
,
ULONG
offset
,
WORD
value
);
...
...
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