diff --git a/src/rdb.c b/src/rdb.c index 3f1e22520..3667f279e 100644 --- a/src/rdb.c +++ b/src/rdb.c @@ -717,7 +717,7 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) { size_t len; unsigned int i; - redisLog(REDIS_DEBUG,"LOADING OBJECT %d (at %d)\n",rdbtype,rdbTell(rdb)); + redisLog(REDIS_DEBUG,"LOADING OBJECT %d (at %d)\n",rdbtype,rioTell(rdb)); if (rdbtype == REDIS_RDB_TYPE_STRING) { /* Read string value */ if ((o = rdbLoadEncodedStringObject(rdb)) == NULL) return NULL; @@ -1039,7 +1039,7 @@ int rdbLoad(char *filename) { /* Serve the clients from time to time */ if (!(loops++ % 1000)) { - loadingProgress(rdbTell(&rdb)); + loadingProgress(rioTell(&rdb)); aeProcessEvents(server.el, AE_FILE_EVENTS|AE_DONT_WAIT); } diff --git a/src/rio.c b/src/rio.c index bb977c740..44165d715 100644 --- a/src/rio.c +++ b/src/rio.c @@ -18,6 +18,8 @@ #include "rio.h" #include "util.h" +uint64_t crc64(uint64_t crc, const unsigned char *s, uint64_t l); + /* Returns 1 or 0 for success/failure. */ static size_t rioBufferWrite(rio *r, const void *buf, size_t len) { r->io.buffer.ptr = sdscatlen(r->io.buffer.ptr,(char*)buf,len); @@ -86,7 +88,7 @@ void rioInitWithBuffer(rio *r, sds s) { /* This function can be installed both in memory and file streams when checksum * computation is needed. */ void rioGenericUpdateChecksum(rio *r, const void *buf, size_t len) { - r->checksum = crc64(r->checksum,buf,len); + r->cksum = crc64(r->cksum,buf,len); } /* ------------------------------ Higher level interface --------------------------- diff --git a/src/rio.h b/src/rio.h index 31746303c..9012856ff 100644 --- a/src/rio.h +++ b/src/rio.h @@ -16,7 +16,7 @@ struct _rio { * data that was read or written so far. The method should be designed so that * can be called with the current checksum, and the buf and len fields pointing * to the new block of data to add to the checksum computation. */ - void (*update_cksum)(struct _rio *, void *buf, size_t len); + void (*update_cksum)(struct _rio *, const void *buf, size_t len); /* The current checksum */ uint64_t cksum; @@ -40,13 +40,13 @@ typedef struct _rio rio; * if needed. */ inline size_t rioWrite(rio *r, const void *buf, size_t len) { - if (r->udpate_cksum) r->update_cksum(r,buf,len); + if (r->update_cksum) r->update_cksum(r,buf,len); return r->write(r,buf,len); } inline size_t rioRead(rio *r, void *buf, size_t len) { if (r->read(r,buf,len) == 1) { - if (r->udpate_cksum) r->update_cksum(r,buf,len); + if (r->update_cksum) r->update_cksum(r,buf,len); return 1; } return 0;