X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=bfd%2Fcoff-ia64.c;h=76d1bf6cc5e578221245ca4b3f25b7cfa2b1f757;hb=8513dd2d37a6265302833384f327f064ebc569e3;hp=8452d961870211e21b0f61d19ec390f1cc883c75;hpb=cea4409c0f8e075b69aa75a7a73d8b5ff67937a9;p=deliverable%2Fbinutils-gdb.git diff --git a/bfd/coff-ia64.c b/bfd/coff-ia64.c index 8452d96187..76d1bf6cc5 100644 --- a/bfd/coff-ia64.c +++ b/bfd/coff-ia64.c @@ -77,9 +77,9 @@ ia64coff_object_p (abfd) struct external_PEI_IMAGE_hdr image_hdr; file_ptr offset; - if (bfd_seek (abfd, 0x00, SEEK_SET) != 0 - || bfd_read (&dos_hdr, 1, sizeof (dos_hdr), abfd) - != sizeof (dos_hdr)) + if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0 + || (bfd_bread (&dos_hdr, (bfd_size_type) sizeof (dos_hdr), abfd) + != sizeof (dos_hdr))) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); @@ -96,23 +96,23 @@ ia64coff_object_p (abfd) this routine can only be called correctly for a PEI file, check the e_magic number here, and, if it doesn't match, clobber the f_magic number so that we don't get a false match. */ - if (bfd_h_get_16 (abfd, (bfd_byte *) dos_hdr.e_magic) != DOSMAGIC) + if (H_GET_16 (abfd, dos_hdr.e_magic) != DOSMAGIC) { bfd_set_error (bfd_error_wrong_format); return NULL; } - offset = bfd_h_get_32 (abfd, (bfd_byte *) dos_hdr.e_lfanew); - if (bfd_seek (abfd, (file_ptr) offset, SEEK_SET) != 0 - || bfd_read (&image_hdr, 1, sizeof (image_hdr), abfd) - != sizeof (image_hdr)) + offset = H_GET_32 (abfd, dos_hdr.e_lfanew); + if (bfd_seek (abfd, offset, SEEK_SET) != 0 + || (bfd_bread (&image_hdr, (bfd_size_type) sizeof (image_hdr), abfd) + != sizeof (image_hdr))) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format); return NULL; } - if (bfd_h_get_32 (abfd, (bfd_byte *) image_hdr.nt_signature) + if (H_GET_32 (abfd, image_hdr.nt_signature) != 0x4550) { bfd_set_error (bfd_error_wrong_format); @@ -122,10 +122,7 @@ ia64coff_object_p (abfd) /* Here is the hack. coff_object_p wants to read filhsz bytes to pick up the COFF header for PE, see "struct external_PEI_filehdr" in include/coff/pe.h. We adjust so that that will work. */ - if (bfd_seek (abfd, - (file_ptr) (offset - sizeof (dos_hdr)), - SEEK_SET) - != 0) + if (bfd_seek (abfd, offset - sizeof (dos_hdr), SEEK_SET) != 0) { if (bfd_get_error () != bfd_error_system_call) bfd_set_error (bfd_error_wrong_format);