From 7a88bc9c3dd8284dcd8f4222ec3524d146810884 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 11 Jan 2011 10:46:55 +0000 Subject: [PATCH] * readelf.c (print_symbol): Handle symbol characters as unsigned. Whitespace fixes. --- binutils/ChangeLog | 5 +++++ binutils/readelf.c | 17 +++++++++-------- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 593681e0af9..9287fdac629 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2011-01-11 Andreas Schwab + + * readelf.c (print_symbol): Handle symbol characters as unsigned. + Whitespace fixes. + 2011-01-10 Nick Clifton * po/da.po: Updated Danish translation. diff --git a/binutils/readelf.c b/binutils/readelf.c index b8ab55b989b..a9f271d5a80 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -1,6 +1,6 @@ /* readelf.c -- display contents of an ELF format file Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, - 2008, 2009, 2010 + 2008, 2009, 2010, 2011 Free Software Foundation, Inc. Originally developed by Eric Youngdale @@ -380,15 +380,16 @@ print_vma (bfd_vma vma, print_mode mode) Returns the number of emitted characters. */ static unsigned int -print_symbol (int width, const char * symbol) +print_symbol (int width, const char *symbol) { - const char * c; + const char *c; bfd_boolean extra_padding = FALSE; unsigned int num_printed = 0; if (do_wide) { - /* Set the width to a very large value. This simplifies the code below. */ + /* Set the width to a very large value. This simplifies the + code below. */ width = INT_MAX; } else if (width < 0) @@ -407,7 +408,7 @@ print_symbol (int width, const char * symbol) /* Look for non-printing symbols inside the symbol's name. This test is triggered in particular by the names generated by the assembler for local labels. */ - while (ISPRINT (* c)) + while (ISPRINT (*c)) c++; len = c - symbol; @@ -423,12 +424,12 @@ print_symbol (int width, const char * symbol) num_printed += len; } - if (* c == 0 || width == 0) + if (*c == 0 || width == 0) break; /* Now display the non-printing character, if there is room left in which to dipslay it. */ - if (*c < 32) + if ((unsigned char) *c < 32) { if (width < 2) break; @@ -443,7 +444,7 @@ print_symbol (int width, const char * symbol) if (width < 6) break; - printf ("<0x%.2x>", *c); + printf ("<0x%.2x>", (unsigned char) *c); width -= 6; num_printed += 6; -- 2.30.2