mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 09:43:38 +00:00
widl: Windows file formats are always little-endian.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
af046fe636
commit
ad53edfab9
|
@ -138,13 +138,8 @@ typedef struct tagMSFT_TypeInfoBase {
|
|||
/*040*/ INT helpstringcontext; /* */
|
||||
INT helpcontext; /* */
|
||||
INT oCustData; /* offset in customer data table */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
INT16 cbSizeVft; /* virtual table size, including inherits */
|
||||
INT16 cImplTypes; /* nr of implemented interfaces */
|
||||
#else
|
||||
INT16 cImplTypes; /* nr of implemented interfaces */
|
||||
INT16 cbSizeVft; /* virtual table size, including inherits */
|
||||
#endif
|
||||
/*050*/ INT size; /* size in bytes, at least for structures */
|
||||
/* FIXME: name of this field */
|
||||
INT datatype1; /* position in type description table */
|
||||
|
@ -174,13 +169,8 @@ typedef struct {
|
|||
/* INT recsize; record size including some extra stuff */
|
||||
INT DataType; /* data type of the member, eg return of function */
|
||||
INT Flags; /* something to do with attribute flags (LOWORD) */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */
|
||||
INT16 VtableOffset; /* offset in vtable */
|
||||
#else
|
||||
INT16 VtableOffset; /* offset in vtable */
|
||||
INT16 funcdescsize; /* size of reconstituted FUNCDESC and related structs */
|
||||
#endif
|
||||
INT FKCCIC; /* bit string with the following */
|
||||
/* meaning (bit 0 is the lsb): */
|
||||
/* bits 0 - 2: FUNCKIND */
|
||||
|
@ -191,13 +181,8 @@ typedef struct {
|
|||
/* bit 13: oEntry is numeric */
|
||||
/* bit 14: has retval param */
|
||||
/* bits 16 - 31: index of next function with same id */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
INT16 nroargs; /* nr of optional arguments */
|
||||
INT16 nrargs; /* number of arguments (including optional ????) */
|
||||
#else
|
||||
INT16 nrargs; /* number of arguments (including optional ????) */
|
||||
INT16 nroargs; /* nr of optional arguments */
|
||||
#endif
|
||||
/* optional attribute fields, the number of them is variable */
|
||||
INT OptAttr[1];
|
||||
/*
|
||||
|
@ -230,13 +215,8 @@ typedef struct {
|
|||
/* INT recsize; // record size including some extra stuff */
|
||||
INT DataType; /* data type of the variable */
|
||||
INT Flags; /* VarFlags (LOWORD) */
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
INT16 vardescsize; /* size of reconstituted VARDESC and related structs */
|
||||
INT16 VarKind; /* VarKind */
|
||||
#else
|
||||
INT16 VarKind; /* VarKind */
|
||||
INT16 vardescsize; /* size of reconstituted VARDESC and related structs */
|
||||
#endif
|
||||
INT OffsValue; /* value of the variable or the offset */
|
||||
/* in the data structure */
|
||||
/* optional attribute fields, the number of them is variable */
|
||||
|
|
|
@ -211,7 +211,6 @@ size_t strappend(char **buf, size_t *len, size_t pos, const char* fmt, ...)
|
|||
* 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;
|
||||
|
@ -351,29 +350,24 @@ 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 put_qword( unsigned int val )
|
||||
{
|
||||
if (byte_swapped)
|
||||
{
|
||||
put_dword( 0 );
|
||||
put_dword( val );
|
||||
}
|
||||
else
|
||||
{
|
||||
put_dword( val );
|
||||
put_dword( 0 );
|
||||
}
|
||||
put_dword( val );
|
||||
put_dword( 0 );
|
||||
}
|
||||
|
||||
/* pointer-sized word */
|
||||
|
|
|
@ -40,7 +40,6 @@ int is_valid_uuid(const char *s);
|
|||
|
||||
/* buffer management */
|
||||
|
||||
extern int byte_swapped;
|
||||
extern unsigned char *output_buffer;
|
||||
extern size_t output_buffer_pos;
|
||||
extern size_t output_buffer_size;
|
||||
|
|
|
@ -302,17 +302,10 @@ static int ctl2_encode_name(
|
|||
|
||||
value = lhash_val_of_name_sys(typelib->typelib_header.varflags & 0x0f, typelib->typelib_header.lcid, converted_name + 4);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
converted_name[3] = length & 0xff;
|
||||
converted_name[2] = length >> 8;
|
||||
converted_name[1] = value;
|
||||
converted_name[0] = value >> 8;
|
||||
#else
|
||||
converted_name[0] = length & 0xff;
|
||||
converted_name[1] = length >> 8;
|
||||
converted_name[2] = value;
|
||||
converted_name[3] = value >> 8;
|
||||
#endif
|
||||
|
||||
for (offset = (4 - length) & 3; offset; offset--) converted_name[length + offset + 3] = 0x57;
|
||||
|
||||
|
@ -349,14 +342,8 @@ static int ctl2_encode_string(
|
|||
if (length < 3) size += 4;
|
||||
converted_string = xmalloc(size);
|
||||
memcpy(converted_string + 2, string, length);
|
||||
|
||||
#ifdef WORDS_BIGENDIAN
|
||||
converted_string[1] = length & 0xff;
|
||||
converted_string[0] = (length >> 8) & 0xff;
|
||||
#else
|
||||
converted_string[0] = length & 0xff;
|
||||
converted_string[1] = (length >> 8) & 0xff;
|
||||
#endif
|
||||
|
||||
if(length < 3) { /* strings of this length are padded with up to 8 bytes incl the 2 byte length */
|
||||
for(offset = 0; offset < 4; offset++)
|
||||
|
@ -2738,7 +2725,6 @@ static void save_all_changes(msft_typelib_t *typelib)
|
|||
|
||||
ctl2_finalize_typeinfos(typelib, filepos);
|
||||
|
||||
byte_swapped = 0;
|
||||
init_output_buffer();
|
||||
|
||||
put_data(&typelib->typelib_header, sizeof(typelib->typelib_header));
|
||||
|
|
Loading…
Reference in a new issue