X-Git-Url: http://drtracing.org/?a=blobdiff_plain;ds=sidebyside;f=binutils%2Fwindres.c;h=427e9823ce784edc6cd852cf3141b6cd998af2e5;hb=13aa5ceb01cc94a0e617f397c0c5434fc22bb1e5;hp=14cf11e66b15560bcd7104b975d8b3a0e190a5ca;hpb=137d1369ac054744d27f19e95aa8a739e6c0068d;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/windres.c b/binutils/windres.c index 14cf11e66b..427e9823ce 100644 --- a/binutils/windres.c +++ b/binutils/windres.c @@ -1,5 +1,5 @@ /* windres.c -- a program to manipulate Windows resources - Copyright (C) 1997-2014 Free Software Foundation, Inc. + Copyright (C) 1997-2020 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. Rewritten by Kai Tietz, Onevision. @@ -704,8 +704,7 @@ quot (const char *string) if ((buflen < slen * 2 + 2) || ! buf) { buflen = slen * 2 + 2; - if (buf) - free (buf); + free (buf); buf = (char *) xmalloc (buflen); } @@ -808,10 +807,12 @@ main (int argc, char **argv) program_name = argv[0]; xmalloc_set_program_name (program_name); + bfd_set_error_program_name (program_name); expandargv (&argc, &argv); - bfd_init (); + if (bfd_init () != BFD_INIT_MAGIC) + fatal (_("fatal error: libbfd ABI mismatch")); set_default_bfd_target (); res_init (); @@ -938,7 +939,7 @@ main (int argc, char **argv) { struct stat statbuf; char modebuf[11]; - + if (stat (optarg, & statbuf) == 0 /* Coded this way to avoid importing knowledge of S_ISDIR into this file. */ && (mode_string (statbuf.st_mode, modebuf), modebuf[0] == 'd')) @@ -1115,7 +1116,7 @@ windres_open_as_binary (const char *filename, int rdmode) if (rdmode && ! bfd_check_format (abfd, bfd_object)) fatal ("can't open `%s' for input.", filename); - + return abfd; } @@ -1310,7 +1311,7 @@ static rc_uint_type target_get_8 (const void *p, rc_uint_type length) { rc_uint_type ret; - + if (length < 1) fatal ("Resource too small for getting 8-bit value."); @@ -1323,7 +1324,7 @@ target_get_16 (const void *p, rc_uint_type length) { if (length < 2) fatal ("Resource too small for getting 16-bit value."); - + if (target_is_bigendian) return bfd_getb16 (p); else @@ -1335,7 +1336,7 @@ target_get_32 (const void *p, rc_uint_type length) { if (length < 4) fatal ("Resource too small for getting 32-bit value."); - + if (target_is_bigendian) return bfd_getb32 (p); else @@ -1353,7 +1354,7 @@ static void target_put_16 (void *p, rc_uint_type value) { assert (!! p); - + if (target_is_bigendian) bfd_putb16 (value, p); else @@ -1364,7 +1365,7 @@ static void target_put_32 (void *p, rc_uint_type value) { assert (!! p); - + if (target_is_bigendian) bfd_putb32 (value, p); else @@ -1403,5 +1404,5 @@ int wr_print (FILE *e, const char *fmt, ...) va_start (arg, fmt); r += vfprintf (e, fmt, arg); va_end (arg); - return r; + return r; }