Fix compilation warnings with GCC 11.0.1

I fixed the following error messages by applying an upstream
optimization, the specific commit can be found here
https://sqlite.org/src/info/e95138f5f4febde5

error: implicit conversion from 'long long' to 'double' changes valuefrom 9223372036854775806 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
    if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
error: implicit conversion from 'long long' to 'double' changes value from 9223372036854775806 to 9223372036854775808 [-Werror,-Wimplicit-const-int-float-conversion]
    }else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
                                 ~~~~~~~~~~~~~~^~
This commit is contained in:
Azure Crimson 2021-06-04 01:41:44 +00:00
parent 8231c7728a
commit c536f939e9
No known key found for this signature in database
GPG Key ID: 61355D50E83401C1

@ -103610,10 +103610,10 @@ static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){
** handle the rounding directly,
** otherwise use printf.
*/
if( n==0 && r>=0 && r<LARGEST_INT64-1 ){
r = (double)((sqlite_int64)(r+0.5));
}else if( n==0 && r<0 && (-r)<LARGEST_INT64-1 ){
r = -(double)((sqlite_int64)((-r)+0.5));
if( r<-4503599627370496.0 || r>+4503599627370496.0 ){
/* The value has no fractional part so there is nothing to round */
}else if( n==0 ){
r = (double)((sqlite_int64)(r+(r<0?-0.5:+0.5)));
}else{
zBuf = sqlite3_mprintf("%.*f",n,r);
if( zBuf==0 ){