Skip to content

Commit

Permalink
Offset should be size_t
Browse files Browse the repository at this point in the history
  • Loading branch information
pietern committed Mar 14, 2011
1 parent 72690af commit 69298a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/t_zset.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
unsigned char *sptr;
char scorebuf[128];
int scorelen;
int offset;
size_t offset;

redisAssert(ele->encoding == REDIS_ENCODING_RAW);
scorelen = d2string(scorebuf,sizeof(scorebuf),score);
Expand Down
14 changes: 8 additions & 6 deletions src/ziplist.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ static unsigned char *ziplistResize(unsigned char *zl, unsigned int len) {
* The pointer "p" points to the first entry that does NOT need to be
* updated, i.e. consecutive fields MAY need an update. */
static unsigned char *__ziplistCascadeUpdate(unsigned char *zl, unsigned char *p) {
unsigned int curlen = ZIPLIST_BYTES(zl), rawlen, rawlensize;
unsigned int offset, noffset, extra;
size_t curlen = ZIPLIST_BYTES(zl), rawlen, rawlensize;
size_t offset, noffset, extra;
unsigned char *np;
zlentry cur, next;

Expand Down Expand Up @@ -431,7 +431,8 @@ static unsigned char *__ziplistCascadeUpdate(unsigned char *zl, unsigned char *p
/* Delete "num" entries, starting at "p". Returns pointer to the ziplist. */
static unsigned char *__ziplistDelete(unsigned char *zl, unsigned char *p, unsigned int num) {
unsigned int i, totlen, deleted = 0;
int offset, nextdiff = 0;
size_t offset;
int nextdiff = 0;
zlentry first, tail;

first = zipEntry(p);
Expand Down Expand Up @@ -483,8 +484,9 @@ static unsigned char *__ziplistDelete(unsigned char *zl, unsigned char *p, unsig

/* Insert item at "p". */
static unsigned char *__ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char *s, unsigned int slen) {
unsigned int curlen = ZIPLIST_BYTES(zl), reqlen, prevlen = 0;
unsigned int offset, nextdiff = 0;
size_t curlen = ZIPLIST_BYTES(zl), reqlen, prevlen = 0;
size_t offset;
int nextdiff = 0;
unsigned char encoding = 0;
long long value;
zlentry entry, tail;
Expand Down Expand Up @@ -668,7 +670,7 @@ unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char
* Also update *p in place, to be able to iterate over the
* ziplist, while deleting entries. */
unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p) {
unsigned int offset = *p-zl;
size_t offset = *p-zl;
zl = __ziplistDelete(zl,*p,1);

/* Store pointer to current element in p, because ziplistDelete will
Expand Down

0 comments on commit 69298a0

Please sign in to comment.