summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xplist.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/xplist.c b/src/xplist.c
index 263d88e..2eaba55 100644
--- a/src/xplist.c
+++ b/src/xplist.c
@@ -113,7 +113,7 @@ static size_t dtostr(char *buf, size_t bufsize, double realval)
} else {
size_t i = 0;
len = snprintf(buf, bufsize, "%.*g", 17, realval);
- for (i = 0; i < len; i++) {
+ for (i = 0; buf && i < len; i++) {
if (buf[i] == ',') {
buf[i] = '.';
break;
@@ -479,7 +479,7 @@ static void node_estimate_size(node_t *node, uint64_t *size, uint32_t depth)
*size += (XPLIST_INT_LEN << 1) + 6;
break;
case PLIST_REAL:
- *size += num_digits_i((int64_t)data->realval) + 7;
+ *size += dtostr(NULL, 0, data->realval);
*size += (XPLIST_REAL_LEN << 1) + 6;
break;
case PLIST_DATE: