diff options
author | DJ Delorie <dj@delorie.com> | 2001-07-17 03:14:49 +0000 |
---|---|---|
committer | DJ Delorie <dj@delorie.com> | 2001-07-17 03:14:49 +0000 |
commit | e8a52e5f7baac58a1625b11e534aa28ce72964c5 (patch) | |
tree | 08d09cf83df4f5dcda88e4d6158b1aa7cf1b9af9 | |
parent | 37536cad9c31c0ce147236e9ba0571ef6803f8e0 (diff) | |
download | binutils-redhat-e8a52e5f7baac58a1625b11e534aa28ce72964c5.tar.gz |
* resres.c (write_res_header): Align header size.
(res_align_file): Calculate alignment correctly.
-rw-r--r-- | binutils/ChangeLog | 3 | ||||
-rw-r--r-- | binutils/resres.c | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 40ca327593..c5a62a2cec 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,5 +1,8 @@ 2001-07-16 DJ Delorie <dj@redhat.com> + * resres.c (write_res_header): Align header size. + (res_align_file): Calculate alignment correctly. + * rcparse.y (styles): use SUBLANG_SHIFT instead of 8 (or the more correct 10). * resrc.c (write_rc_resource): Likewise. diff --git a/binutils/resres.c b/binutils/resres.c index 6a860eb2ae..616772e55c 100644 --- a/binutils/resres.c +++ b/binutils/resres.c @@ -387,6 +387,8 @@ write_res_header (datasize, type, name, resinfo) reshdr.data_size = datasize; reshdr.header_size = 24 + get_id_size (type) + get_id_size (name); + reshdr.header_size = (reshdr.header_size + 3) & ~3; + res_align_file (); write_res_data (&reshdr, sizeof (reshdr), 1); write_res_id (type); @@ -513,7 +515,9 @@ read_unistring (len) static void res_align_file (void) { - if (fseek (fres, ftell (fres) % 4, SEEK_CUR) != 0) + int pos = ftell (fres); + int skip = ((pos + 3) & ~3) - pos; + if (fseek (fres, skip, SEEK_CUR) != 0) fatal ("%s: %s: unable to align file", program_name, filename); } |