diff options
author | Nick Clifton <nickc@redhat.com> | 2011-10-11 15:56:29 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2011-10-11 15:56:29 +0000 |
commit | bfb6c1ab1ed502faa7c3764722a1f1661f6d44e8 (patch) | |
tree | 1d8de29dde516f5b030ce2a485fa33e458477bd5 /binutils/resrc.c | |
parent | 941b2081b1fd085fff7d323448672cedf18258db (diff) | |
download | fsf-binutils-gdb-bfb6c1ab1ed502faa7c3764722a1f1661f6d44e8.zip fsf-binutils-gdb-bfb6c1ab1ed502faa7c3764722a1f1661f6d44e8.tar.gz fsf-binutils-gdb-bfb6c1ab1ed502faa7c3764722a1f1661f6d44e8.tar.bz2 |
PR binutils/13051
Fix a syntax error bug when compiling rc files with the VERSIONINFO resource
containing more than one language block inside a single StringFileInfo block.
* windint.h (rc_ver_stringtable): New structure definition.
(rc_ver_info): Use it.
* rcparse.y (verstringtable): New variable.
(verstringtables): New type.
(verstringtables:): New rule declaration.
(verblocks:): Use it.
* resrc.c (append_ver_stringtable): New function.
(append_ver_stringfileinfo): Update to use stringtables.
* windres.h (append_ver_stringfileinfo): Update declaration.
(append_ver_stringtable): New declaration.
* resrc.c (write_rc_versioninfo): Update to support multiple blocks.
* resbin.c (bin_to_res_version): Likewise.
(res_to_bin_versioninfo): Likewise.
* binutils-all\windres\version.rsd: Regenerate.
* binutils-all\windres\version_cat.rsd: Regenerate.
* binutils-all\windres\version_mlang.rc: Add new test.
* binutils-all\windres\version_mlang.rsd: Likewise.
Diffstat (limited to 'binutils/resrc.c')
-rw-r--r-- | binutils/resrc.c | 56 |
1 files changed, 40 insertions, 16 deletions
diff --git a/binutils/resrc.c b/binutils/resrc.c index 0a14ad2..a0308df 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -1,5 +1,5 @@ /* resrc.c -- read and write Windows rc files. - Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008 + Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008, 2011 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -1803,16 +1803,15 @@ define_versioninfo (rc_res_id id, rc_uint_type language, /* Add string version info to a list of version information. */ rc_ver_info * -append_ver_stringfileinfo (rc_ver_info *verinfo, const char *language, - rc_ver_stringinfo *strings) +append_ver_stringfileinfo (rc_ver_info *verinfo, + rc_ver_stringtable *stringtables) { rc_ver_info *vi, **pp; vi = (rc_ver_info *) res_alloc (sizeof (rc_ver_info)); vi->next = NULL; vi->type = VERINFO_STRING; - unicode_from_ascii ((rc_uint_type *) NULL, &vi->u.string.language, language); - vi->u.string.strings = strings; + vi->u.string.stringtables = stringtables; for (pp = &verinfo; *pp != NULL; pp = &(*pp)->next) ; @@ -1821,6 +1820,25 @@ append_ver_stringfileinfo (rc_ver_info *verinfo, const char *language, return verinfo; } +rc_ver_stringtable * +append_ver_stringtable (rc_ver_stringtable *stringtable, + const char *language, + rc_ver_stringinfo *strings) +{ + rc_ver_stringtable *vst, **pp; + + vst = (rc_ver_stringtable *) res_alloc (sizeof (rc_ver_stringtable)); + vst->next = NULL; + unicode_from_ascii ((rc_uint_type *) NULL, &vst->language, language); + vst->strings = strings; + + for (pp = &stringtable; *pp != NULL; pp = &(*pp)->next) + ; + *pp = vst; + + return stringtable; +} + /* Add variable version info to a list of version information. */ rc_ver_info * @@ -3264,25 +3282,31 @@ write_rc_versioninfo (FILE *e, const rc_versioninfo *versioninfo) { case VERINFO_STRING: { + const rc_ver_stringtable *vst; const rc_ver_stringinfo *vs; fprintf (e, " BLOCK \"StringFileInfo\"\n"); fprintf (e, " BEGIN\n"); - fprintf (e, " BLOCK "); - unicode_print_quoted (e, vi->u.string.language, -1); - fprintf (e, "\n"); - fprintf (e, " BEGIN\n"); - for (vs = vi->u.string.strings; vs != NULL; vs = vs->next) + for (vst = vi->u.string.stringtables; vst != NULL; vst = vst->next) { - fprintf (e, " VALUE "); - unicode_print_quoted (e, vs->key, -1); - fprintf (e, ", "); - unicode_print_quoted (e, vs->value, -1); + fprintf (e, " BLOCK "); + unicode_print_quoted (e, vst->language, -1); + fprintf (e, "\n"); - } + fprintf (e, " BEGIN\n"); + + for (vs = vst->strings; vs != NULL; vs = vs->next) + { + fprintf (e, " VALUE "); + unicode_print_quoted (e, vs->key, -1); + fprintf (e, ", "); + unicode_print_quoted (e, vs->value, -1); + fprintf (e, "\n"); + } - fprintf (e, " END\n"); + fprintf (e, " END\n"); + } fprintf (e, " END\n"); break; } |