bug-ddrescue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-ddrescue] patch for ddrescue 1.3 on Cygwin


From: Christian Franke
Subject: [Bug-ddrescue] patch for ddrescue 1.3 on Cygwin
Date: Tue, 29 May 2007 20:56:21 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.2pre) Gecko/20070111 SeaMonkey/1.1

Hi,

ddrescue-1.3 is now part of the Cygwin net distribution (in category Utils).
(http://cygwin.com/cgi-bin2/package-grep.cgi?grep=ddrescue)

The patch for Cygwin attached, it fixes two minor issues:

- llabs() and strtoull() are missing in namespace std. Cygwin's libstdc++ is built without C99 support (!_GLIBCXX_USE_C99) because strtould() is missing in libc.

- The "initial status ... rescued: ... errsize: ..." output was broken, because the static buffer returned by format_num() was used twice in a printf().

The latter IMO affects all platforms.

Christian

diff -rup origsrc/ddrescue-1.3/ddrescue.cc src/ddrescue-1.3/ddrescue.cc
--- origsrc/ddrescue-1.3/ddrescue.cc    2006-10-29 18:42:08.000000000 +0100
+++ src/ddrescue-1.3/ddrescue.cc        2007-05-17 19:45:10.000000000 +0200
@@ -176,7 +176,7 @@ const char * format_num( long long num, 
   const char *p = "";
   max = std::max( 999LL, std::min( 999999LL, max ) );
 
-  for( int i = 0; i < 8 && std::llabs( num ) > std::llabs( max ); ++i )
+  for( int i = 0; i < 8 && ::llabs( num ) > ::llabs( max ); ++i )
     { num /= factor; p = prefix[i]; }
   snprintf( buf, sizeof( buf ), "%lld %s", num, p );
   return buf;
diff -rup origsrc/ddrescue-1.3/logbook.cc src/ddrescue-1.3/logbook.cc
--- origsrc/ddrescue-1.3/logbook.cc     2006-10-29 15:52:49.000000000 +0100
+++ src/ddrescue-1.3/logbook.cc 2007-05-17 19:43:42.000000000 +0200
@@ -516,8 +516,9 @@ int Logbook::do_rescue( const int ides, 
     if( filename )
       {
       std::printf( "Initial status (read from logfile)\n" );
-      std::printf( "rescued: %10sB,  errsize:%9sB,  errors: %7u\n",
-                   format_num( recsize ), format_num( errsize, 99999 ), errors 
);
+      std::printf( "rescued: %10sB,", format_num( recsize ) );
+      std::printf( "  errsize:%9sB,  errors: %7u\n",
+                   format_num( errsize, 99999 ), errors );
       std::printf( "Current status\n" );
       }
     }
diff -rup origsrc/ddrescue-1.3/main.cc src/ddrescue-1.3/main.cc
--- origsrc/ddrescue-1.3/main.cc        2006-10-29 18:15:22.000000000 +0100
+++ src/ddrescue-1.3/main.cc    2007-05-17 19:45:10.000000000 +0200
@@ -90,7 +90,7 @@ long long getnum( const char * ptr, cons
   {
   errno = 0;
   char *tail;
-  long long result = std::strtoll( ptr, &tail, 0 );
+  long long result = ::strtoll( ptr, &tail, 0 );
   if( tail == ptr )
     { show_error( "bad or missing numerical argument", 0, true ); 
std::exit(1); }
 
@@ -123,7 +123,7 @@ long long getnum( const char * ptr, cons
       std::exit(1); }
     for( int i = 0; i < exponent; ++i )
       {
-      if( LONG_LONG_MAX / factor >= std::llabs( result ) ) result *= factor;
+      if( LONG_LONG_MAX / factor >= ::llabs( result ) ) result *= factor;
       else { errno = ERANGE; break; }
       }
     }

reply via email to

[Prev in Thread] Current Thread [Next in Thread]