2002-04-21 David S. Miller <davem@redhat.com>
[deliverable/binutils-gdb.git] / bfd / format.c
index c64b96fe938169b88aad9bc329c26a3a2df5d881..f60f0caa6fc049bb051055c38bd8123e49c22530 100644 (file)
@@ -125,8 +125,7 @@ bfd_check_format_matches (abfd, format, matching)
   int ar_match_index;
 
   if (!bfd_read_p (abfd)
-      || abfd->format < bfd_unknown
-      || abfd->format >= bfd_type_end)
+      || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return false;
@@ -143,10 +142,11 @@ bfd_check_format_matches (abfd, format, matching)
 
   if (matching)
     {
+      bfd_size_type amt;
+
       *matching = NULL;
-      matching_vector =
-       (char **) bfd_malloc (sizeof (char *)
-                             * 2 * _bfd_target_vector_entries);
+      amt = sizeof (char *) * 2 * _bfd_target_vector_entries;
+      matching_vector = (char **) bfd_malloc (amt);
       if (!matching_vector)
        return false;
     }
@@ -160,7 +160,7 @@ bfd_check_format_matches (abfd, format, matching)
   /* If the target type was explicitly specified, just check that target.  */
   if (!abfd->target_defaulted)
     {
-      if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0) /* rewind! */
+      if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)        /* rewind! */
        return false;
 
       right_targ = BFD_SEND_FMT (abfd, _bfd_check_format, (abfd));
@@ -211,7 +211,7 @@ bfd_check_format_matches (abfd, format, matching)
 
       abfd->xvec = *target;    /* Change BFD's target temporarily */
 
-      if (bfd_seek (abfd, (file_ptr)0, SEEK_SET) != 0)
+      if (bfd_seek (abfd, (file_ptr) 0, SEEK_SET) != 0)
        return false;
 
       /* If _bfd_check_format neglects to set bfd_error, assume
@@ -348,8 +348,7 @@ bfd_set_format (abfd, format)
      bfd_format format;
 {
   if (bfd_read_p (abfd)
-      || abfd->format < bfd_unknown
-      || abfd->format >= bfd_type_end)
+      || (unsigned int) abfd->format >= (unsigned int) bfd_type_end)
     {
       bfd_set_error (bfd_error_invalid_operation);
       return false;
This page took 0.024154 seconds and 4 git commands to generate.