From 84f276b21e57aa8fe1e16d01e75fee1097d5daf8 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Mon, 22 May 2017 21:58:11 +0000 Subject: [PATCH] fix warnings and includes to compile on linux --- Makefile | 2 +- lib/db.c | 4 +++- lib/zpm.c | 14 ++++++++------ zpm-findpkg.c | 4 +++- zpm-stat.c | 2 ++ 5 files changed, 17 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index e31ae2e..457764f 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,7 @@ CFLAGS=-Wall -W -Wextra -Werror -std=c99 -Ilib -Ielf -I. -Ilzma/api LZMAFLAGS=-Ilzma/api -Ilzma/tuklib -Ilzma/lzma -Ilzma/common -Ilzma/check -Ilzma/lz -Ilzma/rangecoder -Ilzma/simple -Ilzma/delta -DHAVE_CHECK_CRC64 -DHAVE_CHECK_CRC32 -DHAVE_ENCODER_LZMA2 -DHAVE_DECODER_LZMA2 -DHAVE_MF_BT4 -LDFLAGS=-L. +LDFLAGS=-L. -ldl LZMACHECKSRC=lzma/check/check.c lzma/check/crc32_fast.c lzma/check/crc64_fast.c lzma/check/crc32_table.c lzma/check/crc64_table.c LZMASRC=$(shell ls lzma/lzma/*.c lzma/common/*.c lzma/lz/*.c) $(LZMACHECKSRC) lzma/rangecoder/price_table.c diff --git a/lib/db.c b/lib/db.c index 9b19b74..8db5e29 100644 --- a/lib/db.c +++ b/lib/db.c @@ -16,7 +16,9 @@ static int callback(void *NotUsed, int argc, char **argv, char **azColName){ int i; - NotUsed = 0; /* suppress warning */ + if (NotUsed) { + fprintf(stderr, "sqlite3 callback unused = %p\n", NotUsed); + } for(i=0; i 0) return 1; return zpm_vercmp(a, b); } @@ -734,7 +734,9 @@ int zpm_import(struct zpm *pkg, char *path, uint32_t flags, char *hash) { hash = hashbuf; } - flags = 0; /* suppress warning, probably use to follow symlinks */ + if (flags) { + fprintf(stderr, "zpm_import unused flags = %d\n", flags); + } /* mmap the file */ fd = open(path, O_RDONLY); if (fd == -1) { diff --git a/zpm-findpkg.c b/zpm-findpkg.c index 68baeca..b7cb3fd 100644 --- a/zpm-findpkg.c +++ b/zpm-findpkg.c @@ -6,7 +6,9 @@ static int prow(void *f, int ncols, char **vals, char **cols) { FILE *out = f; int i; - cols = 0; /* suppress warning */ + if (cols == 0) { + fprintf(stderr, "sqlite can't get column names\n"); + } for (i=3;i3) fprintf(out, "\t"); fprintf(out, "%s", vals[i]); diff --git a/zpm-stat.c b/zpm-stat.c index 7f94713..d1f714b 100644 --- a/zpm-stat.c +++ b/zpm-stat.c @@ -1,3 +1,5 @@ +#define _POSIX_C_SOURCE 200112L + #include #include #include -- 2.40.0