// Copyright (c) 2011-2016 The Cryptonote developers // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #include "StringInputStream.h" #include namespace Common { StringInputStream::StringInputStream(const std::string& in) : in(in), offset(0) { } size_t StringInputStream::readSome(void* data, size_t size) { if (size > in.size() - offset) { size = in.size() - offset; } memcpy(data, in.data() + offset, size); offset += size; return size; } }