patch for strings(1) offset format problem (sign flips every 2GB)

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Carson Harding
Date: Thursday, September 3, 2009 - 12:18 pm

This seems to fix the issue where the sign flips on the offset when
running on files > 2GB (-t option). Printf(3) says "L" modifies
floating point formats, use "ll" for integers. Should be unsigned as
well. 


--- ./gnu/usr.bin/binutils/binutils/strings.c.orig	Wed Sep  2 13:59:16 2009
+++ ./gnu/usr.bin/binutils/binutils/strings.c	Wed Sep  2 14:54:06 2009
@@ -522,7 +522,7 @@
 	  case 8:
 #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
 	    if (sizeof (start) > sizeof (long))
-	      printf ("%7Lo ", (unsigned long long) start);
+	      printf ("%7llo ", (unsigned long long) start);
 	    else
 #else
 # if !BFD_HOST_64BIT_LONG
@@ -537,7 +537,7 @@
 	  case 10:
 #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
 	    if (sizeof (start) > sizeof (long))
-	      printf ("%7Ld ", (unsigned long long) start);
+	      printf ("%7llu ", (unsigned long long) start);
 	    else
 #else
 # if !BFD_HOST_64BIT_LONG
@@ -552,7 +552,7 @@
 	  case 16:
 #if __STDC_VERSION__ >= 199901L || (defined(__GNUC__) && __GNUC__ >= 2)
 	    if (sizeof (start) > sizeof (long))
-	      printf ("%7Lx ", (unsigned long long) start);
+	      printf ("%7llx ", (unsigned long long) start);
 	    else
 #else
 # if !BFD_HOST_64BIT_LONG


-- 
Carson Harding - harding (at) motd (dot) ca
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
patch for strings(1) offset format problem (sign flips eve ..., Carson Harding, (Thu Sep 3, 12:18 pm)