Index: rclex.l =================================================================== RCS file: /cvs/src/src/binutils/rclex.l,v retrieving revision 1.14 diff -B -b -u -r1.14 rclex.l --- rclex.l 12 Oct 2005 00:16:12 -0000 1.14 +++ rclex.l 16 Apr 2007 09:13:35 -0000 @@ -70,7 +70,7 @@ /* Local functions. */ static void cpp_line (const char *); -static char *handle_quotes (const char *, unsigned long *); +static char *handle_quotes (const char *, unsigned int *); static char *get_string (int); %} @@ -201,7 +201,7 @@ ("\""[^\"\n]*"\""[ \t\n]*)+ { char *s; - unsigned long length; + unsigned int length; s = handle_quotes (yytext, &length); if (! rcdata_mode) @@ -303,7 +303,7 @@ merged separated by whitespace are merged, as in C. */ static char * -handle_quotes (const char *input, unsigned long *len) +handle_quotes (const char *input, unsigned int *len) { char *ret, *s; const char *t; Index: rcparse.y =================================================================== RCS file: /cvs/src/src/binutils/rcparse.y,v retrieving revision 1.22 diff -B -b -u -r1.22 rcparse.y --- rcparse.y 8 May 2005 14:17:39 -0000 1.22 +++ rcparse.y 16 Apr 2007 09:13:36 -0000 @@ -45,14 +45,14 @@ /* This is used when building a style. It is modified by the nonterminal styleexpr. */ -static unsigned long style; +static unsigned int style; /* These are used when building a control. They are set before using control_params. */ -static unsigned long base_style; -static unsigned long default_style; -static unsigned long class; +static unsigned int base_style; +static unsigned int default_style; +static unsigned int class; static struct res_id res_text_field; static unichar null_unichar; @@ -88,16 +88,16 @@ } memflags; struct { - unsigned long val; + unsigned int val; /* Nonzero if this number was explicitly specified as long. */ int dword; } i; - unsigned long il; + unsigned int il; unsigned short is; const char *s; struct { - unsigned long length; + unsigned int length; const char *s; } ss; }; Index: resbin.c =================================================================== RCS file: /cvs/src/src/binutils/resbin.c,v retrieving revision 1.10 diff -B -b -u -r1.10 resbin.c --- resbin.c 29 Mar 2006 00:24:28 -0000 1.10 +++ resbin.c 16 Apr 2007 09:13:37 -0000 @@ -40,39 +40,39 @@ static void toosmall (const char *); static unichar *get_unicode - (const unsigned char *, unsigned long, int, int *); + (const unsigned char *, unsigned int, int, int *); static int get_resid - (struct res_id *, const unsigned char *, unsigned long, int); + (struct res_id *, const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_generic - (enum res_type, const unsigned char *, unsigned long); + (enum res_type, const unsigned char *, unsigned int); static struct res_resource *bin_to_res_cursor - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_menu - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct menuitem *bin_to_res_menuitems - (const unsigned char *, unsigned long, int, int *); + (const unsigned char *, unsigned int, int, int *); static struct menuitem *bin_to_res_menuexitems - (const unsigned char *, unsigned long, int, int *); + (const unsigned char *, unsigned int, int, int *); static struct res_resource *bin_to_res_dialog - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_string - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_fontdir - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_accelerators - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_rcdata - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_group_cursor - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_group_icon - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_version - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static struct res_resource *bin_to_res_userdata - (const unsigned char *, unsigned long, int); + (const unsigned char *, unsigned int, int); static void get_version_header - (const unsigned char *, unsigned long, int, const char *, + (const unsigned char *, unsigned int, int, const char *, unichar **, int *, int *, int *, int *); /* Given a resource type ID, a pointer to data, a length, return a @@ -82,7 +82,7 @@ struct res_resource * bin_to_res (struct res_id type, const unsigned char *data, - unsigned long length, int big_endian) + unsigned int length, int big_endian) { if (type.named) return bin_to_res_userdata (data, length, big_endian); @@ -135,7 +135,7 @@ /* Swap in a NULL terminated unicode string. */ static unichar * -get_unicode (const unsigned char *data, unsigned long length, +get_unicode (const unsigned char *data, unsigned int length, int big_endian, int *retlen) { int c, i; @@ -144,7 +144,7 @@ c = 0; while (1) { - if (length < (unsigned long) c * 2 + 2) + if (length < (unsigned int) c * 2 + 2) toosmall (_("null terminated unicode string")); if (get_16 (big_endian, data + c * 2) == 0) break; @@ -167,7 +167,7 @@ static int get_resid (struct res_id *id, const unsigned char *data, - unsigned long length, int big_endian) + unsigned int length, int big_endian) { int first; @@ -196,7 +196,7 @@ struct res_resource * bin_to_res_generic (enum res_type type, const unsigned char *data, - unsigned long length) + unsigned int length) { struct res_resource *r; @@ -211,7 +211,7 @@ /* Convert a cursor resource from binary. */ struct res_resource * -bin_to_res_cursor (const unsigned char *data, unsigned long length, +bin_to_res_cursor (const unsigned char *data, unsigned int length, int big_endian) { struct cursor *c; @@ -236,7 +236,7 @@ /* Convert a menu resource from binary. */ struct res_resource * -bin_to_res_menu (const unsigned char *data, unsigned long length, +bin_to_res_menu (const unsigned char *data, unsigned int length, int big_endian) { struct res_resource *r; @@ -286,7 +286,7 @@ /* Convert menu items from binary. */ static struct menuitem * -bin_to_res_menuitems (const unsigned char *data, unsigned long length, +bin_to_res_menuitems (const unsigned char *data, unsigned int length, int big_endian, int *read) { struct menuitem *first, **pp; @@ -364,7 +364,7 @@ /* Convert menuex items from binary. */ static struct menuitem * -bin_to_res_menuexitems (const unsigned char *data, unsigned long length, +bin_to_res_menuexitems (const unsigned char *data, unsigned int length, int big_endian, int *read) { struct menuitem *first, **pp; @@ -439,7 +439,7 @@ /* Convert a dialog resource from binary. */ static struct res_resource * -bin_to_res_dialog (const unsigned char *data, unsigned long length, +bin_to_res_dialog (const unsigned char *data, unsigned int length, int big_endian) { int signature; @@ -625,7 +625,7 @@ /* Convert a stringtable resource from binary. */ static struct res_resource * -bin_to_res_string (const unsigned char *data, unsigned long length, +bin_to_res_string (const unsigned char *data, unsigned int length, int big_endian) { struct stringtable *st; @@ -672,7 +672,7 @@ /* Convert a fontdir resource from binary. */ static struct res_resource * -bin_to_res_fontdir (const unsigned char *data, unsigned long length, +bin_to_res_fontdir (const unsigned char *data, unsigned int length, int big_endian) { int c, i; @@ -742,7 +742,7 @@ /* Convert an accelerators resource from binary. */ static struct res_resource * -bin_to_res_accelerators (const unsigned char *data, unsigned long length, +bin_to_res_accelerators (const unsigned char *data, unsigned int length, int big_endian) { struct accelerator *first, **pp; @@ -785,7 +785,7 @@ /* Convert an rcdata resource from binary. */ static struct res_resource * -bin_to_res_rcdata (const unsigned char *data, unsigned long length, +bin_to_res_rcdata (const unsigned char *data, unsigned int length, int big_endian ATTRIBUTE_UNUSED) { struct rcdata_item *ri; @@ -808,7 +808,7 @@ /* Convert a group cursor resource from binary. */ static struct res_resource * -bin_to_res_group_cursor (const unsigned char *data, unsigned long length, +bin_to_res_group_cursor (const unsigned char *data, unsigned int length, int big_endian) { int type, c, i; @@ -864,7 +864,7 @@ /* Convert a group icon resource from binary. */ static struct res_resource * -bin_to_res_group_icon (const unsigned char *data, unsigned long length, +bin_to_res_group_icon (const unsigned char *data, unsigned int length, int big_endian) { int type, c, i; @@ -924,7 +924,7 @@ to the type, and *OFF to the offset to the children. */ static void -get_version_header (const unsigned char *data, unsigned long length, +get_version_header (const unsigned char *data, unsigned int length, int big_endian, const char *key, unichar **pkey, int *len, int *vallen, int *type, int *off) { @@ -973,7 +973,7 @@ /* Convert a version resource from binary. */ static struct res_resource * -bin_to_res_version (const unsigned char *data, unsigned long length, +bin_to_res_version (const unsigned char *data, unsigned int length, int big_endian) { int verlen, vallen, type, off; @@ -986,7 +986,7 @@ (unichar **) NULL, &verlen, &vallen, &type, &off); if ((unsigned int) verlen != length) - fatal (_("version length %d does not match resource length %lu"), + fatal (_("version length %d does not match resource length %u"), verlen, length); if (type != 0) @@ -999,7 +999,7 @@ fi = NULL; else { - unsigned long signature, fiv; + unsigned int signature, fiv; if (vallen != 52) fatal (_("unexpected fixed version information length %d"), vallen); @@ -1009,11 +1009,11 @@ signature = get_32 (big_endian, data); if (signature != 0xfeef04bd) - fatal (_("unexpected fixed version signature %lu"), signature); + fatal (_("unexpected fixed version signature %u"), signature); fiv = get_32 (big_endian, data + 4); if (fiv != 0 && fiv != 0x10000) - fatal (_("unexpected fixed version info version %lu"), fiv); + fatal (_("unexpected fixed version info version %u"), fiv); fi = (struct fixed_versioninfo *) res_alloc (sizeof *fi); @@ -1192,7 +1192,7 @@ /* Convert an arbitrary user defined resource from binary. */ static struct res_resource * -bin_to_res_userdata (const unsigned char *data, unsigned long length, +bin_to_res_userdata (const unsigned char *data, unsigned int length, int big_endian ATTRIBUTE_UNUSED) { struct rcdata_item *ri; @@ -1220,7 +1220,7 @@ /* Local functions used to convert resources to binary format. */ -static void dword_align_bin (struct bindata ***, unsigned long *); +static void dword_align_bin (struct bindata ***, unsigned int *); static struct bindata *resid_to_bin (struct res_id, int); static struct bindata *unicode_to_bin (const unichar *, int); static struct bindata *res_to_bin_accelerator @@ -1249,7 +1249,7 @@ static struct bindata *res_to_bin_versioninfo (const struct versioninfo *, int); static struct bindata *res_to_bin_generic - (unsigned long, const unsigned char *); + (unsigned int, const unsigned char *); /* Convert a resource to binary. */ @@ -1296,7 +1296,7 @@ boundary. It updates *PPP and *LENGTH. */ static void -dword_align_bin (struct bindata ***ppp, unsigned long *length) +dword_align_bin (struct bindata ***ppp, unsigned int *length) { int add; struct bindata *d; @@ -1502,7 +1502,7 @@ { int dialogex; struct bindata *first, **pp; - unsigned long length; + unsigned int length; int off, c; struct dialog_control *dc; @@ -1654,7 +1654,7 @@ put_16 (big_endian, 0, d->data); else { - unsigned long sublen; + unsigned int sublen; dword_align_bin (&pp, &length); @@ -1858,7 +1858,7 @@ res_to_bin_menuexitems (const struct menuitem *items, int big_endian) { struct bindata *first, **pp; - unsigned long length; + unsigned int length; const struct menuitem *mi; first = NULL; @@ -1965,7 +1965,7 @@ case RCDATA_WSTRING: { - unsigned long i; + unsigned int i; d->length = ri->u.wstring.length * 2; d->data = (unsigned char *) reswr_alloc (d->length); @@ -2055,7 +2055,7 @@ res_to_bin_versioninfo (const struct versioninfo *versioninfo, int big_endian) { struct bindata *first, **pp; - unsigned long length; + unsigned int length; struct ver_info *vi; first = (struct bindata *) reswr_alloc (sizeof *first); @@ -2114,7 +2114,7 @@ for (vi = versioninfo->var; vi != NULL; vi = vi->next) { struct bindata *vid; - unsigned long vilen; + unsigned int vilen; dword_align_bin (&pp, &length); @@ -2138,7 +2138,7 @@ case VERINFO_STRING: { - unsigned long hold, vslen; + unsigned int hold, vslen; struct bindata *vsd; const struct ver_stringinfo *vs; @@ -2174,7 +2174,7 @@ for (vs = vi->u.string.strings; vs != NULL; vs = vs->next) { struct bindata *vssd; - unsigned long vsslen; + unsigned int vsslen; hold = length; dword_align_bin (&pp, &length); @@ -2226,7 +2226,7 @@ case VERINFO_VAR: { - unsigned long hold, vvlen, vvvlen; + unsigned int hold, vvlen, vvvlen; struct bindata *vvd; const struct ver_varinfo *vv; @@ -2304,7 +2304,7 @@ /* Convert a generic resource to binary. */ static struct bindata * -res_to_bin_generic (unsigned long length, const unsigned char *data) +res_to_bin_generic (unsigned int length, const unsigned char *data) { struct bindata *d; Index: rescoff.c =================================================================== RCS file: /cvs/src/src/binutils/rescoff.c,v retrieving revision 1.7 diff -B -b -u -r1.7 rescoff.c --- rescoff.c 8 May 2005 14:17:39 -0000 1.7 +++ rescoff.c 16 Apr 2007 09:13:37 -0000 @@ -209,7 +209,7 @@ for (i = 0; i < name_count; i++, ere++) { - unsigned long name, rva; + unsigned int name, rva; struct res_entry *re; const bfd_byte *ers; int length, j; @@ -263,7 +263,7 @@ for (i = 0; i < id_count; i++, ere++) { - unsigned long name, rva; + unsigned int name, rva; struct res_entry *re; if ((const bfd_byte *) ere >= finfo->data_end) @@ -311,7 +311,7 @@ { const struct extern_res_data *erd; struct res_resource *r; - unsigned long size, rva; + unsigned int size, rva; const bfd_byte *resdata; if (type == NULL) @@ -351,7 +351,7 @@ /* The last structure we have added to the list. */ struct bindata *last; /* The size of the list as a whole. */ - unsigned long length; + unsigned int length; }; /* This structure keeps track of information as we build the directory @@ -369,11 +369,11 @@ /* These fields are computed initially, and then not changed. */ /* Length of directory tables and entries. */ - unsigned long dirsize; + unsigned int dirsize; /* Length of directory entry strings. */ - unsigned long dirstrsize; + unsigned int dirstrsize; /* Length of resource data entries. */ - unsigned long dataentsize; + unsigned int dataentsize; /* These fields are updated as we add data. */ /* Directory tables and entries. */ @@ -421,7 +421,7 @@ asection *sec; struct coff_write_info cwi; struct bindata *d; - unsigned long length, offset; + unsigned int length, offset; if (filename == NULL) fatal (_("filename required for COFF output")); @@ -701,7 +701,7 @@ arelent *r; struct extern_res_data *erd; struct bindata *d; - unsigned long length; + unsigned int length; /* For some reason, although every other address is a section offset, the address of the resource data itself is an RVA. That Index: resrc.c =================================================================== RCS file: /cvs/src/src/binutils/resrc.c,v retrieving revision 1.27 diff -B -b -u -r1.27 resrc.c --- resrc.c 8 May 2005 14:17:39 -0000 1.27 +++ resrc.c 16 Apr 2007 09:13:39 -0000 @@ -110,9 +110,9 @@ } cursor; } u; /* Bytes in image. */ - unsigned long bytes; + unsigned int bytes; /* File offset of image. */ - unsigned long offset; + unsigned int offset; }; /* The name of the rc file we are reading. */ @@ -169,8 +169,8 @@ static void close_input_stream (void); static void unexpected_eof (const char *); static int get_word (FILE *, const char *); -static unsigned long get_long (FILE *, const char *); -static void get_data (FILE *, unsigned char *, unsigned long, const char *); +static unsigned int get_long (FILE *, const char *); +static void get_data (FILE *, unsigned char *, unsigned int, const char *); static void define_fontdirs (void); /* Run `cmd' and redirect the output to `redir'. */ @@ -555,7 +555,7 @@ /* Read a 32 bit word from a file. The data is assumed to be little endian. */ -static unsigned long +static unsigned int get_long (FILE *e, const char *msg) { int b1, b2, b3, b4; @@ -575,15 +575,15 @@ /* Read data from a file. This is a wrapper to do error checking. */ static void -get_data (FILE *e, unsigned char *p, unsigned long c, const char *msg) +get_data (FILE *e, unsigned char *p, unsigned int c, const char *msg) { - unsigned long got; + unsigned int got; got = fread (p, 1, c, e); if (got == c) return; - fatal (_("%s: read of %lu returned %lu"), msg, c, got); + fatal (_("%s: read of %u returned %u"), msg, c, got); } /* Define an accelerator resource. */ @@ -704,7 +704,7 @@ struct cursor *c; if (fseek (e, icondirs[i].offset, SEEK_SET) != 0) - fatal (_("%s: fseek to %lu failed: %s"), real_filename, + fatal (_("%s: fseek to %u failed: %s"), real_filename, icondirs[i].offset, strerror (errno)); data = (unsigned char *) res_alloc (icondirs[i].bytes); @@ -788,10 +788,10 @@ merely allocates and fills in a structure. */ struct dialog_control * -define_control (const struct res_id iid, unsigned long id, unsigned long x, - unsigned long y, unsigned long width, unsigned long height, - unsigned long class, unsigned long style, - unsigned long exstyle) +define_control (const struct res_id iid, unsigned int id, unsigned int x, + unsigned int y, unsigned int width, unsigned int height, + unsigned int class, unsigned int style, + unsigned int exstyle) { struct dialog_control *n; @@ -814,9 +814,9 @@ } struct dialog_control * -define_icon_control (struct res_id iid, unsigned long id, unsigned long x, - unsigned long y, unsigned long style, - unsigned long exstyle, unsigned long help, +define_icon_control (struct res_id iid, unsigned int id, unsigned int x, + unsigned int y, unsigned int style, + unsigned int exstyle, unsigned int help, struct rcdata_item *data, struct dialog_ex *ex) { struct dialog_control *n; @@ -1000,7 +1000,7 @@ struct res_id name; if (fseek (e, icondirs[i].offset, SEEK_SET) != 0) - fatal (_("%s: fseek to %lu failed: %s"), real_filename, + fatal (_("%s: fseek to %u failed: %s"), real_filename, icondirs[i].offset, strerror (errno)); data = (unsigned char *) res_alloc (icondirs[i].bytes); @@ -1095,8 +1095,8 @@ allocates and fills in a structure. */ struct menuitem * -define_menuitem (const char *text, int menuid, unsigned long type, - unsigned long state, unsigned long help, +define_menuitem (const char *text, int menuid, unsigned int type, + unsigned int state, unsigned int help, struct menuitem *menuitems) { struct menuitem *mi; @@ -1168,7 +1168,7 @@ /* Create an rcdata item holding a string. */ struct rcdata_item * -define_rcdata_string (const char *string, unsigned long len) +define_rcdata_string (const char *string, unsigned int len) { struct rcdata_item *ri; char *s; @@ -1187,7 +1187,7 @@ /* Create an rcdata item holding a number. */ struct rcdata_item * -define_rcdata_number (unsigned long val, int dword) +define_rcdata_number (unsigned int val, int dword) { struct rcdata_item *ri; @@ -1204,7 +1204,7 @@ void define_stringtable (const struct res_res_info *resinfo, - unsigned long stringid, const char *string) + unsigned int stringid, const char *string) { struct res_id id; struct res_resource *r; @@ -1414,8 +1414,8 @@ /* Append version variable information to a list. */ struct ver_varinfo * -append_vertrans (struct ver_varinfo *var, unsigned long language, - unsigned long charset) +append_vertrans (struct ver_varinfo *var, unsigned int language, + unsigned int charset) { struct ver_varinfo *vv, **pp; @@ -1456,7 +1456,7 @@ static void write_rc_stringtable (FILE *, const struct res_id *, const struct stringtable *); static void write_rc_versioninfo (FILE *, const struct versioninfo *); -static void write_rc_filedata (FILE *, unsigned long, const unsigned char *); +static void write_rc_filedata (FILE *, unsigned int, const unsigned char *); /* Indent a given number of spaces. */ @@ -1515,9 +1515,9 @@ /* Print out some COFF information that rc files can't represent. */ if (rd->time != 0) - fprintf (e, "// Time stamp: %lu\n", rd->time); + fprintf (e, "// Time stamp: %u\n", rd->time); if (rd->characteristics != 0) - fprintf (e, "// Characteristics: %lu\n", rd->characteristics); + fprintf (e, "// Characteristics: %u\n", rd->characteristics); if (rd->major != 0 || rd->minor != 0) fprintf (e, "// Version: %d %d\n", rd->major, rd->minor); @@ -1543,10 +1543,10 @@ /* If we're at level 3, then this key represents a language. Use it to update the current language. */ if (! re->id.named - && re->id.u.id != (unsigned long) (unsigned int) *language + && re->id.u.id != (unsigned int) (unsigned int) *language && (re->id.u.id & 0xffff) == re->id.u.id) { - fprintf (e, "LANGUAGE %lu, %lu\n", + fprintf (e, "LANGUAGE %u, %u\n", re->id.u.id & ((1 << SUBLANG_SHIFT) - 1), (re->id.u.id >> SUBLANG_SHIFT) & 0xff); *language = re->id.u.id; @@ -1766,7 +1766,7 @@ if (rt != 0 && type != NULL - && (type->named || type->u.id != (unsigned long) rt)) + && (type->named || type->u.id != (unsigned int) rt)) { fprintf (e, "// Unexpected resource type mismatch: "); res_id_print (e, *type, 1); @@ -1774,9 +1774,9 @@ } if (res->coff_info.codepage != 0) - fprintf (e, "// Code page: %lu\n", res->coff_info.codepage); + fprintf (e, "// Code page: %u\n", res->coff_info.codepage); if (res->coff_info.reserved != 0) - fprintf (e, "// COFF reserved value: %lu\n", res->coff_info.reserved); + fprintf (e, "// COFF reserved value: %u\n", res->coff_info.reserved); if (name != NULL) res_id_print (e, *name, 0); @@ -1809,7 +1809,7 @@ res->u.dialog->width, res->u.dialog->height); if (res->u.dialog->ex != NULL && res->u.dialog->ex->help != 0) - fprintf (e, ", %lu", res->u.dialog->ex->help); + fprintf (e, ", %u", res->u.dialog->ex->help); } fprintf (e, "\n"); @@ -1841,11 +1841,11 @@ res->res_info.language & ((1<res_info.language >> SUBLANG_SHIFT) & 0xff); if (res->res_info.characteristics != 0) - fprintf (e, "%sCHARACTERISTICS %lu\n", + fprintf (e, "%sCHARACTERISTICS %u\n", modifiers ? "// " : "", res->res_info.characteristics); if (res->res_info.version != 0) - fprintf (e, "%sVERSION %lu\n", + fprintf (e, "%sVERSION %u\n", modifiers ? "// " : "", res->res_info.version); } @@ -1981,7 +1981,7 @@ { fprintf (e, "// width: %d; height %d; planes %d; bits %d\n", gc->width, gc->height, gc->planes, gc->bits); - fprintf (e, "// data bytes: %lu; index: %d\n", + fprintf (e, "// data bytes: %u; index: %d\n", gc->bytes, gc->index); } } @@ -1993,10 +1993,10 @@ { const struct dialog_control *control; - fprintf (e, "STYLE 0x%lx\n", dialog->style); + fprintf (e, "STYLE 0x%x\n", dialog->style); if (dialog->exstyle != 0) - fprintf (e, "EXSTYLE 0x%lx\n", dialog->exstyle); + fprintf (e, "EXSTYLE 0x%x\n", dialog->exstyle); if ((dialog->class.named && dialog->class.u.n.length > 0) || dialog->class.u.id != 0) @@ -2050,7 +2050,7 @@ { const char *name; unsigned short class; - unsigned long style; + unsigned int style; }; static const struct control_info control_info[] = @@ -2059,23 +2059,23 @@ { "AUTOCHECKBOX", CTL_BUTTON, BS_AUTOCHECKBOX }, { "AUTORADIOBUTTON", CTL_BUTTON, BS_AUTORADIOBUTTON }, { "CHECKBOX", CTL_BUTTON, BS_CHECKBOX }, - { "COMBOBOX", CTL_COMBOBOX, (unsigned long) -1 }, + { "COMBOBOX", CTL_COMBOBOX, (unsigned int) -1 }, { "CTEXT", CTL_STATIC, SS_CENTER }, { "DEFPUSHBUTTON", CTL_BUTTON, BS_DEFPUSHBUTTON }, - { "EDITTEXT", CTL_EDIT, (unsigned long) -1 }, + { "EDITTEXT", CTL_EDIT, (unsigned int) -1 }, { "GROUPBOX", CTL_BUTTON, BS_GROUPBOX }, { "ICON", CTL_STATIC, SS_ICON }, - { "LISTBOX", CTL_LISTBOX, (unsigned long) -1 }, + { "LISTBOX", CTL_LISTBOX, (unsigned int) -1 }, { "LTEXT", CTL_STATIC, SS_LEFT }, { "PUSHBOX", CTL_BUTTON, BS_PUSHBOX }, { "PUSHBUTTON", CTL_BUTTON, BS_PUSHBUTTON }, { "RADIOBUTTON", CTL_BUTTON, BS_RADIOBUTTON }, { "RTEXT", CTL_STATIC, SS_RIGHT }, - { "SCROLLBAR", CTL_SCROLLBAR, (unsigned long) -1 }, + { "SCROLLBAR", CTL_SCROLLBAR, (unsigned int) -1 }, { "STATE3", CTL_BUTTON, BS_3STATE }, /* It's important that USERBUTTON come after all the other button types, so that it won't be matched too early. */ - { "USERBUTTON", CTL_BUTTON, (unsigned long) -1 }, + { "USERBUTTON", CTL_BUTTON, (unsigned int) -1 }, { NULL, 0, 0 } }; @@ -2094,7 +2094,7 @@ { for (ci = control_info; ci->name != NULL; ++ci) if (ci->class == control->class.u.id - && (ci->style == (unsigned long) -1 + && (ci->style == (unsigned int) -1 || ci->style == (control->style & 0xff))) break; } @@ -2121,7 +2121,7 @@ res_id_print (e, control->class, 0); if (control->class.named) fprintf (e, "\""); - fprintf (e, ", 0x%lx, ", control->style); + fprintf (e, ", 0x%x, ", control->style); } fprintf (e, "%d, %d", control->x, control->y); @@ -2137,10 +2137,10 @@ /* FIXME: We don't need to print the style if it is the default. More importantly, in certain cases we actually need to turn off parts of the forced style, by using NOT. */ - fprintf (e, ", 0x%lx", control->style); + fprintf (e, ", 0x%x", control->style); if (control->exstyle != 0 || control->help != 0) - fprintf (e, ", 0x%lx, %lu", control->exstyle, control->help); + fprintf (e, ", 0x%x, %u", control->exstyle, control->help); } fprintf (e, "\n"); @@ -2176,7 +2176,7 @@ { fprintf (e, "// width: %d; height %d; colors: %d; planes %d; bits %d\n", gi->width, gi->height, gi->colors, gi->planes, gi->bits); - fprintf (e, "// data bytes: %lu; index: %d\n", + fprintf (e, "// data bytes: %u; index: %d\n", gi->bytes, gi->index); } } @@ -2187,7 +2187,7 @@ write_rc_menu (FILE *e, const struct menu *menu, int menuex) { if (menu->help != 0) - fprintf (e, "// Help ID: %lu\n", menu->help); + fprintf (e, "// Help ID: %u\n", menu->help); write_rc_menuitems (e, menu->items, menuex, 0); } @@ -2255,12 +2255,12 @@ fprintf (e, ", %d", mi->id); if (mi->type != 0 || mi->state != 0 || mi->help != 0) { - fprintf (e, ", %lu", mi->type); + fprintf (e, ", %u", mi->type); if (mi->state != 0 || mi->help != 0) { - fprintf (e, ", %lu", mi->state); + fprintf (e, ", %u", mi->state); if (mi->help != 0) - fprintf (e, ", %lu", mi->help); + fprintf (e, ", %u", mi->help); } } } @@ -2304,13 +2304,13 @@ break; case RCDATA_DWORD: - fprintf (e, "%luL", ri->u.dword); + fprintf (e, "%uL", ri->u.dword); break; case RCDATA_STRING: { const char *s; - unsigned long i; + unsigned int i; fprintf (e, "\""); s = ri->u.string.s; @@ -2333,7 +2333,7 @@ case RCDATA_BUFFER: { - unsigned long i; + unsigned int i; int first; /* Assume little endian data. */ @@ -2341,7 +2341,7 @@ first = 1; for (i = 0; i + 3 < ri->u.buffer.length; i += 4) { - unsigned long l; + unsigned int l; int j; if (! first) @@ -2350,7 +2350,7 @@ | ri->u.buffer.data[i + 2]) << 8) | ri->u.buffer.data[i + 1]) << 8) | ri->u.buffer.data[i]); - fprintf (e, "%luL", l); + fprintf (e, "%uL", l); if (i + 4 < ri->u.buffer.length || ri->next != NULL) fprintf (e, ","); for (j = 0; j < 4; ++j) @@ -2448,7 +2448,7 @@ write_rc_stringtable (FILE *e, const struct res_id *name, const struct stringtable *stringtable) { - unsigned long offset; + unsigned int offset; int i; if (name != NULL && ! name->named) @@ -2466,7 +2466,7 @@ { if (stringtable->strings[i].length != 0) { - fprintf (e, " %lu, \"", offset + i); + fprintf (e, " %u, \"", offset + i); unicode_print (e, stringtable->strings[i].string, stringtable->strings[i].length); fprintf (e, "\"\n"); @@ -2486,29 +2486,29 @@ f = versioninfo->fixed; if (f->file_version_ms != 0 || f->file_version_ls != 0) - fprintf (e, " FILEVERSION %lu, %lu, %lu, %lu\n", + fprintf (e, " FILEVERSION %u, %u, %u, %u\n", (f->file_version_ms >> 16) & 0xffff, f->file_version_ms & 0xffff, (f->file_version_ls >> 16) & 0xffff, f->file_version_ls & 0xffff); if (f->product_version_ms != 0 || f->product_version_ls != 0) - fprintf (e, " PRODUCTVERSION %lu, %lu, %lu, %lu\n", + fprintf (e, " PRODUCTVERSION %u, %u, %u, %u\n", (f->product_version_ms >> 16) & 0xffff, f->product_version_ms & 0xffff, (f->product_version_ls >> 16) & 0xffff, f->product_version_ls & 0xffff); if (f->file_flags_mask != 0) - fprintf (e, " FILEFLAGSMASK 0x%lx\n", f->file_flags_mask); + fprintf (e, " FILEFLAGSMASK 0x%x\n", f->file_flags_mask); if (f->file_flags != 0) - fprintf (e, " FILEFLAGS 0x%lx\n", f->file_flags); + fprintf (e, " FILEFLAGS 0x%x\n", f->file_flags); if (f->file_os != 0) - fprintf (e, " FILEOS 0x%lx\n", f->file_os); + fprintf (e, " FILEOS 0x%x\n", f->file_os); if (f->file_type != 0) - fprintf (e, " FILETYPE 0x%lx\n", f->file_type); + fprintf (e, " FILETYPE 0x%x\n", f->file_type); if (f->file_subtype != 0) - fprintf (e, " FILESUBTYPE 0x%lx\n", f->file_subtype); + fprintf (e, " FILESUBTYPE 0x%x\n", f->file_subtype); if (f->file_date_ms != 0 || f->file_date_ls != 0) - fprintf (e, "// Date: %lu, %lu\n", f->file_date_ms, f->file_date_ls); + fprintf (e, "// Date: %u, %u\n", f->file_date_ms, f->file_date_ls); fprintf (e, "BEGIN\n"); @@ -2568,13 +2568,13 @@ /* Write out data which would normally be read from a file. */ static void -write_rc_filedata (FILE *e, unsigned long length, const unsigned char *data) +write_rc_filedata (FILE *e, unsigned int length, const unsigned char *data) { - unsigned long i; + unsigned int i; for (i = 0; i + 15 < length; i += 16) { - fprintf (e, "// %4lx: ", i); + fprintf (e, "// %4x: ", i); fprintf (e, "%02x %02x %02x %02x %02x %02x %02x %02x ", data[i + 0], data[i + 1], data[i + 2], data[i + 3], data[i + 4], data[i + 5], data[i + 6], data[i + 7]); @@ -2585,7 +2585,7 @@ if (i < length) { - fprintf (e, "// %4lx:", i); + fprintf (e, "// %4x:", i); while (i < length) { fprintf (e, " %02x", data[i]); Index: resres.c =================================================================== RCS file: /cvs/src/src/binutils/resres.c,v retrieving revision 1.7 diff -B -b -u -r1.7 resres.c --- resres.c 16 Jun 2005 09:18:19 -0000 1.7 +++ resres.c 16 Apr 2007 09:13:39 -0000 @@ -33,8 +33,8 @@ struct res_hdr { - unsigned long data_size; - unsigned long header_size; + unsigned int data_size; + unsigned int header_size; }; static void write_res_directory @@ -52,7 +52,7 @@ static void write_res_info PARAMS ((const struct res_res_info *)); static void write_res_data PARAMS ((const void *, size_t, int)); static void write_res_header - PARAMS ((unsigned long, const struct res_id *, const struct res_id *, + PARAMS ((unsigned int, const struct res_id *, const struct res_id *, const struct res_res_info *)); static int read_resource_entry PARAMS ((void)); @@ -61,7 +61,7 @@ static unichar *read_unistring PARAMS ((int *)); static void skip_null_resource PARAMS ((void)); -static unsigned long get_id_size PARAMS ((const struct res_id *)); +static unsigned int get_id_size PARAMS ((const struct res_id *)); static void res_align_file PARAMS ((void)); static void @@ -219,7 +219,7 @@ /* If we're at level 3, then this key represents a language. Use it to update the current language. */ if (!re->id.named - && re->id.u.id != (unsigned long) *language + && re->id.u.id != (unsigned int) *language && (re->id.u.id & 0xffff) == re->id.u.id) { *language = re->id.u.id; @@ -331,7 +331,7 @@ if (rt != 0 && type != NULL - && (type->named || type->u.id != (unsigned long) rt)) + && (type->named || type->u.id != (unsigned int) rt)) { fprintf (stderr, "// Unexpected resource type mismatch: "); res_id_print (stderr, *type, 1); @@ -351,7 +351,7 @@ const struct res_id *name; const struct res_res_info *resinfo; { - unsigned long datasize = 0; + unsigned int datasize = 0; const struct bindata *bin_rep, *data; bin_rep = res_to_bin (res, 0); @@ -365,7 +365,7 @@ } /* Get number of bytes needed to store an id in binary format */ -static unsigned long +static unsigned int get_id_size (id) const struct res_id *id; { @@ -378,7 +378,7 @@ /* Write a resource header */ static void write_res_header (datasize, type, name, resinfo) - unsigned long datasize; + unsigned int datasize; const struct res_id *type; const struct res_id *name; const struct res_res_info *resinfo; @@ -430,7 +430,7 @@ { if (id->named) { - unsigned long len = id->u.n.length; + unsigned int len = id->u.n.length; unichar null_term = 0; write_res_data (id->u.n.name, len * sizeof (unichar), 1); write_res_data (&null_term, sizeof (null_term), 1); @@ -586,7 +586,7 @@ if (*resources == NULL) { - static unsigned long timeval; + static unsigned int timeval; /* Use the same timestamp for every resource created in a single run. */ Index: windres.c =================================================================== RCS file: /cvs/src/src/binutils/windres.c,v retrieving revision 1.28 diff -B -b -u -r1.28 windres.c --- windres.c 17 Feb 2007 13:33:54 -0000 1.28 +++ windres.c 16 Apr 2007 09:13:39 -0000 @@ -263,7 +263,7 @@ res_id_print (FILE *stream, struct res_id id, int quote) { if (! id.named) - fprintf (stream, "%lu", id.u.id); + fprintf (stream, "%u", id.u.id); else { if (quote) @@ -320,12 +320,12 @@ if (*resources == NULL) { - static unsigned long timeval; + static unsigned int timeval; /* Use the same timestamp for every resource created in a single run. */ if (timeval == 0) - timeval = time (NULL); + timeval = (unsigned int) time (NULL); *resources = ((struct res_directory *) res_alloc (sizeof **resources)); @@ -756,6 +756,9 @@ struct res_directory *resources; int use_temp_file; + /* TODO: Test that sizeof int has 4 byte size. */ + assert (sizeof (int) == 4); + #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif Index: windres.h =================================================================== RCS file: /cvs/src/src/binutils/windres.h,v retrieving revision 1.14 diff -B -b -u -r1.14 windres.h --- windres.h 8 May 2005 14:17:39 -0000 1.14 +++ windres.h 16 Apr 2007 09:13:40 -0000 @@ -35,9 +35,9 @@ { /* Resource flags. According to the MS docs, this is currently always zero. */ - unsigned long characteristics; + unsigned int characteristics; /* Time/date stamp. */ - unsigned long time; + unsigned int time; /* Major version number. */ unsigned short major; /* Minor version number. */ @@ -63,7 +63,7 @@ unichar *name; } n; /* If the named field is zero, this is the ID. */ - unsigned long id; + unsigned int id; } u; }; @@ -127,11 +127,11 @@ COFF file, the res_directory structure has a characteristics field, but I don't know if it's related to the one in the res file. */ - unsigned long characteristics; + unsigned int characteristics; /* Version of the resource. Entirely user defined. In a COFF file, the res_directory structure has a characteristics field, but I don't know if it's related to the one in the res file. */ - unsigned long version; + unsigned int version; /* Memory flags. This is a combination of the MEMFLAG values defined below. Most of these values are historical, and are not meaningful for win32. I don't think there is any way to store @@ -146,11 +146,11 @@ { /* The code page used for the data. I don't really know what this should be. */ - unsigned long codepage; + unsigned int codepage; /* A resource entry in a COFF file has a reserved field, which we record here when reading a COFF file. When writing a COFF file, we set this field to zero. */ - unsigned long reserved; + unsigned int reserved; }; /* Resource data is stored in a res_resource structure. */ @@ -164,7 +164,7 @@ { struct { - unsigned long length; + unsigned int length; const unsigned char *data; } data; struct accelerator *acc; @@ -250,7 +250,7 @@ /* Y coordinate of hotspot. */ short yhotspot; /* Length of bitmap data. */ - unsigned long length; + unsigned int length; /* Data. */ const unsigned char *data; }; @@ -270,7 +270,7 @@ /* Bits per pixel. */ unsigned short bits; /* Number of bytes in cursor resource. */ - unsigned long bytes; + unsigned int bytes; /* Index of cursor resource. */ unsigned short index; }; @@ -280,9 +280,9 @@ struct dialog { /* Basic window style. */ - unsigned long style; + unsigned int style; /* Extended window style. */ - unsigned long exstyle; + unsigned int exstyle; /* X coordinate. */ unsigned short x; /* Y coordinate. */ @@ -312,7 +312,7 @@ struct dialog_ex { /* Help ID. */ - unsigned long help; + unsigned int help; /* Font weight. */ unsigned short weight; /* Whether the font is italic. */ @@ -482,9 +482,9 @@ /* ID. */ unsigned short id; /* Style. */ - unsigned long style; + unsigned int style; /* Extended style. */ - unsigned long exstyle; + unsigned int exstyle; /* X coordinate. */ unsigned short x; /* Y coordinate. */ @@ -500,7 +500,7 @@ /* Extra data for the window procedure. */ struct rcdata_item *data; /* Help ID. Only used in an extended dialog. */ - unsigned long help; + unsigned int help; }; /* Control classes. These can be used as the ID field in a struct @@ -521,7 +521,7 @@ /* Index of font entry. */ short index; /* Length of font information. */ - unsigned long length; + unsigned int length; /* Font information. */ const unsigned char *data; }; @@ -543,7 +543,7 @@ /* Bits per pixel. */ unsigned short bits; /* Number of bytes in cursor resource. */ - unsigned long bytes; + unsigned int bytes; /* Index of cursor resource. */ unsigned short index; }; @@ -556,7 +556,7 @@ struct menuitem *items; /* Help ID. I don't think there is any way to set this in an rc file, but it can appear in the binary format. */ - unsigned long help; + unsigned int help; }; /* A menu resource is a list of menuitem structures. */ @@ -567,9 +567,9 @@ struct menuitem *next; /* Type. In a normal menu, rather than a menuex, this is the flags field. */ - unsigned long type; + unsigned int type; /* State. This is only used in a menuex. */ - unsigned long state; + unsigned int state; /* Id. */ unsigned short id; /* Unicode text. */ @@ -577,7 +577,7 @@ /* Popup menu items for a popup. */ struct menuitem *popup; /* Help ID. This is only used in a menuex. */ - unsigned long help; + unsigned int help; }; /* Menu item flags. These can appear in the flags field of a struct @@ -613,20 +613,20 @@ union { unsigned int word; - unsigned long dword; + unsigned int dword; struct { - unsigned long length; + unsigned int length; const char *s; } string; struct { - unsigned long length; + unsigned int length; const unichar *w; } wstring; struct { - unsigned long length; + unsigned int length; const unsigned char *data; } buffer; } u; @@ -661,24 +661,24 @@ struct fixed_versioninfo { /* The file version, which is two 32 bit integers. */ - unsigned long file_version_ms; - unsigned long file_version_ls; + unsigned int file_version_ms; + unsigned int file_version_ls; /* The product version, which is two 32 bit integers. */ - unsigned long product_version_ms; - unsigned long product_version_ls; + unsigned int product_version_ms; + unsigned int product_version_ls; /* The file flags mask. */ - unsigned long file_flags_mask; + unsigned int file_flags_mask; /* The file flags. */ - unsigned long file_flags; + unsigned int file_flags; /* The OS type. */ - unsigned long file_os; + unsigned int file_os; /* The file type. */ - unsigned long file_type; + unsigned int file_type; /* The file subtype. */ - unsigned long file_subtype; + unsigned int file_subtype; /* The date, which in Windows is two 32 bit integers. */ - unsigned long file_date_ms; - unsigned long file_date_ls; + unsigned int file_date_ms; + unsigned int file_date_ls; }; /* A list of variable version information. */ @@ -742,7 +742,7 @@ /* Next data. */ struct bindata *next; /* Length of data. */ - unsigned long length; + unsigned int length; /* Data. */ unsigned char *data; }; @@ -761,7 +761,7 @@ (const char *, const char *, const struct res_directory *); extern struct res_resource *bin_to_res - (struct res_id, const unsigned char *, unsigned long, int); + (struct res_id, const unsigned char *, unsigned int, int); extern struct bindata *res_to_bin (const struct res_resource *, int); extern FILE *open_file_search @@ -812,11 +812,11 @@ extern void define_dialog (struct res_id, const struct res_res_info *, const struct dialog *); extern struct dialog_control *define_control - (const struct res_id, unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long, unsigned long, unsigned long, unsigned long); + (const struct res_id, unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int, unsigned int, unsigned int, unsigned int); extern struct dialog_control *define_icon_control - (struct res_id, unsigned long, unsigned long, unsigned long, unsigned long, - unsigned long, unsigned long, struct rcdata_item *, struct dialog_ex *); + (struct res_id, unsigned int, unsigned int, unsigned int, unsigned int, + unsigned int, unsigned int, struct rcdata_item *, struct dialog_ex *); extern void define_font (struct res_id, const struct res_res_info *, const char *); extern void define_icon @@ -824,7 +824,7 @@ extern void define_menu (struct res_id, const struct res_res_info *, struct menuitem *); extern struct menuitem *define_menuitem - (const char *, int, unsigned long, unsigned long, unsigned long, + (const char *, int, unsigned int, unsigned int, unsigned int, struct menuitem *); extern void define_messagetable (struct res_id, const struct res_res_info *, const char *); @@ -833,10 +833,10 @@ extern void define_rcdata_file (struct res_id, const struct res_res_info *, const char *); extern struct rcdata_item *define_rcdata_string - (const char *, unsigned long); -extern struct rcdata_item *define_rcdata_number (unsigned long, int); + (const char *, unsigned int); +extern struct rcdata_item *define_rcdata_number (unsigned int, int); extern void define_stringtable - (const struct res_res_info *, unsigned long, const char *); + (const struct res_res_info *, unsigned int, const char *); extern void define_user_data (struct res_id, struct res_id, const struct res_res_info *, struct rcdata_item *); @@ -851,4 +851,4 @@ extern struct ver_stringinfo *append_verval (struct ver_stringinfo *, const char *, const char *); extern struct ver_varinfo *append_vertrans - (struct ver_varinfo *, unsigned long, unsigned long); + (struct ver_varinfo *, unsigned int, unsigned int); =