[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-ddrescue] [PATCH 3/7] [clang-tidy] Remove const from superfluous lo
From: |
Rosen Penev |
Subject: |
[Bug-ddrescue] [PATCH 3/7] [clang-tidy] Remove const from superfluous locations |
Date: |
Mon, 14 Oct 2019 13:59:42 -0700 |
Found with readability-const-return-type
Signed-off-by: Rosen Penev <address@hidden>
---
rational.cc | 6 +++---
rational.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/rational.cc b/rational.cc
index 1b9fe31..3fdb29c 100644
--- a/rational.cc
+++ b/rational.cc
@@ -51,7 +51,7 @@ long long gcd( long long n, long long m ) // Greatest
Common Divisor
}
-const std::string overflow_string( const int n )
+std::string overflow_string( const int n )
{ if( n > 0 ) return "+INF"; if( n < 0 ) return "-INF"; return "NAN"; }
int overflow_value( const long long n, const bool negate = false )
@@ -215,7 +215,7 @@ int Rational::parse( const char * const s )
// spaces if needed.
// If 'prec' is negative, only the needed decimals are produced.
//
-const std::string Rational::to_decimal( const unsigned iwidth, int prec ) const
+std::string Rational::to_decimal( const unsigned iwidth, int prec ) const
{
if( den <= 0 ) return overflow_string( num );
@@ -243,7 +243,7 @@ const std::string Rational::to_decimal( const unsigned
iwidth, int prec ) const
// 'width' is the minimum width to be produced, prefixed with spaces if
// needed.
//
-const std::string Rational::to_fraction( const unsigned width ) const
+std::string Rational::to_fraction( const unsigned width ) const
{
if( den <= 0 ) return overflow_string( num );
diff --git a/rational.h b/rational.h
index 0b7392d..13d1447 100644
--- a/rational.h
+++ b/rational.h
@@ -130,8 +130,8 @@ public:
{ if( den > 0 ) return ( num / den ); else return num; }
int parse( const char * const s ); // returns parsed size
- const std::string to_decimal( const unsigned iwidth = 1, int prec = -2 )
const;
- const std::string to_fraction( const unsigned width = 1 ) const;
+ std::string to_decimal( const unsigned iwidth = 1, int prec = -2 ) const;
+ std::string to_fraction( const unsigned width = 1 ) const;
};
--
2.17.1
[Bug-ddrescue] [PATCH 3/7] [clang-tidy] Remove const from superfluous locations,
Rosen Penev <=
Re: [Bug-ddrescue] [PATCH 1/7] tree: Remove stdint.h from two unnecessary places, Antonio Diaz Diaz, 2019/10/15