mirror of
https://github.com/isar/libmdbx.git
synced 2024-12-29 08:28:49 +08:00
mdbx: -Wextra and fixes.
Change-Id: I9f373e66f8f5f7cf3b29b5246eb2c67e4a49a460
This commit is contained in:
parent
9871e24670
commit
3a8db9fed3
4
Makefile
4
Makefile
@ -18,8 +18,8 @@ prefix ?= /usr/local
|
||||
mandir ?= $(prefix)/man
|
||||
|
||||
CC ?= gcc
|
||||
XCFLAGS ?=
|
||||
CFLAGS ?= -O2 -ggdb3 -Wall -Werror -DNDEBUG=1
|
||||
XCFLAGS ?= -DNDEBUG=1 -DMDB_DEBUG=0
|
||||
CFLAGS ?= -O2 -g -Wall -Werror -Wextra
|
||||
CFLAGS += -pthread $(XCFLAGS)
|
||||
|
||||
IOARENA ?= ../ioarena.git/@BUILD/src/ioarena
|
||||
|
13
mdb_chk.c
13
mdb_chk.c
@ -50,6 +50,7 @@ flagbit dbflags[] = {
|
||||
static volatile sig_atomic_t gotsignal;
|
||||
|
||||
static void signal_hanlder( int sig ) {
|
||||
(void) sig;
|
||||
gotsignal = 1;
|
||||
}
|
||||
|
||||
@ -228,6 +229,8 @@ static size_t problems_pop(struct problem* list) {
|
||||
static int pgvisitor(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi,
|
||||
const char* type, int nentries, int payload_bytes, int header_bytes, int unused_bytes)
|
||||
{
|
||||
(void) ctx;
|
||||
|
||||
if (type) {
|
||||
size_t page_bytes = payload_bytes + header_bytes + unused_bytes;
|
||||
size_t page_size = pgnumber * stat.base.ms_psize;
|
||||
@ -250,14 +253,14 @@ static int pgvisitor(size_t pgno, unsigned pgnumber, void* ctx, const char* dbi,
|
||||
problem_add("page", pgno, "illegal unused-bytes", "%zu < %i < %zu",
|
||||
0, unused_bytes, stat.base.ms_psize);
|
||||
|
||||
if (header_bytes < sizeof(long) || header_bytes >= stat.base.ms_psize - sizeof(long))
|
||||
if (header_bytes < (int) sizeof(long) || (size_t) header_bytes >= stat.base.ms_psize - sizeof(long))
|
||||
problem_add("page", pgno, "illegal header-length", "%zu < %i < %zu",
|
||||
sizeof(long), header_bytes, stat.base.ms_psize - sizeof(long));
|
||||
if (payload_bytes < 1) {
|
||||
if (nentries > 0) {
|
||||
problem_add("page", pgno, "zero size-of-entry", "payload %i bytes, %i entries",
|
||||
payload_bytes, nentries);
|
||||
if (header_bytes + unused_bytes < page_size) {
|
||||
if ((size_t) header_bytes + unused_bytes < page_size) {
|
||||
/* LY: hush a misuse error */
|
||||
page_bytes = page_size;
|
||||
}
|
||||
@ -302,6 +305,9 @@ typedef int (visitor)(size_t record_number, MDB_val *key, MDB_val* data);
|
||||
static int process_db(MDB_dbi dbi, char *name, visitor *handler, int silent);
|
||||
|
||||
static int handle_userdb(size_t record_number, MDB_val *key, MDB_val* data) {
|
||||
(void) record_number;
|
||||
(void) key;
|
||||
(void) data;
|
||||
return MDB_SUCCESS;
|
||||
}
|
||||
|
||||
@ -366,7 +372,8 @@ static int handle_freedb(size_t record_number, MDB_val *key, MDB_val* data) {
|
||||
|
||||
static int handle_maindb(size_t record_number, MDB_val *key, MDB_val* data) {
|
||||
char *name;
|
||||
int i, rc;
|
||||
int rc;
|
||||
size_t i;
|
||||
|
||||
name = key->mv_data;
|
||||
for(i = 0; i < key->mv_size; ++i) {
|
||||
|
@ -25,6 +25,7 @@
|
||||
static void
|
||||
sighandle(int sig)
|
||||
{
|
||||
(void) sig;
|
||||
}
|
||||
|
||||
int main(int argc,char * argv[])
|
||||
|
@ -48,7 +48,8 @@ static volatile sig_atomic_t gotsig;
|
||||
|
||||
static void dumpsig( int sig )
|
||||
{
|
||||
gotsig=1;
|
||||
(void) sig;
|
||||
gotsig = 1;
|
||||
}
|
||||
|
||||
static const char hexc[] = "0123456789abcdef";
|
||||
|
2
mtest0.c
2
mtest0.c
@ -44,6 +44,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
srand(time(NULL));
|
||||
|
||||
count = (rand()%384) + 64;
|
||||
|
2
mtest1.c
2
mtest1.c
@ -52,6 +52,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
srand(time(NULL));
|
||||
|
||||
count = (rand()%384) + 64;
|
||||
|
2
mtest2.c
2
mtest2.c
@ -46,6 +46,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
srand(time(NULL));
|
||||
|
||||
count = (rand()%384) + 64;
|
||||
|
2
mtest3.c
2
mtest3.c
@ -47,6 +47,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
srand(time(NULL));
|
||||
|
||||
memset(sval, 0, sizeof(sval));
|
||||
|
2
mtest4.c
2
mtest4.c
@ -47,6 +47,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
memset(sval, 0, sizeof(sval));
|
||||
|
||||
count = 510;
|
||||
|
2
mtest5.c
2
mtest5.c
@ -47,6 +47,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
srand(time(NULL));
|
||||
|
||||
memset(sval, 0, sizeof(sval));
|
||||
|
2
mtest6.c
2
mtest6.c
@ -47,6 +47,8 @@ int main(int argc,char * argv[])
|
||||
int env_oflags;
|
||||
struct stat db_stat, exe_stat;
|
||||
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
srand(time(NULL));
|
||||
|
||||
E(mdb_env_create(&env));
|
||||
|
3
wbench.c
3
wbench.c
@ -205,6 +205,9 @@ static void wbench(int flags, int mb, int count, int salt)
|
||||
|
||||
int main(int argc,char * argv[])
|
||||
{
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
#define SALT 1
|
||||
#define COUNT 10000
|
||||
#define SIZE 12
|
||||
|
@ -217,6 +217,9 @@ static void periodic_add_rec() {
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
char filename[PATH_MAX];
|
||||
mkdir(opt_db_path, 0775);
|
||||
|
||||
|
@ -240,6 +240,9 @@ static void periodic_stat(void) {
|
||||
//}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
(void) argc;
|
||||
(void) argv;
|
||||
|
||||
char filename[PATH_MAX];
|
||||
int i;
|
||||
int64_t t;
|
||||
|
Loading…
x
Reference in New Issue
Block a user