Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/emitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ static kdl_owned_string _float_to_string(double f, kdl_float_printing_options co

bool negative = f < 0.0;
f = fabs(f);
int exponent = (int)floor(log10(f));
int exponent = f != 0.0 ? (int)floor(log10(f)) : 0;
double exp_factor = 1.0;
if (abs(exponent) < opts->min_exponent) {
// don't use scientific notation
Expand Down
4 changes: 3 additions & 1 deletion src/tokenizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ static size_t _refill_tokenizer(kdl_tokenizer* self)
self->document.len = 0;
}
// Move whatever data is left unparsed to the top of the buffer
memmove(self->buffer, self->document.data, self->document.len);
if (self->document.len > 0) {
memmove(self->buffer, self->document.data, self->document.len);
}
self->document.data = self->buffer;
size_t len_available = self->buffer_size - self->document.len;
if (len_available < MIN_BUFFER_SIZE) {
Expand Down
Loading