1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-01 06:27:03 +03:00

More harmless compiler warning fixes.

FossilOrigin-Name: 4c0d208c455abb983217a6dfea7634f677f8360fb57857e1421334fe7a5a23e2
This commit is contained in:
drh
2020-07-18 18:44:59 +00:00
parent aec7dc6563
commit a7c74006a0
7 changed files with 50 additions and 25 deletions

View File

@ -21,6 +21,12 @@ SQLITE_EXTENSION_INIT1
#include <ctype.h>
#include <stdlib.h>
/* Mark a function parameter as unused, to suppress nuisance compiler
** warnings. */
#ifndef UNUSED_PARAMETER
# define UNUSED_PARAMETER(X) (void)(X)
#endif
/* A decimal object */
typedef struct Decimal Decimal;
@ -235,6 +241,7 @@ static void decimalFunc(
sqlite3_value **argv
){
Decimal *p = decimal_new(context, argv[0], 0, 0);
UNUSED_PARAMETER(argc);
decimal_result(context, p);
decimal_free(p);
}
@ -288,6 +295,7 @@ static void decimalCmpFunc(
Decimal *pA = 0, *pB = 0;
int rc;
UNUSED_PARAMETER(argc);
pA = decimal_new(context, argv[0], 0, 0);
if( pA==0 || pA->isNull ) goto cmp_done;
pB = decimal_new(context, argv[1], 0, 0);
@ -412,6 +420,7 @@ static int decimalCollFunc(
Decimal *pA = decimal_new(0, 0, nKey1, zA);
Decimal *pB = decimal_new(0, 0, nKey2, zB);
int rc;
UNUSED_PARAMETER(notUsed);
if( pA==0 || pB==0 ){
rc = 0;
}else{
@ -436,6 +445,7 @@ static void decimalAddFunc(
){
Decimal *pA = decimal_new(context, argv[0], 0, 0);
Decimal *pB = decimal_new(context, argv[1], 0, 0);
UNUSED_PARAMETER(argc);
decimal_add(pA, pB);
decimal_result(context, pA);
decimal_free(pA);
@ -448,6 +458,7 @@ static void decimalSubFunc(
){
Decimal *pA = decimal_new(context, argv[0], 0, 0);
Decimal *pB = decimal_new(context, argv[1], 0, 0);
UNUSED_PARAMETER(argc);
if( pB==0 ) return;
pB->sign = !pB->sign;
decimal_add(pA, pB);
@ -468,6 +479,7 @@ static void decimalSumStep(
){
Decimal *p;
Decimal *pArg;
UNUSED_PARAMETER(argc);
p = sqlite3_aggregate_context(context, sizeof(*p));
if( p==0 ) return;
if( !p->isInit ){
@ -493,6 +505,7 @@ static void decimalSumInverse(
){
Decimal *p;
Decimal *pArg;
UNUSED_PARAMETER(argc);
p = sqlite3_aggregate_context(context, sizeof(*p));
if( p==0 ) return;
if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return;
@ -533,6 +546,7 @@ static void decimalMulFunc(
signed char *acc = 0;
int i, j, k;
int minFrac;
UNUSED_PARAMETER(argc);
if( pA==0 || pA->oom || pA->isNull
|| pB==0 || pB->oom || pB->isNull
){
@ -597,7 +611,7 @@ int sqlite3_decimal_init(
{ "decimal_sub", 2, decimalSubFunc },
{ "decimal_mul", 2, decimalMulFunc },
};
int i;
unsigned int i;
(void)pzErrMsg; /* Unused parameter */
for(i=0; i<sizeof(aFunc)/sizeof(aFunc[0]) && rc==SQLITE_OK; i++){

View File

@ -90,6 +90,12 @@ SQLITE_EXTENSION_INIT1
#include <assert.h>
#include <string.h>
/* Mark a function parameter as unused, to suppress nuisance compiler
** warnings. */
#ifndef UNUSED_PARAMETER
# define UNUSED_PARAMETER(X) (void)(X)
#endif
/*
** Implementation of the ieee754() function
*/
@ -109,7 +115,7 @@ static void ieee754func(
&& sqlite3_value_bytes(argv[0])==sizeof(r)
){
const unsigned char *x = sqlite3_value_blob(argv[0]);
int i;
unsigned int i;
sqlite3_uint64 v = 0;
for(i=0; i<sizeof(r); i++){
v = (v<<8) | x[i];
@ -201,12 +207,13 @@ static void ieee754func_from_blob(
int argc,
sqlite3_value **argv
){
UNUSED_PARAMETER(argc);
if( sqlite3_value_type(argv[0])==SQLITE_BLOB
&& sqlite3_value_bytes(argv[0])==sizeof(double)
){
double r;
const unsigned char *x = sqlite3_value_blob(argv[0]);
int i;
unsigned int i;
sqlite3_uint64 v = 0;
for(i=0; i<sizeof(r); i++){
v = (v<<8) | x[i];
@ -220,13 +227,14 @@ static void ieee754func_to_blob(
int argc,
sqlite3_value **argv
){
UNUSED_PARAMETER(argc);
if( sqlite3_value_type(argv[0])==SQLITE_FLOAT
|| sqlite3_value_type(argv[0])==SQLITE_INTEGER
){
double r = sqlite3_value_double(argv[0]);
sqlite3_uint64 v;
unsigned char a[sizeof(r)];
int i;
unsigned int i;
memcpy(&v, &r, sizeof(r));
for(i=1; i<=sizeof(r); i++){
a[sizeof(r)-i] = v&0xff;
@ -259,7 +267,7 @@ int sqlite3_ieee_init(
{ "ieee754_from_blob", 1, 0, ieee754func_from_blob },
};
int i;
unsigned int i;
int rc = SQLITE_OK;
SQLITE_EXTENSION_INIT2(pApi);
(void)pzErrMsg; /* Unused parameter */