X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Fresrc.c;h=a0308dfd902a974d2fbee7ae1b5ecf87989a857a;hb=977888b9906f450cc0f3f2ecf917e7b33aaf1217;hp=8a5900bdc489bc86041cfd5898b3a3ee733ea8d7;hpb=c7f0a8e098119312e57c77969a0c6646abfd2040;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/resrc.c b/binutils/resrc.c index 8a5900bdc4..a0308dfd90 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 + 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. @@ -281,7 +281,7 @@ run_cmd (char *cmd, const char *redir) if (pid == -1) { - fatal (_("%s %s: %s"), errmsg_fmt, errmsg_arg, strerror (errno)); + fatal ("%s %s: %s", errmsg_fmt, errmsg_arg, strerror (errno)); return 1; } @@ -628,7 +628,7 @@ yyerror (const char *msg) void rcparse_warning (const char *msg) { - fprintf (stderr, _("%s:%d: %s\n"), rc_filename, rc_lineno, msg); + fprintf (stderr, "%s:%d: %s\n", rc_filename, rc_lineno, msg); } /* Die if we get an unexpected end of file. */ @@ -685,7 +685,8 @@ get_data (FILE *e, bfd_byte *p, rc_uint_type c, const char *msg) if (got == c) return; - fatal (_("%s: read of %lu returned %lu"), msg, (long) c, (long) got); + fatal (_("%s: read of %lu returned %lu"), + msg, (unsigned long) c, (unsigned long) got); } /* Define an accelerator resource. */ @@ -1802,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) ; @@ -1820,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 * @@ -1925,7 +1944,7 @@ indent (FILE *e, int c) without the need to store it somewhere externally. */ void -write_rc_file (const char *filename, const rc_res_directory *resources) +write_rc_file (const char *filename, const rc_res_directory *res_dir) { FILE *e; rc_uint_type language; @@ -1940,7 +1959,7 @@ write_rc_file (const char *filename, const rc_res_directory *resources) } language = (rc_uint_type) ((bfd_signed_vma) -1); - write_rc_directory (e, resources, (const rc_res_id *) NULL, + write_rc_directory (e, res_dir, (const rc_res_id *) NULL, (const rc_res_id *) NULL, &language, 1); } @@ -3061,10 +3080,10 @@ write_rc_datablock (FILE *e, rc_uint_type length, const bfd_byte *data, int has_ { if (k == 0) plen = fprintf (e, "0x%lxL", - (long) windres_get_32 (&wrtarget, data + i, length - i)); + (unsigned long) windres_get_32 (&wrtarget, data + i, length - i)); else plen = fprintf (e, " 0x%lxL", - (long) windres_get_32 (&wrtarget, data + i, length - i)) - 1; + (unsigned long) windres_get_32 (&wrtarget, data + i, length - i)) - 1; if (has_next || (i + 4) < length) { if (plen>0 && plen < 11) @@ -3210,7 +3229,7 @@ write_rc_stringtable (FILE *e, const rc_res_id *name, { if (stringtable->strings[i].length != 0) { - fprintf (e, " %lu, ", (long) offset + i); + fprintf (e, " %lu, ", (unsigned long) offset + i); unicode_print_quoted (e, stringtable->strings[i].string, stringtable->strings[i].length); fprintf (e, "\n"); @@ -3263,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; }