aboutsummaryrefslogtreecommitdiffstats
path: root/src/fs/io
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-03-25 17:28:27 +0100
committerMax Kellermann <max@duempel.org>2015-03-25 17:28:27 +0100
commitcfd26f53f00e7222dab5f9ddaabc8ad3adfdc4b0 (patch)
tree205edcf1cc3c637401cfe8ac70cfd0257ed694f4 /src/fs/io
parent69ad5671edadb1862469597ebdde9f36b6e9b77f (diff)
downloadmpd-cfd26f53f00e7222dab5f9ddaabc8ad3adfdc4b0.tar.gz
mpd-cfd26f53f00e7222dab5f9ddaabc8ad3adfdc4b0.tar.xz
mpd-cfd26f53f00e7222dab5f9ddaabc8ad3adfdc4b0.zip
fs/io/FileOutputStream: fix wrong #ifdef WIN32
Diffstat (limited to 'src/fs/io')
-rw-r--r--src/fs/io/FileOutputStream.cxx26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/fs/io/FileOutputStream.cxx b/src/fs/io/FileOutputStream.cxx
index 265594c26..a4ef8f6b4 100644
--- a/src/fs/io/FileOutputStream.cxx
+++ b/src/fs/io/FileOutputStream.cxx
@@ -214,32 +214,16 @@ FileOutputStream::Cancel()
RemoveFile(GetPath());
}
-#ifdef WIN32
-
-FileOutputStream::FileOutputStream(Path _path, Error &error)
- :path(_path),
- handle(CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr,
- CREATE_ALWAYS,
- FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH,
- nullptr))
-{
- if (handle == INVALID_HANDLE_VALUE) {
- const auto path_utf8 = path.ToUTF8();
- error.FormatLastError("Failed to create %s",
- path_utf8.c_str());
- }
-}
-
-#else
+#endif
AppendFileOutputStream::AppendFileOutputStream(Path _path, Error &error)
:BaseFileOutputStream(_path)
{
#ifdef WIN32
- SetHandle(CreateFile(path.c_str(), GENERIC_WRITE, 0, nullptr,
+ SetHandle(CreateFile(GetPath().c_str(), GENERIC_WRITE, 0, nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH,
- nullptr))
+ nullptr));
if (!IsDefined())
error.FormatLastError("Failed to append to %s",
GetPath().ToUTF8().c_str());
@@ -257,8 +241,6 @@ AppendFileOutputStream::AppendFileOutputStream(Path _path, Error &error)
#endif
}
-#endif
-
bool
AppendFileOutputStream::Commit(gcc_unused Error &error)
{
@@ -274,5 +256,3 @@ AppendFileOutputStream::Commit(gcc_unused Error &error)
return success;
#endif
}
-
-#endif