Antonio Diaz Diaz wrote:
GNU ddrescue 1.27-rc1 is ready for testing here
http://download.savannah.gnu.org/releases/ddrescue/ddrescue-1.27-rc1.tar.lz

The sha256sum is:
3c9e685a03735e1182efd2628770212ff490fdb4333cfce4e891f2a8adac1f57 ddrescue-1.27-rc1.tar.lz

Please, test it and report any bugs you find.

Cygwin g++ 11.3.0 prints two warnings which make sense:

loggers.cc: In function ‘const char* {anonymous}::format_time_dhms(long long int)’: loggers.cc:42:62: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=]    42 |   if( d ) snprintf( buf, sizeof buf, "%lldd:%02dh:%02dm:%02ds", d, h, m, s );
      | ^
loggers.cc:42:19: note: ‘snprintf’ output between 15 and 33 bytes into a destination of size 32    42 |   if( d ) snprintf( buf, sizeof buf, "%lldd:%02dh:%02dm:%02ds", d, h, m, s );
      | ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

main.cc: In function ‘Rational {anonymous}::parse_rational_time(const char*, const char*, bool, int)’: main.cc:186:17: warning: this statement may fall through [-Wimplicit-fallthrough=]
  186 |       case ',': if( comma ) break;
      |                 ^~
main.cc:187:7: note: here
  187 |       default :

See attached patch for possible fixes. The "// fallthrough" may also work with clang++. C++17 or later would allow "[[fallthrough]];" attribute.

--
Regards,
Christian

diff -pru ddrescue-1.27-rc1.orig/loggers.cc ddrescue-1.27-rc1/loggers.cc
--- ddrescue-1.27-rc1.orig/loggers.cc   2022-12-16 00:10:51.000000000 +0100
+++ ddrescue-1.27-rc1/loggers.cc        2022-12-22 18:41:57.768074400 +0100
@@ -33,7 +33,7 @@ namespace {
 
 const char * format_time_dhms( const long long t )
   {
-  static char buf[32];
+  static char buf[33];
   const int s = t % 60;
   const int m = ( t / 60 ) % 60;
   const int h = ( t / 3600 ) % 24;
diff -pru ddrescue-1.27-rc1.orig/main.cc ddrescue-1.27-rc1/main.cc
--- ddrescue-1.27-rc1.orig/main.cc      2022-12-16 18:12:15.000000000 +0100
+++ ddrescue-1.27-rc1/main.cc   2022-12-22 18:47:15.769177000 +0100
@@ -183,7 +183,7 @@ Rational parse_rational_time( const char
       case 'm': r *= 60; break;
       case 's':
       case  0 : break;
-      case ',': if( comma ) break;
+      case ',': if( comma ) break; // fallthrough
       default :
         show_option_error( arg, "Bad unit in time interval argument of",
                            option_name ); std::exit( 1 );

Reply via email to