* readelf.c (get_segment_type): Display "GNU_STACK", not just
[deliverable/binutils-gdb.git] / binutils / strings.c
index 67c601f3b91b9ea16f94c937fa0c68e7ac37c915..8a27fa800e4b1f3b3d1e89e2f86fb5baed1f8fb3 100644 (file)
@@ -1,6 +1,6 @@
 /* strings -- print the strings of printable characters in files
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-   2002, 2003 Free Software Foundation, Inc.
+   2002, 2003, 2004 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -317,7 +317,7 @@ strings_a_section (bfd *abfd, asection *sect, void *filearg)
 
   if ((sect->flags & DATA_FLAGS) == DATA_FLAGS)
     {
-      bfd_size_type sz = bfd_get_section_size_before_reloc (sect);
+      bfd_size_type sz = bfd_get_section_size (sect);
       void *mem = xmalloc (sz);
 
       if (bfd_get_section_contents (abfd, sect, mem, (file_ptr) 0, sz))
@@ -370,6 +370,9 @@ strings_object_file (const char *file)
 static bfd_boolean
 strings_file (char *file)
 {
+  if (get_file_size (file) < 1)
+    return FALSE;
+
   /* If we weren't told to scan the whole file,
      try to open it as an object file and only look at
      initialized data sections.  If that fails, fall back to the
@@ -509,7 +512,7 @@ print_strings (const char *filename, FILE *stream, file_off address,
        }
 
       /* We found a run of `string_min' graphic characters.  Print up
-         to the next non-graphic character.  */
+        to the next non-graphic character.  */
 
       if (print_filenames)
        printf ("%s: ", filename);
@@ -554,7 +557,8 @@ print_strings (const char *filename, FILE *stream, file_off address,
 #else
 # if !BFD_HOST_64BIT_LONG
            if (start != (unsigned long) start)
-             printf ("%lx%8.8lx ", start >> 32, start & 0xffffffff);
+             printf ("%lx%8.8lx ", (unsigned long) (start >> 32),
+                     (unsigned long) (start & 0xffffffff));
            else
 # endif
 #endif
This page took 0.023123 seconds and 4 git commands to generate.