Skip to content

Commit

Permalink
fix XRPLF#4569: clang warning about deprecated sprintf usage.
Browse files Browse the repository at this point in the history
Instead of sprintf use the suggested snprintf function
  • Loading branch information
ckeshava committed Jul 3, 2023
1 parent f18c6df commit 4580b25
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/ripple/basics/impl/contract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <ripple/basics/Log.h>
#include <ripple/basics/contract.h>
#include <cstdlib>
#include <exception>
#include <iostream>

namespace ripple {
Expand Down
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 @@ -22,7 +22,6 @@

#include <algorithm>
#include <cctype>
#include <cstdint>
#include <istream>
#include <string>

Expand Down Expand Up @@ -924,9 +923,8 @@ Reader::getLocationLineAndColumn(Location location) const
{
int line, column;
getLocationLineAndColumn(location, line, column);
char buffer[18 + 16 + 16 + 1];
sprintf(buffer, "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 4580b25

Please sign in to comment.