Skip to content

Commit

Permalink
fix: clang warning about deprecated sprintf usage (XRPLF#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 XRPLF#4569
  • Loading branch information
ckeshava authored and sophiax851 committed Jun 12, 2024
1 parent 1919145 commit 1de544d
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 1de544d

Please sign in to comment.