Fixed deprecated library calls
This commit is contained in:
parent
96b0ad9b1d
commit
0aeb35c42e
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,11 +11,12 @@ string formatDuration(duration<double> seconds) {
|
|||
}
|
||||
|
||||
string formatTime(time_t time, const string& format) {
|
||||
tm* timeInfo = localtime(&time);
|
||||
tm timeInfo;
|
||||
localtime_s(&timeInfo, &time);
|
||||
std::vector<char> 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());
|
||||
|
|
Loading…
Reference in New Issue