From 0aeb35c42ec61cf6a55d7e538e1a27065f57bc84 Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Sun, 26 Jun 2016 11:06:44 +0200 Subject: [PATCH] Fixed deprecated library calls --- src/audio/WaveFileReader.cpp | 4 +++- src/tools.cpp | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/audio/WaveFileReader.cpp b/src/audio/WaveFileReader.cpp index c3cdf64..f04e9d6 100644 --- a/src/audio/WaveFileReader.cpp +++ b/src/audio/WaveFileReader.cpp @@ -164,7 +164,9 @@ void WaveFileReader::openFile() { file.seekg(0); } } catch (const std::ifstream::failure&) { - throw runtime_error(strerror(errno)); + char message[256]; + strerror_s(message, sizeof message, errno); + throw runtime_error(message); } } diff --git a/src/tools.cpp b/src/tools.cpp index 81caec2..5ad0242 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -11,11 +11,12 @@ string formatDuration(duration seconds) { } string formatTime(time_t time, const string& format) { - tm* timeInfo = localtime(&time); + tm timeInfo; + localtime_s(&timeInfo, &time); std::vector buffer(20); bool success = false; while (!success) { - success = strftime(buffer.data(), buffer.size(), format.c_str(), timeInfo) != 0; + success = strftime(buffer.data(), buffer.size(), format.c_str(), &timeInfo) != 0; if (!success) buffer.resize(buffer.size() * 2); } return string(buffer.data());