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;
/* 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);
}
#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);
/* 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 ---------------------------
* 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;
* 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;