8000 Print cursor as unsigned 64 bit integer · phpredis/phpredis@138d07b · GitHub
[go: up one dir, main page]

Skip to content

Commit 138d07b

Browse files
bentleyomichael-grunder
authored andcommitted
Print cursor as unsigned 64 bit integer
1 parent f68544f commit 138d07b

File tree

4 files changed

+13
-3
lines changed

4 files changed

+13
-3
lines changed

library.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,15 @@ int redis_cmd_append_sstr_i64(smart_string *str, int64_t append) {
10651065
return redis_cmd_append_sstr(str, nbuf, len);
10661066
}
10671067

1068+
/*
1069+
* Append a 64-bit unsigned integer to our command
1070+
*/
1071+
int redis_cmd_append_sstr_ui64(smart_string *str, uint64_t append) {
1072+
char nbuf[64];
1073+
int len = snprintf(nbuf, sizeof(nbuf), "%" PRIu64, append);
1074+
return redis_cmd_append_sstr(str, nbuf, len);
1075+
}
1076+
10681077
/*
10691078
* Append a double to a smart string command
10701079
*/

library.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int redis_cmd_append_sstr(smart_string *str, char *append, int append_len);
5050
int redis_cmd_append_sstr_int(smart_string *str, int append);
5151
int redis_cmd_append_sstr_long(smart_string *str, long append);
5252
int redis_cmd_append_sstr_i64(smart_string *str, int64_t append);
53+
int redis_cmd_append_sstr_ui64(smart_string *str, uint64_t append);
5354
int redis_cmd_append_sstr_dbl(smart_string *str, double value);
5455
int redis_cmd_append_sstr_zstr(smart_string *str, zend_string *zstr);
5556
int redis_cmd_append_sstr_zval(smart_string *str, zval *z, RedisSock *redis_sock);

redis_commands.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ int redis_key_dbl_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
574574

575575
/* Generic to construct SCAN and variant commands */
576576
int redis_fmt_scan_cmd(char **cmd, REDIS_SCAN_TYPE type, char *key, int key_len,
577-
long it, char *pat, int pat_len, long count)
577+
uint64_t it, char *pat, int pat_len, long count)
578578
{
579579
static char *kw[] = {"SCAN","SSCAN","HSCAN","ZSCAN"};
580580
int argc;
@@ -591,7 +591,7 @@ int redis_fmt_scan_cmd(char **cmd, REDIS_SCAN_TYPE type, char *key, int key_len,
591591
}
592592

593593
// Append cursor
594-
redis_cmd_append_sstr_long(&cmdstr, it);
594+
redis_cmd_append_sstr_ui64(&cmdstr, it);
595595

596596
// Append count if we've got one
597597
if (count) {

redis_commands.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ int redis_copy_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
309309
char **cmd, int *cmd_len, short *slot, void **ctx);
310310

311311
int redis_fmt_scan_cmd(char **cmd, REDIS_SCAN_TYPE type, char *key, int key_len,
312-
long it, char *pat, int pat_len, long count);
312+
uint64_t it, char *pat, int pat_len, long count);
313313

314314
int redis_geoadd_cmd(INTERNAL_FUNCTION_PARAMETERS, RedisSock *redis_sock,
315315
char **cmd, int *cmd_len, short *slot, void **ctx);

0 commit comments

Comments
 (0)
0