/* resbin.c -- manipulate the Windows binary resource format.
- Copyright 1997, 1998, 1999, 2002, 2003, 2007
+ Copyright 1997, 1998, 1999, 2002, 2003, 2005, 2006, 2007, 2009
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
Rewritten by Kai Tietz, Onevision.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
+ the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
+
/* This file contains functions to convert between the binary resource
format and the internal structures that we want to use. The same
binary resource format is used in both res and COFF files. */
{
rc_res_resource *r;
rc_menu *m;
- rc_uint_type version, read;
+ rc_uint_type version, got;
r = (rc_res_resource *) res_alloc (sizeof *r);
r->type = RES_TYPE_MENU;
if (length < 4)
toosmall (_("menu header"));
m->help = 0;
- m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &read);
+ m->items = bin_to_res_menuitems (wrbfd, data + 4, length - 4, &got);
}
else if (version == 1)
{
if (offset + 4 >= length)
toosmall (_("menuex offset"));
m->items = bin_to_res_menuexitems (wrbfd, data + 4 + offset,
- length - (4 + offset), &read);
+ length - (4 + offset), &got);
}
else
fatal (_("unsupported menu version %d"), (int) version);
static rc_menuitem *
bin_to_res_menuitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length,
- rc_uint_type *read)
+ rc_uint_type *got)
{
rc_menuitem *first, **pp;
first = NULL;
pp = &first;
- *read = 0;
+ *got = 0;
while (length > 0)
{
data += itemlen;
length -= itemlen;
- *read += itemlen;
+ *got += itemlen;
if ((flags & MENUITEM_ENDMENU) != 0)
return first;
static rc_menuitem *
bin_to_res_menuexitems (windres_bfd *wrbfd, const bfd_byte *data, rc_uint_type length,
- rc_uint_type *read)
+ rc_uint_type *got)
{
rc_menuitem *first, **pp;
first = NULL;
pp = &first;
- *read = 0;
+ *got = 0;
while (length > 0)
{
data += itemlen;
length -= itemlen;
- *read += itemlen;
+ *got += itemlen;
if ((flags & 0x80) != 0)
return first;