Fix compiler warnings, Linux gcc 4.7.2

This commit is contained in:
Andrew Bettison 2013-01-08 17:20:42 +10:30
parent 09617b9ce0
commit b0f0262e18
2 changed files with 17 additions and 16 deletions

View File

@ -1,6 +1,7 @@
#include "serval.h"
#include "rhizome.h"
#include "conf.h"
#include "strlcpy.h"
#define RHIZOME_BUFFER_MAXIMUM_SIZE (1024*1024)
@ -40,19 +41,18 @@ int rhizome_open_write(struct rhizome_write *write, char *expectedFileHash, int6
int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset);
*/
sqlite3_stmt *statement = NULL;
int ret=sqlite_exec_void_retry(&retry,
"INSERT OR REPLACE INTO FILES(id,length,highestpriority,datavalid,inserttime) VALUES('%s',%lld,%d,0,%lld);",
write->id, (long long)file_length, priority, (long long)gettime_ms());
if (ret!=SQLITE_OK) {
WHYF("Failed to insert into files: %s",
sqlite3_errmsg(rhizome_db));
WHYF("Failed to insert into files: %s", sqlite3_errmsg(rhizome_db));
goto insert_row_fail;
}
sqlite3_stmt *statement = sqlite_prepare(&retry,"INSERT OR REPLACE INTO FILEBLOBS(id,data) VALUES('%s',?)",write->id);
statement = sqlite_prepare(&retry,"INSERT OR REPLACE INTO FILEBLOBS(id,data) VALUES('%s',?)",write->id);
if (!statement) {
WHYF("Failed to insert into fileblobs: %s",
sqlite3_errmsg(rhizome_db));
WHYF("Failed to insert into fileblobs: %s", sqlite3_errmsg(rhizome_db));
goto insert_row_fail;
}
@ -67,7 +67,6 @@ int rhizome_open_write(struct rhizome_write *write, char *expectedFileHash, int6
int stepcode;
while ((stepcode = _sqlite_step_retry(__WHENCE__, LOG_LEVEL_ERROR, &retry, statement)) == SQLITE_ROW)
++rowcount;
if (rowcount)
WARNF("void query unexpectedly returned %d row%s", rowcount, rowcount == 1 ? "" : "s");

View File

@ -20,7 +20,9 @@
#ifndef __STRLCPY_H__
#define __STRLCPY_H__
#ifndef HAVE_STRLCPY
#ifdef HAVE_STRLCPY
#include <bsd/string.h>
#else
size_t strlcpy(char *dst, const char *src, size_t sz);
#endif