From a5f99d3393efc1aae25ef6ec30e9f749d4077ed2 Mon Sep 17 00:00:00 2001 From: alexhudson Date: Fri, 21 Sep 2007 19:10:03 +0000 Subject: [PATCH] Get rid of most of the compiler warnings in the store --- include/bongoutil.h | 2 +- src/agents/store/alarmdb.c | 6 +++--- src/agents/store/command.c | 6 ++---- src/agents/store/cookie.c | 1 - src/agents/store/db.c | 14 +++++++------- src/agents/store/db.h | 4 ++-- src/agents/store/mail.c | 1 - src/agents/store/store.c | 7 +------ 8 files changed, 16 insertions(+), 25 deletions(-) diff --git a/include/bongoutil.h b/include/bongoutil.h index 9e2cd8c..4c3ccdf 100644 --- a/include/bongoutil.h +++ b/include/bongoutil.h @@ -269,7 +269,7 @@ void BongoHashtableDelete(BongoHashtable *table); #define BongoHashTableCount(_tableptr) ((_tableptr)->itemcount) #define BongoCreateStringHashTable(buckets) \ -BongoHashtableCreate(buckets, BongoStringHash, strcmp) +BongoHashtableCreate(buckets, (HashFunction)BongoStringHash, (CompareFunction)strcmp) /* handy string hasher */ uint32_t BongoStringHash (char *s); diff --git a/src/agents/store/alarmdb.c b/src/agents/store/alarmdb.c index 57f9623..de90cf9 100644 --- a/src/agents/store/alarmdb.c +++ b/src/agents/store/alarmdb.c @@ -163,9 +163,9 @@ AlarmDBOpen(BongoMemStack *memstack) create = access(path, 0); - if (!(handle = MemMalloc(sizeof(struct _AlarmDBHandle))) || - memset(handle, 0, sizeof(struct _AlarmDBHandle)), 0 || - SQLITE_OK != sqlite3_open(path, &handle->db)) + if (!(handle = MemMalloc(sizeof(struct _AlarmDBHandle))) || + (memset(handle, 0, sizeof(struct _AlarmDBHandle)), 0) || + (SQLITE_OK != sqlite3_open(path, &handle->db))) { printf("bongostore: Failed to open alarm store \"%s\".\r\n", path); goto fail; diff --git a/src/agents/store/command.c b/src/agents/store/command.c index aaac4b6..d236b56 100644 --- a/src/agents/store/command.c +++ b/src/agents/store/command.c @@ -826,7 +826,7 @@ ParseHeaderList(StoreClient *client, return ccode; } - +/* FIXME: Unused, deprecated? static CCode ParseConversationSource(StoreClient *client, char *token, @@ -835,7 +835,7 @@ ParseConversationSource(StoreClient *client, GetConversationSourceMask(token, outflags); return TOKEN_OK; } - +*/ static CCode ParseStoreName(StoreClient *client, @@ -4751,8 +4751,6 @@ StoreCommandRESET(StoreClient *client) CCode StoreCommandSTORE(StoreClient *client, char *user) { - struct sockaddr_in serv; - if (!user) { UnselectStore(client); return ConnWriteStr(client->conn, MSG1000OK); diff --git a/src/agents/store/cookie.c b/src/agents/store/cookie.c index edffde8..e9b846e 100644 --- a/src/agents/store/cookie.c +++ b/src/agents/store/cookie.c @@ -83,7 +83,6 @@ StoreCommandCOOKIEDELETE(StoreClient *client, const char *token) ccode = ConnWriteStr(client->conn, MSG5004INTERNALERR); } -finish: PurgeNLockRelease(lock); ReadNLockRelease(lock); diff --git a/src/agents/store/db.c b/src/agents/store/db.c index 7ef3f54..081fdbf 100644 --- a/src/agents/store/db.c +++ b/src/agents/store/db.c @@ -515,9 +515,9 @@ DStoreOpen(char *basepath, BongoMemStack *memstack, int locktimeoutms) create = access(path, 0); - if (!(handle = MemMalloc(sizeof(struct _DStoreHandle))) || - memset(handle, 0, sizeof(struct _DStoreHandle)), 0 || - SQLITE_OK != sqlite3_open(path, &handle->db)) + if (!(handle = MemMalloc(sizeof(struct _DStoreHandle))) || + (memset(handle, 0, sizeof(struct _DStoreHandle)), 0) || + (SQLITE_OK != sqlite3_open(path, &handle->db))) { XplConsolePrintf("NMAP: Failed to open dstore \"%s\".\r\n", path); @@ -1600,15 +1600,15 @@ DStoreSetProperty(DStoreHandle *handle, int DStoreSetPropertySimple(DStoreHandle *handle, uint64_t guid, - char *name, - char *value) + const char *name, + const char *value) { StorePropInfo prop; prop.type = STORE_PROP_EXTERNAL; - prop.name = name; - prop.value = value; + prop.name = (char *)name; + prop.value = (char *)value; prop.valueLen = strlen(value); return DStoreSetProperty(handle, guid, &prop); diff --git a/src/agents/store/db.h b/src/agents/store/db.h index 3ff7f5d..19da77d 100644 --- a/src/agents/store/db.h +++ b/src/agents/store/db.h @@ -161,8 +161,8 @@ int DStoreSetProperty(DStoreHandle *handle, int DStoreSetPropertySimple(DStoreHandle *handle, uint64_t guid, - char *name, - char *value); + const char *name, + const char *value); /* Conversations table */ DStoreStmt *DStoreListConversations(DStoreHandle *handle, diff --git a/src/agents/store/mail.c b/src/agents/store/mail.c index e3163e4..f41959b 100644 --- a/src/agents/store/mail.c +++ b/src/agents/store/mail.c @@ -245,7 +245,6 @@ StoreProcessIncomingMail(StoreClient *client, IncomingParseData data = {0, }; DStoreDocInfo oldConversation; BOOL haveOldConversation; - BOOL isNewConversation; FILE *fh; diff --git a/src/agents/store/store.c b/src/agents/store/store.c index c20b861..559bdec 100644 --- a/src/agents/store/store.c +++ b/src/agents/store/store.c @@ -268,7 +268,6 @@ CreateDatFile(char *path, int n, size_t len, char *name) int SetupStore(const char *user, const char **storeRoot, char *path, size_t len) { - const char *root; int n; struct stat sb; @@ -303,7 +302,7 @@ SetupStore(const char *user, const char **storeRoot, char *path, size_t len) path[n] = 0; - *storeRoot = root; + *storeRoot = NULL; return 0; } @@ -1211,10 +1210,6 @@ SelectUser(StoreClient *client, char *user, char *password, int nouser) // FIXME: I think we're supposed to refer to the correct store IP? strncpy(buf, "127.0.0.1", INET_ADDRSTRLEN); - //ccode = ConnWriteStr(client->conn, MSG5004INTERNALERR); - //goto finish; - -success: ccode = ConnWriteF(client->conn, "1000 %s\r\n", buf); if (nouser) {