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
af046fe6
Commit
af046fe6
authored
Nov 11, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wmc: Windows file formats are always little-endian.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
923461f3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
71 deletions
+10
-71
mcl.c
tools/wmc/mcl.c
+1
-1
utils.c
tools/wmc/utils.c
+8
-13
utils.h
tools/wmc/utils.h
+0
-2
wmc.c
tools/wmc/wmc.c
+1
-39
wmc.h
tools/wmc/wmc.h
+0
-1
wmc.man.in
tools/wmc/wmc.man.in
+0
-3
wmctypes.h
tools/wmc/wmctypes.h
+0
-12
No files found.
tools/wmc/mcl.c
View file @
af046fe6
...
...
@@ -239,7 +239,7 @@ static int fill_inputbuffer(void)
case
INPUT_UNICODE
:
len
+=
fread
(
inputbuffer
+
len
,
sizeof
(
WCHAR
),
INPUTBUFFER_SIZE
-
len
,
yyin
);
if
(
!
len
)
break
;
if
(
swapped
)
for
(
i
=
0
;
i
<
len
;
i
++
)
inputbuffer
[
i
]
=
BYTESWAP_WORD
(
inputbuffer
[
i
]
);
if
(
swapped
)
for
(
i
=
0
;
i
<
len
;
i
++
)
inputbuffer
[
i
]
=
(
inputbuffer
[
i
]
<<
8
)
|
(
inputbuffer
[
i
]
>>
8
);
ninputbuffer
=
len
;
return
1
;
case
INPUT_UNKNOWN
:
...
...
tools/wmc/utils.c
View file @
af046fe6
...
...
@@ -439,7 +439,6 @@ WCHAR *codepage_to_unicode( int codepage, const char *src, int srclen, int *dstl
* Function for writing to a memory buffer.
*/
int
byte_swapped
=
0
;
unsigned
char
*
output_buffer
;
size_t
output_buffer_pos
;
size_t
output_buffer_size
;
...
...
@@ -470,13 +469,6 @@ void flush_output_buffer( const char *name )
free
(
output_buffer
);
}
void
put_data
(
const
void
*
data
,
size_t
size
)
{
check_output_buffer_space
(
size
);
memcpy
(
output_buffer
+
output_buffer_pos
,
data
,
size
);
output_buffer_pos
+=
size
;
}
void
put_byte
(
unsigned
char
val
)
{
check_output_buffer_space
(
1
);
...
...
@@ -485,15 +477,18 @@ void put_byte( unsigned char val )
void
put_word
(
unsigned
short
val
)
{
if
(
byte_swapped
)
val
=
(
val
<<
8
)
|
(
val
>>
8
);
put_data
(
&
val
,
sizeof
(
val
)
);
check_output_buffer_space
(
2
);
output_buffer
[
output_buffer_pos
++
]
=
val
;
output_buffer
[
output_buffer_pos
++
]
=
val
>>
8
;
}
void
put_dword
(
unsigned
int
val
)
{
if
(
byte_swapped
)
val
=
((
val
<<
24
)
|
((
val
<<
8
)
&
0x00ff0000
)
|
((
val
>>
8
)
&
0x0000ff00
)
|
(
val
>>
24
));
put_data
(
&
val
,
sizeof
(
val
)
);
check_output_buffer_space
(
4
);
output_buffer
[
output_buffer_pos
++
]
=
val
;
output_buffer
[
output_buffer_pos
++
]
=
val
>>
8
;
output_buffer
[
output_buffer_pos
++
]
=
val
>>
16
;
output_buffer
[
output_buffer_pos
++
]
=
val
>>
24
;
}
void
align_output
(
unsigned
int
align
)
...
...
tools/wmc/utils.h
View file @
af046fe6
...
...
@@ -43,14 +43,12 @@ WCHAR *codepage_to_unicode( int codepage, const char *src, int srclen, int *dstl
/* buffer management */
extern
int
byte_swapped
;
extern
unsigned
char
*
output_buffer
;
extern
size_t
output_buffer_pos
;
extern
size_t
output_buffer_size
;
extern
void
init_output_buffer
(
void
);
extern
void
flush_output_buffer
(
const
char
*
name
);
extern
void
put_data
(
const
void
*
data
,
size_t
size
);
extern
void
put_byte
(
unsigned
char
val
);
extern
void
put_word
(
unsigned
short
val
);
extern
void
put_dword
(
unsigned
int
val
);
...
...
tools/wmc/wmc.c
View file @
af046fe6
...
...
@@ -37,14 +37,6 @@
static
const
char
usage
[]
=
"Usage: wmc [options...] [inputfile.mc]
\n
"
" -B x Set output byte-order x={n[ative], l[ittle], b[ig]}
\n
"
" (default is n[ative] which equals "
#ifdef WORDS_BIGENDIAN
"big"
#else
"little"
#endif
"-endian)
\n
"
" -c Set 'custom-bit' in values
\n
"
" -d Use decimal values in output
\n
"
" -D Set debug flag
\n
"
...
...
@@ -71,11 +63,6 @@ static const char version_string[] =
;
/*
* The output byte-order of resources (set with -B)
*/
int
byteorder
=
WMC_BO_NATIVE
;
/*
* Custom bit (bit 29) in output values must be set (-c option)
*/
int
custombit
=
0
;
...
...
@@ -136,7 +123,7 @@ enum long_options_values
LONG_OPT_NLS_DIR
=
1
,
};
static
const
char
short_options
[]
=
"
B:
cdDhH:io:O:P:uUvVW"
;
static
const
char
short_options
[]
=
"cdDhH:io:O:P:uUvVW"
;
static
const
struct
long_option
long_options
[]
=
{
{
"help"
,
0
,
'h'
},
...
...
@@ -190,25 +177,6 @@ static void option_callback( int optc, char *optarg )
{
switch
(
optc
)
{
case
'B'
:
switch
(
optarg
[
0
])
{
case
'n'
:
case
'N'
:
byteorder
=
WMC_BO_NATIVE
;
break
;
case
'l'
:
case
'L'
:
byteorder
=
WMC_BO_LITTLE
;
break
;
case
'b'
:
case
'B'
:
byteorder
=
WMC_BO_BIG
;
break
;
default:
error
(
"Byteordering must be n[ative], l[ittle] or b[ig]
\n
"
);
}
break
;
case
'c'
:
custombit
=
1
;
break
;
...
...
@@ -347,12 +315,6 @@ int main(int argc,char *argv[])
exit
(
1
);
}
#ifdef WORDS_BIGENDIAN
byte_swapped
=
(
byteorder
==
WMC_BO_LITTLE
);
#else
byte_swapped
=
(
byteorder
==
WMC_BO_BIG
);
#endif
switch
(
output_format
)
{
case
FORMAT_RC
:
...
...
tools/wmc/wmc.h
View file @
af046fe6
...
...
@@ -39,7 +39,6 @@
extern
int
pedantic
;
extern
int
leave_case
;
extern
int
byteorder
;
extern
int
decimal
;
extern
int
custombit
;
extern
int
unicodein
;
...
...
tools/wmc/wmc.man.in
View file @
af046fe6
...
...
@@ -22,9 +22,6 @@ with \fB-o\fR, then \fBwmc\fR will write the output to \fIinputfile.{rc,h}\fR.
The outputfile is named \fIwmc.tab.{rc,h}\fR if no inputfile was given.
.SH OPTIONS
.TP
.BI \-B\ x
Set output byte-order x={n[ative], l[ittle], b[ig]}. Default is n[ative].
.TP
.B \-c
Set 'custom-bit' in message-code values.
.TP
...
...
tools/wmc/wmctypes.h
View file @
af046fe6
...
...
@@ -25,18 +25,6 @@
#include "windef.h"
#include "winbase.h"
/* Byteordering defines */
#define WMC_BO_NATIVE 0x00
#define WMC_BO_LITTLE 0x01
#define WMC_BO_BIG 0x02
#define WMC_LOBYTE(w) ((WORD)(w) & 0xff)
#define WMC_HIBYTE(w) (((WORD)(w) >> 8) & 0xff)
#define WMC_LOWORD(d) ((DWORD)(d) & 0xffff)
#define WMC_HIWORD(d) (((DWORD)(d) >> 16) & 0xffff)
#define BYTESWAP_WORD(w) ((WORD)(((WORD)WMC_LOBYTE(w) << 8) + (WORD)WMC_HIBYTE(w)))
#define BYTESWAP_DWORD(d) ((DWORD)(((DWORD)BYTESWAP_WORD(WMC_LOWORD(d)) << 16) + ((DWORD)BYTESWAP_WORD(WMC_HIWORD(d)))))
/*
* Tokenizer types
*/
...
...
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