]> pd.if.org Git - zpackage/commitdiff
fix warnings and includes to compile on linux
authorNathan Wagner <nw@hydaspes.if.org>
Mon, 22 May 2017 21:58:11 +0000 (21:58 +0000)
committerNathan Wagner <nw@hydaspes.if.org>
Mon, 22 May 2017 21:58:11 +0000 (21:58 +0000)
Makefile
lib/db.c
lib/zpm.c
zpm-findpkg.c
zpm-stat.c

index e31ae2e35a550d1f3b067af317b9adb16ed3c9ec..457764fd2f2a094eadce8f44a95d9000cc1937de 100644 (file)
--- 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
index 9b19b74913d1f055b14c7566ab9b8c0661465c02..8db5e2907301e3d0f29a8954427cd9b80daaeb3b 100644 (file)
--- 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<argc; i++){
                printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
        }
index 72b5777f1266415f71b79723d791e30a6ad226b7..0a6f1c7e25a9741d3f089c18f1b5084ddb459d6e 100644 (file)
--- a/lib/zpm.c
+++ b/lib/zpm.c
@@ -354,12 +354,12 @@ int zpm_close(struct zpm *pkg) {
        return 1;
 }
 
-static int zpm_sqlite_vercmp(void *not_used, int unknown, const void *a,
-               int unk2, const void *b) {
+static int zpm_sqlite_vercmp(void *not_used, int lena, const void *a,
+               int lenb, const void *b) {
        /* not sure what the ints are, possibly string lengths */
-       not_used = 0; /* suppress warning */
-       unknown = 0; /* suppress warning */
-       unk2 = 0;
+       if (not_used != 0) fprintf(stderr, "sqlite vercmp not_used = %p\n",
+                       not_used);
+       if (lena == 0 && lenb > 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) {
index 68baecad2d6889040ba0788f63eab836bdd7453d..b7cb3fdb9272241af642003ad945d28b7632bc0c 100644 (file)
@@ -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;i<ncols;i++) {
                if (i>3) fprintf(out, "\t");
                fprintf(out, "%s", vals[i]);
index 7f94713d3a37e8e1f6b27805438e2b0b7a964348..d1f714b0edf7b10e6de5bb9948d84c2632a86666 100644 (file)
@@ -1,3 +1,5 @@
+#define _POSIX_C_SOURCE 200112L
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>