aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2016-11-03 00:50:07 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2016-11-03 00:50:07 +0300
commitaea4e5401af4e28a32d99e0e3c2ecd42888c2ba4 (patch)
tree161c99fc55f09e6c124f28dff44f6bd6c7f36295
parentda81a95f765302959ccc8293d0b1d566b5234297 (diff)
Adopt to auto_fd introduced to libbutl fdstreams and process
-rw-r--r--bpkg/archive.cxx2
-rw-r--r--bpkg/auth.cxx18
-rw-r--r--bpkg/checksum.cxx12
-rw-r--r--bpkg/fetch.cxx8
-rw-r--r--bpkg/pkg-verify.cxx2
-rw-r--r--bpkg/satisfaction.cxx2
6 files changed, 23 insertions, 21 deletions
diff --git a/bpkg/archive.cxx b/bpkg/archive.cxx
index da381a4..89bb0ed 100644
--- a/bpkg/archive.cxx
+++ b/bpkg/archive.cxx
@@ -101,7 +101,7 @@ namespace bpkg
// Do not throw when eofbit is set (end of stream reached), and
// when failbit is set (getline() failed to extract any character).
//
- ifdstream is (pr.in_ofd, ifdstream::badbit);
+ ifdstream is (move (pr.in_ofd), ifdstream::badbit);
string s;
getline (is, s, '\0');
diff --git a/bpkg/auth.cxx b/bpkg/auth.cxx
index 75cdb45..4ea0e4b 100644
--- a/bpkg/auth.cxx
+++ b/bpkg/auth.cxx
@@ -119,8 +119,8 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
- ofdstream os (pr.out_fd);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
+ ofdstream os (move (pr.out_fd));
os << pem;
os.close ();
@@ -264,9 +264,10 @@ namespace bpkg
// We unset failbit to provide the detailed error description (which
// certificate field is missed) on failure.
//
- ifdstream is (pr.in_ofd, fdstream_mode::skip, ifdstream::badbit);
+ ifdstream is (
+ move (pr.in_ofd), fdstream_mode::skip, ifdstream::badbit);
- ofdstream os (pr.out_fd);
+ ofdstream os (move (pr.out_fd));
// Reading from and writing to the child process standard streams from
// the same thread is generally a bad idea. Depending on the program
@@ -683,11 +684,11 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
// Write the signature to the openssl process input in the binary mode.
//
- ofdstream os (pr.out_fd, fdstream_mode::binary);
+ ofdstream os (move (pr.out_fd), fdstream_mode::binary);
for (const auto& c: sm.signature)
os.put (c); // Sets badbit on failure.
@@ -773,9 +774,10 @@ namespace bpkg
// Read the signature from the openssl process output in the binary
// mode.
//
- ifdstream is (pr.in_ofd, fdstream_mode::binary | fdstream_mode::skip);
+ ifdstream is (
+ move (pr.in_ofd), fdstream_mode::binary | fdstream_mode::skip);
- ofdstream os (pr.out_fd);
+ ofdstream os (move (pr.out_fd));
os << sha256sum;
os.close ();
diff --git a/bpkg/checksum.cxx b/bpkg/checksum.cxx
index fc66ccb..1254749 100644
--- a/bpkg/checksum.cxx
+++ b/bpkg/checksum.cxx
@@ -39,7 +39,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd);
+ ifdstream is (move (pr.in_ofd));
string l;
getline (is, l);
@@ -108,7 +108,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
string l;
getline (is, l);
@@ -174,7 +174,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd);
+ ifdstream is (move (pr.in_ofd));
string l;
getline (is, l);
@@ -318,7 +318,7 @@ namespace bpkg
// Prevent any data modifications on the way to the hashing program.
//
- fdmode (pr.out_fd, fdstream_mode::binary);
+ fdmode (pr.out_fd.get (), fdstream_mode::binary);
return pr;
}
catch (const process_error& e)
@@ -339,8 +339,8 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
- ofdstream os (pr.out_fd);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
+ ofdstream os (move (pr.out_fd));
// Note that the eof check is important: if the stream is at eof, write
// will fail.
diff --git a/bpkg/fetch.cxx b/bpkg/fetch.cxx
index efb2632..47f4f9b 100644
--- a/bpkg/fetch.cxx
+++ b/bpkg/fetch.cxx
@@ -48,7 +48,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
getline (is, l);
is.close ();
@@ -192,7 +192,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
string l;
getline (is, l);
@@ -307,7 +307,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
string l;
getline (is, l);
@@ -588,7 +588,7 @@ namespace bpkg
// calculation, then use the binary data to create the text stream for
// the manifest parsing.
//
- ifdstream is (pr.in_ofd, fdstream_mode::binary);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::binary);
stringstream bs (ios::in | ios::out | ios::binary);
// Note that the eof check is important: if the stream is at eof, write
diff --git a/bpkg/pkg-verify.cxx b/bpkg/pkg-verify.cxx
index 3b85a5c..9097dab 100644
--- a/bpkg/pkg-verify.cxx
+++ b/bpkg/pkg-verify.cxx
@@ -37,7 +37,7 @@ namespace bpkg
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
manifest_parser mp (is, mf.string ());
package_manifest m (mp, iu);
is.close ();
diff --git a/bpkg/satisfaction.cxx b/bpkg/satisfaction.cxx
index 23c63fd..206a2e7 100644
--- a/bpkg/satisfaction.cxx
+++ b/bpkg/satisfaction.cxx
@@ -126,7 +126,7 @@ namespace bpkg
string l;
try
{
- ifdstream is (pr.in_ofd, fdstream_mode::skip);
+ ifdstream is (move (pr.in_ofd), fdstream_mode::skip);
getline (is, l);
is.close ();