diff options
author | Lee Clagett <code@leeclagett.com> | 2020-10-13 15:15:07 +0000 |
---|---|---|
committer | Lee Clagett <code@leeclagett.com> | 2020-10-10 15:28:40 +0000 |
commit | 7414e2bac11cbf9163ca16dc1b1510b4fd9a0d64 (patch) | |
tree | 1cd7aa7394630a8be218534112ba88a5b618d96a /tests/fuzz | |
parent | Merge pull request #7072 (diff) | |
download | monero-7414e2bac11cbf9163ca16dc1b1510b4fd9a0d64.tar.xz |
Change epee binary output from std::stringstream to byte_stream
Diffstat (limited to 'tests/fuzz')
-rw-r--r-- | tests/fuzz/http-client.cpp | 3 | ||||
-rw-r--r-- | tests/fuzz/levin.cpp | 9 |
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/fuzz/http-client.cpp b/tests/fuzz/http-client.cpp index 4b12b36bb..65df24a3f 100644 --- a/tests/fuzz/http-client.cpp +++ b/tests/fuzz/http-client.cpp @@ -26,6 +26,7 @@ // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF // THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#include <boost/utility/string_ref.hpp> #include "include_base_utils.h" #include "file_io_utils.h" #include "net/http_client.h" @@ -38,7 +39,7 @@ public: bool connect(const std::string& addr, int port, std::chrono::milliseconds timeout, bool ssl = false, const std::string& bind_ip = "0.0.0.0") { return true; } bool connect(const std::string& addr, const std::string& port, std::chrono::milliseconds timeout, bool ssl = false, const std::string& bind_ip = "0.0.0.0") { return true; } bool disconnect() { return true; } - bool send(const std::string& buff, std::chrono::milliseconds timeout) { return true; } + bool send(const boost::string_ref buff, std::chrono::milliseconds timeout) { return true; } bool send(const void* data, size_t sz) { return true; } bool is_connected() { return true; } bool recv(std::string& buff, std::chrono::milliseconds timeout) diff --git a/tests/fuzz/levin.cpp b/tests/fuzz/levin.cpp index 012d05f36..b090c350b 100644 --- a/tests/fuzz/levin.cpp +++ b/tests/fuzz/levin.cpp @@ -65,13 +65,13 @@ namespace { } - virtual int invoke(int command, const epee::span<const uint8_t> in_buff, std::string& buff_out, test_levin_connection_context& context) + virtual int invoke(int command, const epee::span<const uint8_t> in_buff, epee::byte_slice& buff_out, test_levin_connection_context& context) { m_invoke_counter.inc(); boost::unique_lock<boost::mutex> lock(m_mutex); m_last_command = command; m_last_in_buf = std::string((const char*)in_buff.data(), in_buff.size()); - buff_out = m_invoke_out_buf; + buff_out = m_invoke_out_buf.clone(); return m_return_code; } @@ -111,8 +111,7 @@ namespace int return_code() const { return m_return_code; } void return_code(int v) { m_return_code = v; } - const std::string& invoke_out_buf() const { return m_invoke_out_buf; } - void invoke_out_buf(const std::string& v) { m_invoke_out_buf = v; } + void invoke_out_buf(std::string v) { m_invoke_out_buf = epee::byte_slice{std::move(v)}; } int last_command() const { return m_last_command; } const std::string& last_in_buf() const { return m_last_in_buf; } @@ -127,7 +126,7 @@ namespace boost::mutex m_mutex; int m_return_code; - std::string m_invoke_out_buf; + epee::byte_slice m_invoke_out_buf; int m_last_command; std::string m_last_in_buf; |