/* resres.c: read_res_file and write_res_file implementation for windres.
- Copyright 1998, 1999 Free Software Foundation, Inc.
+ Copyright 1998, 1999, 2001, 2002 Free Software Foundation, Inc.
Written by Anders Norlander <anorland@hem2.passagen.se>.
This file is part of GNU Binutils.
case 2:
/* If we're at level 2, the key of this resource is the name
- we are going to use in the rc printout. */
+ we are going to use in the rc printout. */
name = &re->id;
break;
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);
}
/* read a resource identifier */
-void
+void
read_res_id (id)
struct res_id *id;
{
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);
}