Skip to content

Commit 567302c

Browse files
committed
use strerror_s under Windows
strerror is deprecated.
1 parent e757ca1 commit 567302c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/futils.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ std::string strError() {
256256
if (os.empty()) {
257257
os = std::strerror(error);
258258
}
259+
#elif defined(_WIN32)
260+
const size_t n = 1024;
261+
char buf[n] = {};
262+
const auto ret = strerror_s(buf, n, error);
263+
Internal::enforce(ret != ERANGE, Exiv2::ErrorCode::kerCallFailed);
264+
os = buf;
259265
#else
260266
os = std::strerror(error);
261267
#endif

0 commit comments

Comments
 (0)