From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11654 invoked by alias); 11 Apr 2007 17:34:23 -0000 Received: (qmail 11635 invoked by uid 22791); 11 Apr 2007 17:34:20 -0000 X-Spam-Check-By: sourceware.org Received: from outdoor.onevision.de (HELO outdoor.onevision.de) (212.77.172.51) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 11 Apr 2007 18:34:08 +0100 Received: from sanders.onevision.de (moonrace [212.77.172.62]) by outdoor.onevision.de (8.13.7/8.13.7/ROSCH/DDB) with ESMTP id l3BHXbHi019692; Wed, 11 Apr 2007 19:33:42 +0200 In-Reply-To: <20070411140740.GB3214@lucon.org> To: "H. J. Lu" Cc: binutils@sources.redhat.com Subject: PATCH: windres MIME-Version: 1.0 X-Mailer: Lotus Notes Release 7.0.1 January 17, 2006 Message-ID: From: Kai Tietz Date: Wed, 11 Apr 2007 18:22:00 -0000 Content-Type: multipart/mixed; boundary="=_mixed 00607443C12572BA_=" X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2007-04/txt/msg00134.txt.bz2 --=_mixed 00607443C12572BA_= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: base64 Content-length: 1851 SGVsbG8sDQoNCkkgaGF2ZSBpc29sYXRlZCB0aGUgd2luZHJlcyBwYXRjaCBm cm9tIHRoZSB3NjQgb25lLg0KDQpDaGFuZ2VMb2c6DQoNCjIwMDctMDQtMTEg S2FpIFRpZXR6ICA8a2FpLnRpZXR6QG9uZXZpc2lvbi5jb20+DQoNCiAgICAg ICAgKiBiaW51dGlscy9yZXNyZXMuYzogQ2FzdCBzaXplb2YgZXhwbGljaXQg dG8gdHlwZSAibG9uZyIuDQogICAgICAgIChyZXNfaGRyKTogQ2hhbmdlZCB0 byB1c2UgaW50IGluc3RlYWQgb2YgbG9uZy4NCiAgICAgICAgKHJlc3Jlc19o b3N0X2JpZ2VuZGlhbiwgSE9TVF9JU0JJR0VORElBTik6IENoZWNrIGZvcg0K ICAgICAgICBiaWcgZW5kaWFuIGhvc3RzLg0KICAgICAgICAod3JpdGVfcmVz X2RhdGFfMTYsIHdyaXRlX3Jlc19kYXRhXzMyLCB3cml0ZV9yZXNfZGF0YV9y ZXNfaGRyLA0KICAgICAgICAgcmVhZF9yZXNfZGF0YV8xNiwgcmVhZF9yZXNf ZGF0YV8zMiwgcmVhZF9yZXNfZGF0YV9yZXNfaGRyKTogTmV3Lg0KICAgICAg ICAqIGJpbnV0aWxzL3Jlc3JjLmM6IEFkanVzdCBwcmludGYgZm9ybWF0dGVy IGZvciBpbnRzLg0KICAgICAgICAqIGJpbnV0aWxzL3dpbmRyZXMuYzogKG1h aW4pOiBBc3NlcnQgaWYgc2l6ZW9mKGludCkgbm90IDQgYnl0ZXMuDQogICAg ICAgICogYmludXRpbHMvd2luZHJlcy5oOiBDaGFuZ2VkIHdpbmRvd3Mgc3Ry dWN0dXJlIHRvIHVzZQ0KICAgICAgICBpbnQgdHlwZSBpbnN0ZWFkIG9mIGxv bmcgdHlwZS4NCg0KUmVnYXJkcywNCiBpLkEuIEthaSBUaWV0eg0KDQoNCi0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0K ICBPbmVWaXNpb24gU29mdHdhcmUgRW50d2lja2x1bmdzIEdtYkggJiBDby4g S0cNCiAgRHIuLUxlby1SaXR0ZXItU3RyYcOfZSA5IC0gOTMwNDkgUmVnZW5z YnVyZw0KICBUZWw6ICs0OS4oMCk5NDEuNzgwMDQuMCAtIEZheDogKzQ5Ligw KTk0MS43ODAwNC40ODkgLSB3d3cuT25lVmlzaW9uLmNvbQ0KICBDb21tZXJ6 YmFuayBSZWdlbnNidXJnIC0gQkxaIDc1MCA0MDAgNjIgLSBLb250byA2MDEx MDUwDQogIEhhbmRlbHNyZWdpc3RlcjogSFJBIDY3NDQsIEFtdHNnZXJpY2h0 IFJlZ2Vuc2J1cmcNCiAgS29tcGxlbWVudMOkcmluOiBPbmVWaXNpb24gU29m dHdhcmUgRW50d2lja2x1bmdzIFZlcndhbHR1bmdzIEdtYkgNCiAgRHIuLUxl by1SaXR0ZXItU3RyYcOfZSA5IOKAkyA5MzA0OSBSZWdlbnNidXJnDQogIEhh bmRlbHNyZWdpc3RlcjogSFJCIDg5MzIsIEFtdHNnZXJpY2h0IFJlZ2Vuc2J1 cmcgLSBHZXNjaMOkZnRzZsO8aHJlcjogDQpVbHJpa2UgRMO2aGxlciwgTWFu dWVsYSBLbHVnZXINCg== --=_mixed 00607443C12572BA_= Content-Type: text/plain; name="windres.txt" Content-Disposition: attachment; filename="windres.txt" Content-Transfer-Encoding: quoted-printable Content-length: 23209 Index: resrc.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/binutils/resrc.c,v retrieving revision 1.27 diff -b -u -r1.27 resrc.c --- resrc.c 8 May 2005 14:17:39 -0000 1.27 +++ resrc.c 11 Apr 2007 17:23:21 -0000 @@ -1515,9 +1515,9 @@ /* Print out some COFF information that rc files can't represent. */ =20 if (rd->time !=3D 0) - fprintf (e, "// Time stamp: %lu\n", rd->time); + fprintf (e, "// Time stamp: %u\n", rd->time); if (rd->characteristics !=3D 0) - fprintf (e, "// Characteristics: %lu\n", rd->characteristics); + fprintf (e, "// Characteristics: %u\n", rd->characteristics); if (rd->major !=3D 0 || rd->minor !=3D 0) fprintf (e, "// Version: %d %d\n", rd->major, rd->minor); =20 @@ -1546,7 +1546,7 @@ && re->id.u.id !=3D (unsigned long) (unsigned int) *language && (re->id.u.id & 0xffff) =3D=3D 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 =3D re->id.u.id; @@ -1774,9 +1774,9 @@ } =20 if (res->coff_info.codepage !=3D 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 !=3D 0) - fprintf (e, "// COFF reserved value: %lu\n", res->coff_info.reserved); + fprintf (e, "// COFF reserved value: %u\n", res->coff_info.reserved); =20 if (name !=3D NULL) res_id_print (e, *name, 0); @@ -1809,7 +1809,7 @@ res->u.dialog->width, res->u.dialog->height); if (res->u.dialog->ex !=3D NULL && res->u.dialog->ex->help !=3D 0) - fprintf (e, ", %lu", res->u.dialog->ex->help); + fprintf (e, ", %u", res->u.dialog->ex->help); } =20 fprintf (e, "\n"); @@ -1841,11 +1841,11 @@ res->res_info.language & ((1<res_info.language >> SUBLANG_SHIFT) & 0xff); if (res->res_info.characteristics !=3D 0) - fprintf (e, "%sCHARACTERISTICS %lu\n", + fprintf (e, "%sCHARACTERISTICS %u\n", modifiers ? "// " : "", res->res_info.characteristics); if (res->res_info.version !=3D 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; =20 - fprintf (e, "STYLE 0x%lx\n", dialog->style); + fprintf (e, "STYLE 0x%x\n", dialog->style); =20 if (dialog->exstyle !=3D 0) - fprintf (e, "EXSTYLE 0x%lx\n", dialog->exstyle); + fprintf (e, "EXSTYLE 0x%x\n", dialog->exstyle); =20 if ((dialog->class.named && dialog->class.u.n.length > 0) || dialog->class.u.id !=3D 0) @@ -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); } =20 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); =20 if (control->exstyle !=3D 0 || control->help !=3D 0) - fprintf (e, ", 0x%lx, %lu", control->exstyle, control->help); + fprintf (e, ", 0x%x, %u", control->exstyle, control->help); } =20 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 !=3D 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); } =20 @@ -2255,12 +2255,12 @@ fprintf (e, ", %d", mi->id); if (mi->type !=3D 0 || mi->state !=3D 0 || mi->help !=3D 0) { - fprintf (e, ", %lu", mi->type); + fprintf (e, ", %u", mi->type); if (mi->state !=3D 0 || mi->help !=3D 0) { - fprintf (e, ", %lu", mi->state); + fprintf (e, ", %u", mi->state); if (mi->help !=3D 0) - fprintf (e, ", %lu", mi->help); + fprintf (e, ", %u", mi->help); } } } @@ -2304,7 +2304,7 @@ break; =20 case RCDATA_DWORD: - fprintf (e, "%luL", ri->u.dword); + fprintf (e, "%uL", ri->u.dword); break; =20 case RCDATA_STRING: @@ -2486,29 +2486,29 @@ =20 f =3D versioninfo->fixed; if (f->file_version_ms !=3D 0 || f->file_version_ls !=3D 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 !=3D 0 || f->product_version_ls !=3D 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 !=3D 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 !=3D 0) - fprintf (e, " FILEFLAGS 0x%lx\n", f->file_flags); + fprintf (e, " FILEFLAGS 0x%x\n", f->file_flags); if (f->file_os !=3D 0) - fprintf (e, " FILEOS 0x%lx\n", f->file_os); + fprintf (e, " FILEOS 0x%x\n", f->file_os); if (f->file_type !=3D 0) - fprintf (e, " FILETYPE 0x%lx\n", f->file_type); + fprintf (e, " FILETYPE 0x%x\n", f->file_type); if (f->file_subtype !=3D 0) - fprintf (e, " FILESUBTYPE 0x%lx\n", f->file_subtype); + fprintf (e, " FILESUBTYPE 0x%x\n", f->file_subtype); if (f->file_date_ms !=3D 0 || f->file_date_ls !=3D 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); =20 fprintf (e, "BEGIN\n"); =20 Index: resres.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/binutils/resres.c,v retrieving revision 1.7 diff -b -u -r1.7 resres.c --- resres.c 16 Jun 2005 09:18:19 -0000 1.7 +++ resres.c 11 Apr 2007 17:23:21 -0000 @@ -33,10 +33,13 @@ =20 struct res_hdr { - unsigned long data_size; - unsigned long header_size; + unsigned int data_size; + unsigned int header_size; }; =20 +static unsigned int resres_host_bigendian =3D 0x12345678; +#define HOST_ISBIGENDIAN (((unsigned char *)&resres_host_bigendian)[0] != =3D 0x78 ? 1 : 0) + static void write_res_directory PARAMS ((const struct res_directory *, const struct res_id *, const struct res_id *, @@ -51,12 +54,18 @@ static void write_res_id PARAMS ((const struct res_id *)); 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_data_16 PARAMS ((unsigned short)); +static void write_res_data_32 PARAMS ((unsigned int)); static void write_res_header PARAMS ((unsigned long, const struct res_id *, const struct res_id *, const struct res_res_info *)); +static void write_res_data_res_hdr PARAMS ((struct res_hdr *)); =20 static int read_resource_entry PARAMS ((void)); static void read_res_data PARAMS ((void *, size_t, int)); +static void read_res_data_16 PARAMS ((void *)); +static void read_res_data_32 PARAMS ((void *)); +static int read_res_data_res_hdr PARAMS ((struct res_hdr *)); static void read_res_id PARAMS ((struct res_id *)); static unichar *read_unistring PARAMS ((int *)); static void skip_null_resource PARAMS ((void)); @@ -138,6 +147,34 @@ fclose (fres); } =20 +static void +write_res_data_res_hdr (reshdr) + struct res_hdr *reshdr; +{ + write_res_data_32 (reshdr->data_size); + write_res_data_32 (reshdr->header_size); +} + +static int +read_res_data_res_hdr (reshdr) + struct res_hdr *reshdr; +{ + char c[4]; + if (fread (c, 4, 1, fres) !=3D (size_t) 4) + return 0; + reshdr->data_size=3D(unsigned int) c[3]; reshdr->data_size<<=3D8; + reshdr->data_size|=3D(unsigned int) c[2]; reshdr->data_size<<=3D8; + reshdr->data_size|=3D(unsigned int) c[1]; reshdr->data_size<<=3D8; + reshdr->data_size|=3D(unsigned int) c[0]; + if (fread (c, 4, 1, fres) !=3D (size_t) 4) + return 0; + reshdr->header_size=3D(unsigned int) c[3]; reshdr->header_size<<=3D8; + reshdr->header_size|=3D(unsigned int) c[2]; reshdr->header_size<<=3D8; + reshdr->header_size|=3D(unsigned int) c[1]; reshdr->header_size<<=3D8; + reshdr->header_size|=3D(unsigned int) c[0]; + return 1; +} + /* Read a resource entry, returns 0 when all resources are read */ static int read_resource_entry (void) @@ -154,7 +191,7 @@ res_align_file (); =20 /* Read header */ - if (fread (&reshdr, sizeof (reshdr), 1, fres) !=3D 1) + if (read_res_data_res_hdr (&reshdr) !=3D 1) return 0; =20 /* read resource type */ @@ -165,11 +202,11 @@ res_align_file (); =20 /* Read additional resource header */ - read_res_data (&resinfo.version, sizeof (resinfo.version), 1); - read_res_data (&resinfo.memflags, sizeof (resinfo.memflags), 1); - read_res_data (&resinfo.language, sizeof (resinfo.language), 1); - read_res_data (&version, sizeof (version), 1); - read_res_data (&resinfo.characteristics, sizeof (resinfo.characteristics= ), 1); + read_res_data_32 (&resinfo.version); + read_res_data_16 (&resinfo.memflags); + read_res_data_16 (&resinfo.language); + read_res_data_32 (&version); + read_res_data_32 (&resinfo.characteristics); =20 res_align_file (); =20 @@ -178,7 +215,7 @@ /* Read data */ read_res_data (buff, reshdr.data_size, 1); /* Convert binary data to resource */ - r =3D bin_to_res (type, buff, reshdr.data_size, 0); + r =3D bin_to_res (type, buff, reshdr.data_size, HOST_ISBIGENDIAN); r->res_info =3D resinfo; /* Add resource to resource directory */ res_add_resource (r, &type, &name, resinfo.language, 0); @@ -354,7 +391,7 @@ unsigned long datasize =3D 0; const struct bindata *bin_rep, *data; =20 - bin_rep =3D res_to_bin (res, 0); + bin_rep =3D res_to_bin (res, HOST_ISBIGENDIAN); for (data =3D bin_rep; data !=3D NULL; data =3D data->next) datasize +=3D data->length; =20 @@ -390,7 +427,7 @@ reshdr.header_size =3D (reshdr.header_size + 3) & ~3; =20 res_align_file (); - write_res_data (&reshdr, sizeof (reshdr), 1); + write_res_data_res_hdr (&reshdr); write_res_id (type); write_res_id (name); =20 @@ -412,6 +449,32 @@ fatal ("%s: could not write to file", filename); } =20 +static void +write_res_data_16 (value) + unsigned short value; +{ + unsigned char c[2]; + c[1]=3D(unsigned char) ((value>>8)&0xff); + c[0]=3D(unsigned char) (value&0xff); +=20=20 + if ((size_t) fwrite (c, 2, 1, fres) !=3D (size_t) 2) + fatal ("%s: could not write to file", filename); +} + +static void +write_res_data_32 (value) + unsigned int value; +{ + unsigned char c[4]; + c[3]=3D(unsigned char) ((value>>24)&0xff); + c[2]=3D(unsigned char) ((value>>16)&0xff); + c[1]=3D(unsigned char) ((value>>8)&0xff); + c[0]=3D(unsigned char) (value&0xff); +=20=20 + if ((size_t) fwrite (c, 4, 1, fres) !=3D (size_t) 4) + fatal ("%s: could not write to file", filename); +} + /* Read data from file, abort on failure */ static void read_res_data (data, size, count) @@ -423,6 +486,34 @@ fatal ("%s: unexpected end of file", filename); } =20 +static void +read_res_data_16 (data) + void *data; +{ + unsigned char c[2]; + unsigned short v; + if (fread (data, 2, 1, fres) !=3D (size_t) 2) + fatal ("%s: unexpected end of file", filename); + v=3D(unsigned short) c[1]; v<<=3D8; + v|=3D(unsigned short) c[0]; + *((unsigned short *) data)=3Dv; +} + +static void +read_res_data_32 (data) + void *data; +{ + unsigned char c[4]; + unsigned int v; + if (fread (data, 4, 1, fres) !=3D (size_t) 4) + fatal ("%s: unexpected end of file", filename); + v=3D(unsigned int) c[3]; v<<=3D8; + v|=3D(unsigned int) c[2]; v<<=3D8; + v|=3D(unsigned int) c[1]; v<<=3D8; + v|=3D(unsigned int) c[0]; + *((unsigned int *) data)=3Dv; +} + /* Write a resource id */ static void write_res_id (id) @@ -437,10 +528,8 @@ } else { - unsigned short i =3D 0xFFFF; - write_res_data (&i, sizeof (i), 1); - i =3D id->u.id; - write_res_data (&i, sizeof (i), 1); + write_res_data_16 (0xFFFF); + write_res_data_16(id->u.id); } } =20 @@ -449,11 +538,11 @@ write_res_info (info) const struct res_res_info *info; { - write_res_data (&info->version, sizeof (info->version), 1); - write_res_data (&info->memflags, sizeof (info->memflags), 1); - write_res_data (&info->language, sizeof (info->language), 1); - write_res_data (&info->version, sizeof (info->version), 1); - write_res_data (&info->characteristics, sizeof (info->characteristics), = 1); + write_res_data_32 (info->version); + write_res_data_16 (info->memflags); + write_res_data_16 (info->language); + write_res_data_32 (info->version); + write_res_data_32 (info->characteristics); } =20 /* read a resource identifier */ @@ -465,17 +554,17 @@ unichar *id_s =3D NULL; int len; =20 - read_res_data (&ord, sizeof (ord), 1); + read_res_data_16 (&ord); if (ord =3D=3D 0xFFFF) /* an ordinal id */ { - read_res_data (&ord, sizeof (ord), 1); + read_res_data_16 (&ord); id->named =3D 0; id->u.id =3D ord; } else /* named id */ { - if (fseek (fres, -sizeof (ord), SEEK_CUR) !=3D 0) + if (fseek (fres, -2, SEEK_CUR) !=3D 0) fatal ("%s: %s: could not seek in file", program_name, filename); id_s =3D read_unistring (&len); id->named =3D 1; @@ -530,7 +619,7 @@ { struct res_hdr reshdr =3D {0, 0}; - read_res_data (&reshdr, sizeof (reshdr), 1); + read_res_data_res_hdr (&reshdr); if ((reshdr.data_size !=3D 0) || (reshdr.header_size !=3D 0x20)) goto skip_err; =20 Index: windres.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/binutils/windres.c,v retrieving revision 1.28 diff -b -u -r1.28 windres.c --- windres.c 17 Feb 2007 13:33:54 -0000 1.28 +++ windres.c 11 Apr 2007 17:23:22 -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 @@ =20 if (*resources =3D=3D NULL) { - static unsigned long timeval; + static unsigned int timeval; =20 /* Use the same timestamp for every resource created in a single run. */ if (timeval =3D=3D 0) - timeval =3D time (NULL); + timeval =3D (unsigned int) time (NULL); =20 *resources =3D ((struct res_directory *) res_alloc (sizeof **resources)); @@ -756,6 +756,9 @@ struct res_directory *resources; int use_temp_file; =20 + /* Check, that the type int has a size of 4 bytes, otherwise fail. */ + assert (sizeof (int) =3D=3D 4); + #if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES) setlocale (LC_MESSAGES, ""); #endif Index: windres.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvs/src/src/binutils/windres.h,v retrieving revision 1.14 diff -b -u -r1.14 windres.h --- windres.h 8 May 2005 14:17:39 -0000 1.14 +++ windres.h 11 Apr 2007 17:23:22 -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; }; =20 @@ -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; }; =20 /* 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; }; =20 /* 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; }; =20 /* 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; }; =20 /* 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; }; =20 /* 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; }; =3D= --=_mixed 00607443C12572BA_=--