Skip to content

Commit

Permalink
Fix Xcode deprecation warning about sprintf usage
Browse files Browse the repository at this point in the history
  • Loading branch information
akien-mga committed Nov 6, 2024
1 parent 599d06c commit 6be81ca
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/io/logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,11 @@ void RotatedFileLogger::rotate_file() {

if (FileAccess::exists(base_path)) {
if (max_files > 1) {
char timestamp[21];
const size_t TIMESTAMP_SIZE = 21;
char timestamp[TIMESTAMP_SIZE];
OS::Date date = OS::get_singleton()->get_date();
OS::Time time = OS::get_singleton()->get_time();
sprintf(timestamp, "_%04d-%02d-%02d_%02d.%02d.%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);
snprintf(timestamp, TIMESTAMP_SIZE, "_%04d-%02d-%02d_%02d.%02d.%02d", date.year, date.month, date.day, time.hour, time.min, time.sec);

String backup_name = base_path.get_basename() + timestamp;
if (base_path.get_extension() != String()) {
Expand Down

0 comments on commit 6be81ca

Please sign in to comment.