Skip to content

Commit

Permalink
fix: clang warning about deprecated sprintf usage (#4747)
Browse files Browse the repository at this point in the history
Resolves a warning that was emitted from the clang compiler. Switches
usage of the sprintf function to the recommended snprintf function.

Warning was observed in Apple clang version 15.0.0 (clang-1500.0.40.1).

Fix #4569
  • Loading branch information
ckeshava authored Jan 16, 2024
1 parent d9f90c8 commit 5a7af5b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/ripple/json/impl/json_reader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,10 +922,8 @@ Reader::getLocationLineAndColumn(Location location) const
{
int line, column;
getLocationLineAndColumn(location, line, column);
constexpr std::size_t n = 18 + 16 + 16 + 1;
char buffer[n];
snprintf(buffer, n, "Line %d, Column %d", line, column);
return buffer;
return "Line " + std::to_string(line) + ", Column " +
std::to_string(column);
}

std::string
Expand Down

0 comments on commit 5a7af5b

Please sign in to comment.