winedump: Fix some incorrect uses of Unix 'long' type.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-04-22 16:09:43 +02:00
parent 53ab4c5385
commit e1e6d18a61
2 changed files with 38 additions and 38 deletions

View File

@ -228,7 +228,7 @@ static BOOL dump_cv_sst_src_module(const OMFDirEntry* omfde)
{ {
int i, j; int i, j;
const BYTE* rawdata; const BYTE* rawdata;
const unsigned long* seg_info_dw; const unsigned int *seg_info_dw;
const unsigned short* seg_info_w; const unsigned short* seg_info_w;
unsigned ofs; unsigned ofs;
const OMFSourceModule* sourceModule; const OMFSourceModule* sourceModule;
@ -250,24 +250,24 @@ static BOOL dump_cv_sst_src_module(const OMFDirEntry* omfde)
/* FIXME: check ptr validity */ /* FIXME: check ptr validity */
seg_info_dw = (const void*)((const char*)(sourceModule + 1) + seg_info_dw = (const void*)((const char*)(sourceModule + 1) +
sizeof(unsigned long) * (sourceModule->cFile - 1)); sizeof(unsigned int) * (sourceModule->cFile - 1));
seg_info_w = (const unsigned short*)(&seg_info_dw[sourceModule->cSeg * 2]); seg_info_w = (const unsigned short*)(&seg_info_dw[sourceModule->cSeg * 2]);
for (i = 0; i < sourceModule->cSeg; i++) for (i = 0; i < sourceModule->cSeg; i++)
{ {
printf (" Segment #%2d start = 0x%lx, end = 0x%lx, seg index = %u\n", printf (" Segment #%2d start = 0x%x, end = 0x%x, seg index = %u\n",
i + 1, seg_info_dw[i * 2], seg_info_dw[(i * 2) + 1], i + 1, seg_info_dw[i * 2], seg_info_dw[(i * 2) + 1],
seg_info_w[i]); seg_info_w[i]);
} }
ofs = sizeof(OMFSourceModule) + sizeof(unsigned long) * (sourceModule->cFile - 1) + ofs = sizeof(OMFSourceModule) + sizeof(unsigned int) * (sourceModule->cFile - 1) +
sourceModule->cSeg * (2 * sizeof(unsigned long) + sizeof(unsigned short)); sourceModule->cSeg * (2 * sizeof(unsigned int) + sizeof(unsigned short));
ofs = (ofs + 3) & ~3; ofs = (ofs + 3) & ~3;
/* the OMFSourceFile is quite unpleasant to use: /* the OMFSourceFile is quite unpleasant to use:
* we have first: * we have first:
* unsigned short number of segments * unsigned short number of segments
* unsigned short reserved * unsigned short reserved
* unsigned long baseSrcLn[# segments] * unsigned int baseSrcLn[# segments]
* unsigned long offset[2 * #segments] * unsigned int offset[2 * #segments]
* odd indices are start offsets * odd indices are start offsets
* even indices are end offsets * even indices are end offsets
* unsigned char string length for file name * unsigned char string length for file name
@ -276,16 +276,16 @@ static BOOL dump_cv_sst_src_module(const OMFDirEntry* omfde)
/* FIXME: check ptr validity */ /* FIXME: check ptr validity */
sourceFile = (const void*)(rawdata + ofs); sourceFile = (const void*)(rawdata + ofs);
seg_info_dw = (const void*)((const char*)sourceFile + 2 * sizeof(unsigned short) + seg_info_dw = (const void*)((const char*)sourceFile + 2 * sizeof(unsigned short) +
sourceFile->cSeg * sizeof(unsigned long)); sourceFile->cSeg * sizeof(unsigned int));
ofs += 2 * sizeof(unsigned short) + 3 * sourceFile->cSeg * sizeof(unsigned long); ofs += 2 * sizeof(unsigned short) + 3 * sourceFile->cSeg * sizeof(unsigned int);
printf(" File table: %.*s\n", printf(" File table: %.*s\n",
*(const BYTE*)((const char*)sourceModule + ofs), (const char*)sourceModule + ofs + 1); *(const BYTE*)((const char*)sourceModule + ofs), (const char*)sourceModule + ofs + 1);
for (i = 0; i < sourceFile->cSeg; i++) for (i = 0; i < sourceFile->cSeg; i++)
{ {
printf (" Segment #%2d start = 0x%lx, end = 0x%lx, offset = 0x%x\n", printf (" Segment #%2d start = 0x%x, end = 0x%x, offset = 0x%x\n",
i + 1, seg_info_dw[i * 2], seg_info_dw[(i * 2) + 1], sourceFile->baseSrcLn[i]); i + 1, seg_info_dw[i * 2], seg_info_dw[(i * 2) + 1], sourceFile->baseSrcLn[i]);
} }
/* add file name length */ /* add file name length */
@ -303,11 +303,11 @@ static BOOL dump_cv_sst_src_module(const OMFDirEntry* omfde)
for (j = 0; j < sourceLine->cLnOff; j++) for (j = 0; j < sourceLine->cLnOff; j++)
{ {
printf (" Pair #%2d: offset = [0x%8lx], linenumber = %d\n", printf (" Pair #%2d: offset = [0x%8x], linenumber = %d\n",
j + 1, seg_info_dw[j], seg_info_w[j]); j + 1, seg_info_dw[j], seg_info_w[j]);
} }
ofs += 2 * sizeof(unsigned short) + ofs += 2 * sizeof(unsigned short) +
sourceLine->cLnOff * (sizeof(unsigned long) + sizeof(unsigned short)); sourceLine->cLnOff * (sizeof(unsigned int) + sizeof(unsigned short));
ofs = (ofs + 3) & ~3; ofs = (ofs + 3) & ~3;
} }
@ -608,12 +608,12 @@ struct stab_nlist
{ {
char* n_name; char* n_name;
struct stab_nlist* n_next; struct stab_nlist* n_next;
long n_strx; int n_strx;
} n_un; } n_un;
unsigned char n_type; unsigned char n_type;
char n_other; char n_other;
short n_desc; short n_desc;
unsigned long n_value; unsigned int n_value;
}; };
static const char * const stabs_defs[] = { static const char * const stabs_defs[] = {
@ -708,7 +708,7 @@ void dump_stabs(const void* pv_stabs, unsigned szstabs, const char* stabstr,
sprintf(n_buffer, "<0x%02x>", stab_ptr->n_type); sprintf(n_buffer, "<0x%02x>", stab_ptr->n_type);
else else
sprintf(n_buffer, "%-6s", stabs_defs[stab_ptr->n_type / 2]); sprintf(n_buffer, "%-6s", stabs_defs[stab_ptr->n_type / 2]);
printf("%4d %s %-8x % 6d %-8lx %-6lx %s\n", printf("%4d %s %-8x % 6d %-8x %-6x %s\n",
i, n_buffer, stab_ptr->n_other, stab_ptr->n_desc, stab_ptr->n_value, i, n_buffer, stab_ptr->n_other, stab_ptr->n_desc, stab_ptr->n_value,
stab_ptr->n_un.n_strx, ptr); stab_ptr->n_un.n_strx, ptr);
} }

View File

@ -30,11 +30,11 @@
struct o32_obj struct o32_obj
{ {
unsigned long o32_size; unsigned int o32_size;
unsigned long o32_base; unsigned int o32_base;
unsigned long o32_flags; unsigned int o32_flags;
unsigned long o32_pagemap; unsigned int o32_pagemap;
unsigned long o32_mapsize; unsigned int o32_mapsize;
char o32_name[4]; char o32_name[4];
}; };
@ -53,28 +53,28 @@ struct b32_bundle
struct vxd_descriptor struct vxd_descriptor
{ {
unsigned long next; unsigned int next;
unsigned short sdk_version; unsigned short sdk_version;
unsigned short device_number; unsigned short device_number;
unsigned char version_major; unsigned char version_major;
unsigned char version_minor; unsigned char version_minor;
unsigned short flags; unsigned short flags;
char name[8]; char name[8];
unsigned long init_order; unsigned int init_order;
unsigned long ctrl_ofs; unsigned int ctrl_ofs;
unsigned long v86_ctrl_ofs; unsigned int v86_ctrl_ofs;
unsigned long pm_ctrl_ofs; unsigned int pm_ctrl_ofs;
unsigned long v86_ctrl_csip; unsigned int v86_ctrl_csip;
unsigned long pm_ctrl_csip; unsigned int pm_ctrl_csip;
unsigned long rm_ref_data; unsigned int rm_ref_data;
unsigned long service_table_ofs; unsigned int service_table_ofs;
unsigned long service_table_size; unsigned int service_table_size;
unsigned long win32_service_table_ofs; unsigned int win32_service_table_ofs;
unsigned long prev; unsigned int prev;
unsigned long size; unsigned int size;
unsigned long reserved0; unsigned int reserved0;
unsigned long reserved1; unsigned int reserved1;
unsigned long reserved2; unsigned int reserved2;
}; };
static inline WORD get_word( const BYTE *ptr ) static inline WORD get_word( const BYTE *ptr )
@ -234,7 +234,7 @@ static void dump_le_objects( const IMAGE_VXD_HEADER *le )
const struct o32_map *pmap=0; const struct o32_map *pmap=0;
printf(" Obj. Rel.Base Codesize Flags Tableidx Tablesize Name\n"); printf(" Obj. Rel.Base Codesize Flags Tableidx Tablesize Name\n");
printf(" %04X %08lx %08lx %08lx %08lx %08lx ", i + 1, printf(" %04X %08x %08x %08x %08x %08x ", i + 1,
pobj->o32_base, pobj->o32_size, pobj->o32_flags, pobj->o32_base, pobj->o32_size, pobj->o32_flags,
pobj->o32_pagemap, pobj->o32_mapsize); pobj->o32_pagemap, pobj->o32_mapsize);
for (j = 0; j < 4; j++) for (j = 0; j < 4; j++)
@ -271,7 +271,7 @@ static void dump_le_objects( const IMAGE_VXD_HEADER *le )
pmap = &(pmap[pobj->o32_pagemap - 1]); pmap = &(pmap[pobj->o32_pagemap - 1]);
for (j = 0; j < pobj->o32_mapsize; j++) for (j = 0; j < pobj->o32_mapsize; j++)
{ {
printf(" %08lx %06x %02x\n", printf(" %08x %06x %02x\n",
pobj->o32_pagemap + j, pobj->o32_pagemap + j,
(pmap->o32_pagedataoffset << 8) + pmap->o32_pagesize, (pmap->o32_pagedataoffset << 8) + pmap->o32_pagesize,
(int)pmap->o32_pageflags); (int)pmap->o32_pageflags);