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
56c01c95
Commit
56c01c95
authored
Jan 11, 2017
by
Guy Benoish
Browse files
enlarged buffer given to ld2string
parent
634b0966
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/object.c
View file @
56c01c95
...
@@ -145,7 +145,7 @@ robj *createStringObjectFromLongLong(long long value) {
...
@@ -145,7 +145,7 @@ robj *createStringObjectFromLongLong(long long value) {
*
*
* The 'humanfriendly' option is used for INCRBYFLOAT and HINCRBYFLOAT. */
* The 'humanfriendly' option is used for INCRBYFLOAT and HINCRBYFLOAT. */
robj
*
createStringObjectFromLongDouble
(
long
double
value
,
int
humanfriendly
)
{
robj
*
createStringObjectFromLongDouble
(
long
double
value
,
int
humanfriendly
)
{
char
buf
[
256
];
char
buf
[
MAX_LONG_DOUBLE_CHARS
];
int
len
=
ld2string
(
buf
,
sizeof
(
buf
),
value
,
humanfriendly
);
int
len
=
ld2string
(
buf
,
sizeof
(
buf
),
value
,
humanfriendly
);
return
createStringObject
(
buf
,
len
);
return
createStringObject
(
buf
,
len
);
}
}
...
...
src/t_hash.c
View file @
56c01c95
...
@@ -620,7 +620,7 @@ void hincrbyfloatCommand(client *c) {
...
@@ -620,7 +620,7 @@ void hincrbyfloatCommand(client *c) {
value
+=
incr
;
value
+=
incr
;
char
buf
[
256
];
char
buf
[
MAX_LONG_DOUBLE_CHARS
];
int
len
=
ld2string
(
buf
,
sizeof
(
buf
),
value
,
1
);
int
len
=
ld2string
(
buf
,
sizeof
(
buf
),
value
,
1
);
new
=
sdsnewlen
(
buf
,
len
);
new
=
sdsnewlen
(
buf
,
len
);
hashTypeSet
(
o
,
c
->
argv
[
2
]
->
ptr
,
new
,
HASH_SET_TAKE_VALUE
);
hashTypeSet
(
o
,
c
->
argv
[
2
]
->
ptr
,
new
,
HASH_SET_TAKE_VALUE
);
...
...
src/util.h
View file @
56c01c95
...
@@ -33,6 +33,11 @@
...
@@ -33,6 +33,11 @@
#include <stdint.h>
#include <stdint.h>
#include "sds.h"
#include "sds.h"
/* The maximum number of characters needed to represent a long double
* as a string (long double has a huge range).
* This should be the size of the buffer given to ld2string */
#define MAX_LONG_DOUBLE_CHARS 5*1024
int
stringmatchlen
(
const
char
*
p
,
int
plen
,
const
char
*
s
,
int
slen
,
int
nocase
);
int
stringmatchlen
(
const
char
*
p
,
int
plen
,
const
char
*
s
,
int
slen
,
int
nocase
);
int
stringmatch
(
const
char
*
p
,
const
char
*
s
,
int
nocase
);
int
stringmatch
(
const
char
*
p
,
const
char
*
s
,
int
nocase
);
long
long
memtoll
(
const
char
*
p
,
int
*
err
);
long
long
memtoll
(
const
char
*
p
,
int
*
err
);
...
...
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