diff options
author | Martin Lucina <martin@lucina.net> | 2012-01-23 08:54:14 +0100 |
---|---|---|
committer | Martin Lucina <martin@lucina.net> | 2012-01-23 08:54:14 +0100 |
commit | 75af6aed482ab16997c1388fe801f74d11ec12a4 (patch) | |
tree | 637249631acc81446f6b5c2e25223f3164e132f6 /src/swap.cpp | |
parent | b593ea30833ad5dcacb9076c988aec31b0cf26ec (diff) |
Imported Upstream version 2.1.9upstream/2.1.9
Diffstat (limited to 'src/swap.cpp')
-rw-r--r-- | src/swap.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/swap.cpp b/src/swap.cpp index 936f30e..5f1b261 100644 --- a/src/swap.cpp +++ b/src/swap.cpp @@ -111,7 +111,7 @@ int zmq::swap_t::init () if (fd == -1) return -1; -#ifdef ZMQ_HAVE_LINUX +#if (defined (ZMQ_HAVE_LINUX) && !defined (ZMQ_HAVE_ANDROID)) // Enable more aggresive read-ahead optimization. posix_fadvise (fd, 0, filesize, POSIX_FADV_SEQUENTIAL); #endif @@ -135,8 +135,6 @@ bool zmq::swap_t::store (zmq_msg_t *msg_) copy_to_file (&msg_flags, sizeof msg_flags); copy_to_file (zmq_msg_data (msg_), msg_size); - zmq_msg_close (msg_); - return true; } @@ -214,7 +212,7 @@ void zmq::swap_t::copy_from_file (void *buffer_, size_t count_) size_t chunk_size, remainder = count_; while (remainder > 0) { - chunk_size = std::min (remainder, + chunk_size = std::min (remainder, std::min ((size_t) (filesize - read_pos), (size_t) (block_size - read_pos % block_size))); @@ -238,7 +236,7 @@ void zmq::swap_t::copy_to_file (const void *buffer_, size_t count_) size_t chunk_size, remainder = count_; while (remainder > 0) { - chunk_size = std::min (remainder, + chunk_size = std::min (remainder, std::min ((size_t) (filesize - write_pos), (size_t) (block_size - write_pos % block_size))); |