Skip to content

Commit

Permalink
maybe fix snprintf warning
Browse files Browse the repository at this point in the history
  • Loading branch information
paleolimbot committed Jun 24, 2024
1 parent 10cdfbb commit 6141873
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/s2/util/math/exactfloat/exactfloat.cc
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ std::string ExactFloat::ToStringWithMaxDigits(int max_digits) const {
str.append(digits.begin() + 1, digits.end());
}
char exp_buf[20];
sprintf(exp_buf, "e%+02d", exp10 - 1);
snprintf(exp_buf, sizeof(exp_buf), "e%+02d", exp10 - 1);
str += exp_buf;
} else {
// Use fixed format. We split this into two cases depending on whether
Expand Down Expand Up @@ -518,7 +518,7 @@ int ExactFloat::GetDecimalDigits(int max_digits, std::string* digits) const {

std::string ExactFloat::ToUniqueString() const {
char prec_buf[20];
sprintf(prec_buf, "<%d>", prec());
snprintf(prec_buf, sizeof(prec_buf), "<%d>", prec());
return ToString() + prec_buf;
}

Expand Down

0 comments on commit 6141873

Please sign in to comment.