aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp')
-rw-r--r--contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp194
1 files changed, 97 insertions, 97 deletions
diff --git a/contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp b/contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp
index 87dbbbf3e5..49de80efac 100644
--- a/contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp
+++ b/contrib/libs/poco/Foundation/src/PipeImpl_WIN32.cpp
@@ -1,97 +1,97 @@
-//
-// PipeImpl_WIN32.cpp
-//
-// Library: Foundation
-// Package: Processes
-// Module: PipeImpl
-//
-// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
-// and Contributors.
-//
-// SPDX-License-Identifier: BSL-1.0
-//
-
-
-#include "Poco/PipeImpl_WIN32.h"
-#include "Poco/Exception.h"
-
-
-namespace Poco {
-
-
-PipeImpl::PipeImpl()
-{
- SECURITY_ATTRIBUTES attr;
- attr.nLength = sizeof(attr);
- attr.lpSecurityDescriptor = NULL;
- attr.bInheritHandle = FALSE;
-
- if (!CreatePipe(&_readHandle, &_writeHandle, &attr, 0))
- throw CreateFileException("anonymous pipe");
-}
-
-
-PipeImpl::~PipeImpl()
-{
- closeRead();
- closeWrite();
-}
-
-
-int PipeImpl::writeBytes(const void* buffer, int length)
-{
- poco_assert (_writeHandle != INVALID_HANDLE_VALUE);
-
- DWORD bytesWritten = 0;
- if (!WriteFile(_writeHandle, buffer, length, &bytesWritten, NULL))
- throw WriteFileException("anonymous pipe");
- return bytesWritten;
-}
-
-
-int PipeImpl::readBytes(void* buffer, int length)
-{
- poco_assert (_readHandle != INVALID_HANDLE_VALUE);
-
- DWORD bytesRead = 0;
- BOOL ok = ReadFile(_readHandle, buffer, length, &bytesRead, NULL);
- if (ok || GetLastError() == ERROR_BROKEN_PIPE)
- return bytesRead;
- else
- throw ReadFileException("anonymous pipe");
-}
-
-
-PipeImpl::Handle PipeImpl::readHandle() const
-{
- return _readHandle;
-}
-
-
-PipeImpl::Handle PipeImpl::writeHandle() const
-{
- return _writeHandle;
-}
-
-
-void PipeImpl::closeRead()
-{
- if (_readHandle != INVALID_HANDLE_VALUE)
- {
- CloseHandle(_readHandle);
- _readHandle = INVALID_HANDLE_VALUE;
- }
-}
-
-
-void PipeImpl::closeWrite()
-{
- if (_writeHandle != INVALID_HANDLE_VALUE)
- {
- CloseHandle(_writeHandle);
- _writeHandle = INVALID_HANDLE_VALUE;
- }
-}
-
-
-} // namespace Poco
+//
+// PipeImpl_WIN32.cpp
+//
+// Library: Foundation
+// Package: Processes
+// Module: PipeImpl
+//
+// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
+// and Contributors.
+//
+// SPDX-License-Identifier: BSL-1.0
+//
+
+
+#include "Poco/PipeImpl_WIN32.h"
+#include "Poco/Exception.h"
+
+
+namespace Poco {
+
+
+PipeImpl::PipeImpl()
+{
+ SECURITY_ATTRIBUTES attr;
+ attr.nLength = sizeof(attr);
+ attr.lpSecurityDescriptor = NULL;
+ attr.bInheritHandle = FALSE;
+
+ if (!CreatePipe(&_readHandle, &_writeHandle, &attr, 0))
+ throw CreateFileException("anonymous pipe");
+}
+
+
+PipeImpl::~PipeImpl()
+{
+ closeRead();
+ closeWrite();
+}
+
+
+int PipeImpl::writeBytes(const void* buffer, int length)
+{
+ poco_assert (_writeHandle != INVALID_HANDLE_VALUE);
+
+ DWORD bytesWritten = 0;
+ if (!WriteFile(_writeHandle, buffer, length, &bytesWritten, NULL))
+ throw WriteFileException("anonymous pipe");
+ return bytesWritten;
+}
+
+
+int PipeImpl::readBytes(void* buffer, int length)
+{
+ poco_assert (_readHandle != INVALID_HANDLE_VALUE);
+
+ DWORD bytesRead = 0;
+ BOOL ok = ReadFile(_readHandle, buffer, length, &bytesRead, NULL);
+ if (ok || GetLastError() == ERROR_BROKEN_PIPE)
+ return bytesRead;
+ else
+ throw ReadFileException("anonymous pipe");
+}
+
+
+PipeImpl::Handle PipeImpl::readHandle() const
+{
+ return _readHandle;
+}
+
+
+PipeImpl::Handle PipeImpl::writeHandle() const
+{
+ return _writeHandle;
+}
+
+
+void PipeImpl::closeRead()
+{
+ if (_readHandle != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(_readHandle);
+ _readHandle = INVALID_HANDLE_VALUE;
+ }
+}
+
+
+void PipeImpl::closeWrite()
+{
+ if (_writeHandle != INVALID_HANDLE_VALUE)
+ {
+ CloseHandle(_writeHandle);
+ _writeHandle = INVALID_HANDLE_VALUE;
+ }
+}
+
+
+} // namespace Poco