fix: clang warning about deprecated sprintf usage (#4747)

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
This commit is contained in:
Chenna Keshava B S
2024-01-15 22:32:52 -08:00
committed by GitHub
parent d9f90c84c0
commit 5a7af5bb77

View File

@@ -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