summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cleanup.c1
-rw-r--r--src/context.c4
-rw-r--r--src/dbutil.c2
-rw-r--r--src/diff.c3
-rw-r--r--src/list.c1
-rw-r--r--src/md5util.c10
-rw-r--r--src/merge.c1
-rw-r--r--src/package.c5
-rw-r--r--src/package.h4
-rw-r--r--src/util.c6
10 files changed, 18 insertions, 19 deletions
diff --git a/src/cleanup.c b/src/cleanup.c
index f362240..6d1b009 100644
--- a/src/cleanup.c
+++ b/src/cleanup.c
@@ -29,6 +29,7 @@
#include "syrep.h"
#include "util.h"
+#include "cleanup.h"
int cleanup(const char *root) {
char p[PATH_MAX];
diff --git a/src/context.c b/src/context.c
index 84dd4b1..c7289df 100644
--- a/src/context.c
+++ b/src/context.c
@@ -75,7 +75,7 @@ int db_context_free(struct syrep_db_context* c) {
}
-static DB* open_db(const char*path, int dup, int recno) {
+static DB* open_db(const char*path, int dupsort, int recno) {
int ret;
DB* db;
@@ -84,7 +84,7 @@ static DB* open_db(const char*path, int dup, int recno) {
return NULL;
}
- if (dup && !recno)
+ if (dupsort && !recno)
db->set_flags(db, DB_DUPSORT);
//db->set_pagesize(db, 4096*8);
diff --git a/src/dbutil.c b/src/dbutil.c
index fee6ab1..324e444 100644
--- a/src/dbutil.c
+++ b/src/dbutil.c
@@ -240,7 +240,7 @@ static uint32_t csum_name(const struct syrep_name *name) {
assert(name);
a = adler32(0, NULL, 0);
- a = adler32(a, (uint8_t*) name->path, strlen(name->path));
+ a = adler32(a, (const uint8_t*) name->path, strlen(name->path));
/*fprintf(stderr, "csum: %s -> %u\n", name->path, a);*/
diff --git a/src/diff.c b/src/diff.c
index 7f97ba7..ccb4287 100644
--- a/src/diff.c
+++ b/src/diff.c
@@ -308,7 +308,8 @@ static int list_cb(DB *ddb, struct syrep_name *name, struct diff_entry *de, void
switch (de->action) {
case DIFF_COPY: {
char d[33];
- char sizet[100] = " ", *psizet = "";
+ char sizet[100] = " ";
+ const char *psizet = "";
char dst;
const char *root = NULL;
int mf;
diff --git a/src/list.c b/src/list.c
index 1018f8a..bd5523b 100644
--- a/src/list.c
+++ b/src/list.c
@@ -180,7 +180,6 @@ int list(struct syrep_db_context *c) {
if (!m_sort_array) {
DB_BTREE_STAT *statp;
- int ret;
if ((ret = c->db_id_meta->stat(c->db_id_meta, NULL, &statp, 0)) != 0)
break;
diff --git a/src/md5util.c b/src/md5util.c
index 209f0bb..d5cc45d 100644
--- a/src/md5util.c
+++ b/src/md5util.c
@@ -98,19 +98,19 @@ int fdmd5(int fd, off_t l, uint8_t md[]) {
}
while (l) {
- ssize_t r;
+ ssize_t k;
- if ((r = read(fd, p, BUFSIZE)) < 0) {
+ if ((k = read(fd, p, BUFSIZE)) < 0) {
fprintf(stderr, "read(): %s\n", strerror(errno));
goto finish;
}
- if (!r)
+ if (!k)
break;
- md5_append(&s, p, r);
+ md5_append(&s, p, k);
- l -= r;
+ l -= k;
}
}
diff --git a/src/merge.c b/src/merge.c
index 7cca266..0aad797 100644
--- a/src/merge.c
+++ b/src/merge.c
@@ -37,6 +37,7 @@
#include "dbutil.h"
#include "package.h"
#include "util.h"
+#include "merge.h"
struct cb_info {
struct syrep_db_context *c1; /* remote */
diff --git a/src/package.c b/src/package.c
index 89d16cb..8ae6508 100644
--- a/src/package.c
+++ b/src/package.c
@@ -40,9 +40,6 @@
#include "util.h"
#include "syrep.h"
-/* Import mkdtemp */
-char *mkdtemp(char *template);
-
struct package_item;
struct package_item {
@@ -269,7 +266,7 @@ finish:
}
static char *tmp(char *fn, int l) {
- char *t;
+ const char *t;
if (!(t = getenv("TMPDIR")))
if (!(t = getenv("TEMP")))
diff --git a/src/package.h b/src/package.h
index 42486ad..cdb0222 100644
--- a/src/package.h
+++ b/src/package.h
@@ -23,8 +23,8 @@
#include <inttypes.h>
-#define PACKAGE_FILEID (*((uint32_t*) "SREP"))
-#define PACKAGE_FILEIDCOMPRESSED (*((uint32_t*) "CREP"))
+#define PACKAGE_FILEID (*((const uint32_t*) "SREP"))
+#define PACKAGE_FILEIDCOMPRESSED (*((const uint32_t*) "CREP"))
#define PACKAGE_ITEMNAMELEN 32
diff --git a/src/util.c b/src/util.c
index 964e36f..96b99c1 100644
--- a/src/util.c
+++ b/src/util.c
@@ -296,7 +296,7 @@ int copy_fd(int sfd, int dfd, off_t l) {
while (l > 0) {
off_t n;
- size_t m = MIN(l, BUFSIZE);
+ m = MIN(l, BUFSIZE);
if ((n = loop_read(sfd, buf, m)) != m) {
@@ -761,13 +761,13 @@ ssize_t loop_write(int fd, const void *d, size_t l) {
ssize_t r;
if ((r = write(fd, p, l)) <= 0)
- return p-(uint8_t*)d > 0 ? p-(uint8_t*) d : r;
+ return p-(const uint8_t*)d > 0 ? p-(const uint8_t*) d : r;
p += r;
l -= r;
}
- return p-(uint8_t*) d;
+ return p-(const uint8_t*) d;
}
char *snprint_off(char *s, size_t l, off_t off) {