Skip to content

Commit 6560e9c

Browse files
committed
MDEV-11711: ArmHF EXPLAIN JSON garbage longlong values printed
Make sure printing with snprintf uses the correct typed parameters.
1 parent eddbae4 commit 6560e9c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

sql/my_json_writer.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void Json_writer::start_element()
125125
void Json_writer::add_ll(longlong val)
126126
{
127127
char buf[64];
128-
my_snprintf(buf, sizeof(buf), "%ld", val);
128+
my_snprintf(buf, sizeof(buf), "%lld", val);
129129
add_unquoted_str(buf);
130130
}
131131

@@ -135,16 +135,16 @@ void Json_writer::add_size(longlong val)
135135
{
136136
char buf[64];
137137
if (val < 1024)
138-
my_snprintf(buf, sizeof(buf), "%ld", val);
138+
my_snprintf(buf, sizeof(buf), "%lld", val);
139139
else if (val < 1024*1024*16)
140140
{
141141
/* Values less than 16MB are specified in KB for precision */
142-
size_t len= my_snprintf(buf, sizeof(buf), "%ld", val/1024);
142+
size_t len= my_snprintf(buf, sizeof(buf), "%lld", val/1024);
143143
strcpy(buf + len, "Kb");
144144
}
145145
else
146146
{
147-
size_t len= my_snprintf(buf, sizeof(buf), "%ld", val/(1024*1024));
147+
size_t len= my_snprintf(buf, sizeof(buf), "%lld", val/(1024*1024));
148148
strcpy(buf + len, "Mb");
149149
}
150150
add_str(buf);

0 commit comments

Comments
 (0)