Article View: gnu.utils.bug
Article #1163patch for binutils/size.c to print unsigned long rather than ints
From: Kevin Dalley
Date: Sat, 12 Dec 1992 04:33
Date: Sat, 12 Dec 1992 04:33
74 lines
2726 bytes
2726 bytes
In many cases, size print ints rather than unsigned ints, which can
produce negative sizes in the output. Sometimes longs are used for
sizes, other times standard ints are used. I converted to unsigned
ints. One could argue that bfd_size_type is more appropriate in some
situations. Since it hadn't been used in other parts of size, I
didn't use it.
RCS file: /usr/local/src/CVS/binutils/binutils/size.c,v
retrieving revision 1.1.1.1
co warning: redefinition of -V option
diff -u -r1.1.1.1 size.c
--- 1.1.1.1 92/11/26 02:12:39
+++ size.c 92/12/11 11:42:23
@@ -229,18 +229,20 @@
/* This is what lexical functions are for */
void
lprint_number (width, num)
- int width, num;
+ int width;
+ unsigned long num;
{
- printf ((radix == decimal ? "%-*d\t" :
- ((radix == octal) ? "%-*o\t" : "%-*x\t")), width, num);
+ printf ((radix == decimal ? "%-*lu\t" :
+ ((radix == octal) ? "%-*lo\t" : "%-*lx\t")), width, num);
}
void
rprint_number(width, num)
- int width, num;
+ int width;
+ unsigned long num;
{
- printf ((radix == decimal ? "%*d\t" :
- ((radix == octal) ? "%*o\t" : "%*x\t")), width, num);
+ printf ((radix == decimal ? "%*lu\t" :
+ ((radix == octal) ? "%*lo\t" : "%*lx\t")), width, num);
}
static char *bss_section_name = ".bss";
@@ -297,7 +299,8 @@
lprint_number (7, textsize);
lprint_number (7, datasize);
lprint_number (7, bsssize);
- printf (((radix == octal) ? "%-7o\t%-7x\t" : "%-7d\t%-7x\t"), total, total);
+ printf (((radix == octal) ? "%-7lo\t%-7lx\t"
+ : "%-7ld\t%-7lx\t"), total, total);
fputs(bfd_get_filename(abfd), stdout);
if (abfd->my_archive) printf (" (ex %s)", abfd->my_archive->filename);
@@ -304,7 +307,7 @@
}
/* I REALLY miss lexical functions! */
-int svi_total = 0;
+unsigned int svi_total = 0;
void
sysv_internal_printer(file, sec, ignore)
@@ -312,7 +315,7 @@
sec_ptr sec;
PTR ignore;
{
- int size = bfd_section_size (file, sec);
+ unsigned long size = bfd_section_size (file, sec);
if (sec!= &bfd_abs_section
&& sec!= &bfd_com_section
&& sec!=&bfd_und_section)
--
Kevin Dalley
Toshiba America MRI, Inc.
kevin@tamri.com
Technical Details
Message-ID:
<KEVIN.92Dec11203345@polkacide.tamri.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!tamri.com!kevinShow Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!tamri.com!kevin From: kevin@tamri.com (Kevin Dalley) Subject: patch for binutils/size.c to print unsigned long rather than ints Message-ID: <KEVIN.92Dec11203345@polkacide.tamri.com> Sender: gnulists@ai.mit.edu Reply-To: kevin@tamri.com Organization: TOSHIBA America MRI, South San Francisco, CA Distribution: gnu Date: Sat, 12 Dec 1992 04:33:47 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 77