Skip to content

Commit 8fc087b

Browse files
committed
maybe?
Signed-off-by: Rosen Penev <[email protected]>
1 parent 9680bb4 commit 8fc087b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

include/exiv2/basicio.hpp

+3
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ class EXIV2API FileIo : public BasicIo {
310310
Nonzero if failure.
311311
*/
312312
int open(const std::string& mode);
313+
#ifdef _WIN32
314+
int open(const std::wstring& mode);
315+
#endif
313316
/*!
314317
@brief Open the file using the default access mode of "rb".
315318
This method can also be used to "reopen" a file which will flush

src/basicio.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,11 @@ size_t FileIo::size() const {
481481

482482
int FileIo::open() {
483483
// Default open is in read-only binary mode
484+
#ifdef _WIN32
485+
return open(L"rb");
486+
#else
484487
return open("rb");
488+
#endif
485489
}
486490

487491
int FileIo::open(const std::string& mode) {
@@ -501,6 +505,16 @@ int FileIo::open(const std::string& mode) {
501505
return 0;
502506
}
503507

508+
#ifdef _WIN32
509+
int FileIo::open(const std::wstring& mode) {
510+
close();
511+
p_->opMode_ = Impl::opSeek;
512+
if (_wfopen_s(&p_->fp_, p_->wpath_.c_str(), mode.c_str()))
513+
return 1;
514+
return 0;
515+
}
516+
#endif
517+
504518
bool FileIo::isopen() const {
505519
return p_->fp_ != nullptr;
506520
}

0 commit comments

Comments
 (0)