Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
69298a05
Commit
69298a05
authored
Mar 13, 2011
by
Pieter Noordhuis
Browse files
Offset should be size_t
parent
72690afd
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/t_zset.c
View file @
69298a05
...
@@ -616,7 +616,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
...
@@ -616,7 +616,7 @@ unsigned char *zzlInsertAt(unsigned char *zl, unsigned char *eptr, robj *ele, do
unsigned
char
*
sptr
;
unsigned
char
*
sptr
;
char
scorebuf
[
128
];
char
scorebuf
[
128
];
int
scorelen
;
int
scorelen
;
in
t offset;
size_
t
offset
;
redisAssert
(
ele
->
encoding
==
REDIS_ENCODING_RAW
);
redisAssert
(
ele
->
encoding
==
REDIS_ENCODING_RAW
);
scorelen
=
d2string
(
scorebuf
,
sizeof
(
scorebuf
),
score
);
scorelen
=
d2string
(
scorebuf
,
sizeof
(
scorebuf
),
score
);
...
...
src/ziplist.c
View file @
69298a05
...
@@ -375,8 +375,8 @@ static unsigned char *ziplistResize(unsigned char *zl, unsigned int len) {
...
@@ -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
* The pointer "p" points to the first entry that does NOT need to be
* updated, i.e. consecutive fields MAY need an update. */
* updated, i.e. consecutive fields MAY need an update. */
static unsigned char *__ziplistCascadeUpdate(unsigned char *zl, unsigned char *p) {
static unsigned char *__ziplistCascadeUpdate(unsigned char *zl, unsigned char *p) {
unsigned in
t curlen = ZIPLIST_BYTES(zl), rawlen, rawlensize;
size_
t curlen = ZIPLIST_BYTES(zl), rawlen, rawlensize;
unsigned in
t offset, noffset, extra;
size_
t offset, noffset, extra;
unsigned char *np;
unsigned char *np;
zlentry cur, next;
zlentry cur, next;
...
@@ -431,7 +431,8 @@ static unsigned char *__ziplistCascadeUpdate(unsigned char *zl, unsigned char *p
...
@@ -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. */
/* Delete "num" entries, starting at "p". Returns pointer to the ziplist. */
static unsigned char *__ziplistDelete(unsigned char *zl, unsigned char *p, unsigned int num) {
static unsigned char *__ziplistDelete(unsigned char *zl, unsigned char *p, unsigned int num) {
unsigned int i, totlen, deleted = 0;
unsigned int i, totlen, deleted = 0;
int offset, nextdiff = 0;
size_t offset;
int nextdiff = 0;
zlentry first, tail;
zlentry first, tail;
first = zipEntry(p);
first = zipEntry(p);
...
@@ -483,8 +484,9 @@ static unsigned char *__ziplistDelete(unsigned char *zl, unsigned char *p, unsig
...
@@ -483,8 +484,9 @@ static unsigned char *__ziplistDelete(unsigned char *zl, unsigned char *p, unsig
/* Insert item at "p". */
/* Insert item at "p". */
static unsigned char *__ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char *s, unsigned int slen) {
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;
size_t curlen = ZIPLIST_BYTES(zl), reqlen, prevlen = 0;
unsigned int offset, nextdiff = 0;
size_t offset;
int nextdiff = 0;
unsigned char encoding = 0;
unsigned char encoding = 0;
long long value;
long long value;
zlentry entry, tail;
zlentry entry, tail;
...
@@ -668,7 +670,7 @@ unsigned char *ziplistInsert(unsigned char *zl, unsigned char *p, unsigned char
...
@@ -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
* Also update *p in place, to be able to iterate over the
* ziplist, while deleting entries. */
* ziplist, while deleting entries. */
unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p) {
unsigned char *ziplistDelete(unsigned char *zl, unsigned char **p) {
unsigned in
t offset = *p-zl;
size_
t offset = *p-zl;
zl = __ziplistDelete(zl,*p,1);
zl = __ziplistDelete(zl,*p,1);
/* Store pointer to current element in p, because ziplistDelete will
/* Store pointer to current element in p, because ziplistDelete will
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment