Skip to content

Commit 8e7ad94

Browse files
committed
hrm
Signed-off-by: Rosen Penev <[email protected]>
1 parent dde3c24 commit 8e7ad94

File tree

1 file changed

+0
-49
lines changed

1 file changed

+0
-49
lines changed

src/basicio.cpp

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ class FileIo::Impl {
7676
// DATA
7777
fs::path path_; //!< (Standard) path
7878
std::string openMode_; //!< File open mode
79-
std::wstring wOpenMode_; //!< File open mode (wide)
8079
FILE* fp_{}; //!< File stream pointer
8180
OpMode opMode_{opSeek}; //!< File open mode
8281

@@ -120,19 +119,6 @@ int FileIo::Impl::switchMode(OpMode opMode) {
120119

121120
bool reopen = true;
122121
switch (opMode) {
123-
#ifdef _WIN32
124-
case opRead:
125-
// Flush if current mode allows reading, else reopen (in mode "r+b"
126-
// as in this case we know that we can write to the file)
127-
if (wOpenMode_.front() == L'r' || wOpenMode_.at(1) == L'+')
128-
reopen = false;
129-
break;
130-
case opWrite:
131-
// Flush if current mode allows writing, else reopen
132-
if (wOpenMode_.front() != L'r' || wOpenMode_.at(1) == L'+')
133-
reopen = false;
134-
break;
135-
#else
136122
case opRead:
137123
// Flush if current mode allows reading, else reopen (in mode "r+b"
138124
// as in this case we know that we can write to the file)
@@ -144,7 +130,6 @@ int FileIo::Impl::switchMode(OpMode opMode) {
144130
if (openMode_.front() != 'r' || openMode_.at(1) == '+')
145131
reopen = false;
146132
break;
147-
#endif
148133
case opSeek:
149134
reopen = false;
150135
break;
@@ -355,11 +340,7 @@ size_t FileIo::write(BasicIo& src) {
355340

356341
void FileIo::transfer(BasicIo& src) {
357342
const bool wasOpen = (p_->fp_ != nullptr);
358-
#ifdef _WIN32
359-
const std::wstring lastMode(p_->wOpenMode_);
360-
#else
361343
const std::string lastMode(p_->openMode_);
362-
#endif
363344

364345
if (auto fileIo = dynamic_cast<FileIo*>(&src)) {
365346
// Optimization if src is another instance of FileIo
@@ -485,11 +466,7 @@ size_t FileIo::tell() const {
485466

486467
size_t FileIo::size() const {
487468
// Flush and commit only if the file is open for writing
488-
#ifdef _WIN32
489-
if (p_->fp_ && (p_->wOpenMode_.front() != L'r' || p_->wOpenMode_.at(1) == L'+')) {
490-
#else
491469
if (p_->fp_ && (p_->openMode_.front() != 'r' || p_->openMode_.at(1) == '+')) {
492-
#endif
493470
std::fflush(p_->fp_);
494471
#ifdef _MSC_VER
495472
// This is required on msvcrt before stat after writing to a file
@@ -505,11 +482,7 @@ size_t FileIo::size() const {
505482

506483
int FileIo::open() {
507484
// Default open is in read-only binary mode
508-
#ifdef _WIN32
509-
return open(L"rb");
510-
#else
511485
return open("rb");
512-
#endif
513486
}
514487

515488
int FileIo::open(const std::string& mode) {
@@ -521,16 +494,6 @@ int FileIo::open(const std::string& mode) {
521494
return 1;
522495
return 0;
523496
}
524-
525-
#ifdef _WIN32
526-
int FileIo::open(const std::wstring& mode) {
527-
close();
528-
p_->wOpenMode_ = mode;
529-
p_->opMode_ = Impl::opSeek;
530-
if (_wfopen_s(&p_->fp_, p_->path_.c_str(), mode.c_str()))
531-
return 1;
532-
return 0;
533-
}
534497
#endif
535498

536499
bool FileIo::isopen() const {
@@ -590,7 +553,6 @@ const std::string& FileIo::path() const noexcept {
590553

591554
void FileIo::populateFakeData() {
592555
}
593-
#endif
594556

595557
//! Internal Pimpl structure of class MemIo.
596558
class MemIo::Impl final {
@@ -1679,17 +1641,6 @@ size_t writeFile(const DataBuf& buf, const std::string& path) {
16791641
}
16801642
return file.write(buf.c_data(), buf.size());
16811643
}
1682-
1683-
#ifdef _WIN32
1684-
DataBuf readFile(const std::wstring& path) {
1685-
FileIo file(path);
1686-
if (file.open(L"rb") != 0)
1687-
throw Error(ErrorCode::kerFileOpenFailed, "wb", strError());
1688-
DataBuf buf(static_cast<size_t>(fs::file_size(path)));
1689-
file.read(buf.data(), buf.size());
1690-
return buf;
1691-
}
1692-
#endif
16931644
#endif
16941645

16951646
#ifdef EXV_USE_CURL

0 commit comments

Comments
 (0)