Miscellaneous header updates via iwyu

Adds some missing required headers and removes some unnecessary ones.
This commit is contained in:
Jason Rhinelander 2020-06-22 16:27:42 -03:00
parent 6f3d3edd0d
commit 24f084a73c
57 changed files with 94 additions and 97 deletions

View File

@ -33,6 +33,7 @@
#include <iosfwd>
#include <string>
#include <string_view>
#include <vector>
#include "wipeable_string.h"
#include "span.h"

View File

@ -32,6 +32,8 @@
#include <thread>
#include <chrono>
#include <memory>
#include <vector>
#include <algorithm>
namespace epee
{

View File

@ -27,8 +27,9 @@
#include <string>
#include <optional>
#include "http_auth.h"
#include "net/net_ssl.h"
#include "net/http_base.h"
#include "net/http_auth.h"
namespace epee
{

View File

@ -45,12 +45,12 @@
#include <string>
#include <atomic>
#include <memory>
#include <deque>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include "shared_sv.h"
#include "net/net_utils_base.h"
#include "net/net_ssl.h"
#include "syncobj.h"

View File

@ -30,8 +30,9 @@
#define _LEVIN_BASE_H_
#include <cstdint>
#include <string>
#include <string_view>
#include "shared_sv.h"
#include "net_utils_base.h"
#include "span.h"
@ -132,7 +133,7 @@ namespace levin
/*! Generate a dummy levin message.
\param noise_bytes Total size of the returned `shared_sv`.
\param noise_bytes Total size of the returned string.
\return `nullptr` if `noise_size` is smaller than the levin header.
Otherwise, a dummy levin message. */
std::string make_noise_notify(std::size_t noise_bytes);

View File

@ -1,9 +1,9 @@
#pragma once
#include <string>
#include <streambuf>
#include <sstream>
#include <vector>
#include "readline_suspend.h"
namespace rdln
{

View File

@ -35,18 +35,15 @@
# include <windows.h>
#endif
#include <string.h>
#include <locale>
#include <cstring>
#include <cstdlib>
#include <string>
#include <string_view>
#include <type_traits>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string/predicate.hpp>
#include "misc_log_ex.h"
#include "storages/parserse_base_utils.h"
#include "hex.h"
#include "memwipe.h"
#include "mlocker.h"
#include "span.h"
#include "warnings.h"

View File

@ -26,8 +26,11 @@
// 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 <string.h>
#include "net/buffer.h"
#include <cstring>
#include <limits>
#include <cstdint>
#include <vector>
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "net.buffer"

View File

@ -41,7 +41,6 @@
#include "misc_language.h"
#include "pragma_comp_defs.h"
#include <iomanip>
#include <memory>
#include <boost/asio/basic_socket.hpp>

View File

@ -33,6 +33,8 @@
#include <ostream>
#include <stdexcept>
#include <string_view>
#include <cctype>
#include <algorithm>
namespace epee
{

View File

@ -27,6 +27,7 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "net/levin_base.h"
#include <cstring>
#include "int-util.h"
@ -67,7 +68,7 @@ namespace levin
std::string buffer(noise_bytes, char(0));
const bucket_head2 head = make_header(0, noise_bytes - sizeof(bucket_head2), flags, false);
std::memcpy(std::addressof(buffer[0]), std::addressof(head), sizeof(head));
std::memcpy(buffer.data(), &head, sizeof(head));
return buffer;
}

View File

@ -39,6 +39,12 @@
#include "mlocker.h"
#include <atomic>
#include <cerrno>
#include <cstdint>
#include <cstring>
#include <map>
#include <mutex>
#include <utility>
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "mlocker"

View File

@ -35,7 +35,7 @@
#endif
#endif
#include <time.h>
#include <ctime>
#include <atomic>
#include <boost/filesystem.hpp>
#include <boost/algorithm/string.hpp>

View File

@ -1,6 +1,8 @@
#include "readline_buffer.h"
#include "readline_suspend.h"
#include <readline/readline.h>
#include <readline/history.h>
#include <algorithm>
#include <iostream>
#include <mutex>
#include <boost/algorithm/string.hpp>

View File

@ -27,6 +27,12 @@
// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <optional>
#include <cctype>
#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include <cstring>
#include "memwipe.h"
#include "misc_log_ex.h"

2
external/loki-mq vendored

@ -1 +1 @@
Subproject commit d0a73e5e68d0db6407ede494373d4ea362f61f3d
Subproject commit 66176d44d79187720dbbae92f86ed6331436f9f4

View File

@ -31,7 +31,6 @@
#include "checkpoints.h"
#include "common/dns_utils.h"
#include "string_tools.h"
#include "storages/portable_storage_template_helper.h" // epee json include
#include "serialization/keyvalue_serialization.h"

View File

@ -29,7 +29,6 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#include <map>
#include <vector>
#include "misc_log_ex.h"
@ -37,16 +36,12 @@
#include "cryptonote_config.h"
#include "cryptonote_core/service_node_voting.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "string_tools.h"
#include <boost/serialization/base_object.hpp>
#define ADD_CHECKPOINT(h, hash) CHECK_AND_ASSERT(add_checkpoint(h, hash), false);
#define JSON_HASH_FILE_NAME "checkpoints.json"
namespace cryptonote
{
class Blockchain;
enum struct checkpoint_type
{
hardcoded,

View File

@ -31,6 +31,7 @@
#include "base58.h"
#include <cassert>
#include <cstring>
#include <vector>
#include "crypto/hash.h"

View File

@ -30,9 +30,10 @@
#pragma once
#include <iostream>
#include <vector>
#include <stdexcept>
#include <cstddef>
#include <cstdint>
namespace tools {

View File

@ -31,7 +31,6 @@
#pragma once
#include <functional>
#include <iostream>
#include <sstream>
#include <array>
#include <type_traits>

View File

@ -32,10 +32,10 @@
#include "unbound.h"
#include <chrono>
#include <mutex>
#include <optional>
#include <stdexcept>
#include <stdlib.h>
#include <cstdlib>
#include <cstdio>
#include "include_base_utils.h"
#include "common/threadpool.h"
#include "crypto/crypto.h"
@ -275,7 +275,7 @@ std::vector<std::string> DNSResolver::get_record(const std::string& url, int rec
dnssec_available = false;
dnssec_valid = false;
if (!check_address_syntax(url.c_str()))
if (url.find('.') == std::string::npos)
{
return addresses;
}
@ -440,16 +440,6 @@ DNSResolver DNSResolver::create()
return DNSResolver();
}
bool DNSResolver::check_address_syntax(const char *addr) const
{
// if string doesn't contain a dot, we won't consider it a url for now.
if (strchr(addr,'.') == NULL)
{
return false;
}
return true;
}
namespace dns_utils
{
@ -646,13 +636,13 @@ std::vector<std::string> parse_dns_public(const char *s)
unsigned ip0, ip1, ip2, ip3;
char c;
std::vector<std::string> dns_public_addr;
if (!strcmp(s, "tcp"))
if (s != "tcp"sv)
{
for (size_t i = 0; i < sizeof(DEFAULT_DNS_PUBLIC_ADDR) / sizeof(DEFAULT_DNS_PUBLIC_ADDR[0]); ++i)
dns_public_addr.push_back(DEFAULT_DNS_PUBLIC_ADDR[i]);
LOG_PRINT_L0("Using default public DNS server(s): " << boost::join(dns_public_addr, ", ") << " (TCP)");
}
else if (sscanf(s, "tcp://%u.%u.%u.%u%c", &ip0, &ip1, &ip2, &ip3, &c) == 4)
else if (std::sscanf(s, "tcp://%u.%u.%u.%u%c", &ip0, &ip1, &ip2, &ip3, &c) == 4)
{
if (ip0 > 255 || ip1 > 255 || ip2 > 255 || ip3 > 255)
{
@ -660,7 +650,7 @@ std::vector<std::string> parse_dns_public(const char *s)
}
else
{
dns_public_addr.push_back(std::string(s + strlen("tcp://")));
dns_public_addr.push_back(std::string(s + "tcp://"sv.size()));
}
}
else

View File

@ -165,15 +165,6 @@ private:
// TODO: modify this to accommodate DNSSEC
std::vector<std::string> get_record(const std::string& url, int record_type, std::optional<std::string> (*reader)(const char *,size_t), bool& dnssec_available, bool& dnssec_valid);
/**
* @brief Checks a string to see if it looks like a URL
*
* @param addr the string to be checked
*
* @return true if it looks enough like a URL, false if not
*/
bool check_address_syntax(const char *addr) const;
ub_ctx* m_ctx = nullptr;
}; // class DNSResolver

View File

@ -27,7 +27,6 @@
#pragma once
#include <system_error>
#include <type_traits>
enum class common_error : int
{

View File

@ -31,6 +31,7 @@
//
#pragma once
#include <string>
#include <cstdio>
#include <memory>
#include <optional>

View File

@ -27,13 +27,15 @@
// 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 <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "i18n.h"
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cstdint>
#include <string>
#include <map>
#include <utility>
#include "file_io_utils.h"
#include "common/i18n.h"
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "i18n"

View File

@ -1,5 +1,4 @@
#include "loki.h"
#include <assert.h>
/* Exponential base 2 function.
Copyright (C) 2012-2019 Free Software Foundation, Inc.

View File

@ -33,10 +33,6 @@
#define LOKI_MINUTES(val) val * 60
#include <cstddef>
#include <cstdint>
#include <string>
#include <iterator>
#include <cassert>
#define LOKI_RPC_DOC_INTROSPECT
namespace loki

View File

@ -31,7 +31,9 @@
#include "password.h"
#include <iostream>
#include <stdio.h>
#include <cstdio>
#include <utility>
#include <type_traits>
#if defined(_WIN32)
#include <io.h>

View File

@ -33,6 +33,8 @@
#include <string>
#include <atomic>
#include <optional>
#include <functional>
#include <cstddef>
#include "wipeable_string.h"
namespace tools

View File

@ -30,15 +30,13 @@
#pragma once
#include <string>
#include <stdio.h>
#include <memory>
#include <cstdio>
#include <cstdint>
#include "misc_log_ex.h"
namespace tools
{
class PerformanceTimer;
extern el::Level performance_timer_log_level;
class PerformanceTimer

View File

@ -29,6 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <ctime>
#include <cstdint>
#include "cryptonote_config.h"
namespace cryptonote

View File

@ -1,5 +1,7 @@
#include "sha256sum.h"
#include <fstream>
#include "crypto/hash.h"
#include "file_io_utils.h" // epee
extern "C" {

View File

@ -2,7 +2,8 @@
#include <type_traits>
#include <string>
#include <string_view>
#include <crypto/hash.h>
namespace crypto { struct hash; }
namespace tools {

View File

@ -1,6 +1,6 @@
#pragma once
#include <stdint.h>
#include <ctime>
#include <string>
#include <vector>
#include <map>

View File

@ -38,7 +38,6 @@
*/
#include <string.h>
#include <stdio.h>
#include <stdint.h>
#include <memwipe.h>
#include "blake256.h"

View File

@ -6,6 +6,7 @@ Public domain.
#include <memory.h>
#include <stdio.h>
#include <string.h>
#ifndef _MSC_VER
#include <sys/param.h>
#endif

View File

@ -29,7 +29,6 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <assert.h>
#include <stdint.h>
#include "warnings.h"
#include "crypto-ops.h"

View File

@ -29,6 +29,7 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#pragma once
#include <stdint.h>
/* From fe.h */

View File

@ -31,10 +31,12 @@
#include <mutex>
#include <unistd.h>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <memory>
#include <stdexcept>
#include "common/varint.h"
#include "warnings.h"
@ -479,7 +481,7 @@ namespace crypto {
hash h;
ge_p2 point;
ge_p1p1 point2;
cn_fast_hash(std::addressof(key), sizeof(public_key), h);
cn_fast_hash(&key, sizeof(public_key), h);
ge_fromfe_frombytes_vartime(&point, reinterpret_cast<const unsigned char *>(&h));
ge_mul8(&point2, &point);
ge_p1p1_to_p3(&res, &point2);

View File

@ -31,7 +31,6 @@
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "jh.h"
#include "hash-ops.h"

View File

@ -28,6 +28,7 @@
//
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <assert.h>
#include <stddef.h>
#include <stdint.h>

View File

@ -2,6 +2,8 @@
// 19-Nov-11 Markku-Juhani O. Saarinen <mjos@iki.fi>
// A baseline Keccak (3rd round) implementation.
#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

View File

@ -26,10 +26,8 @@
// 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 <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -30,10 +30,6 @@
// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <vector>
#include "common/loki.h"
#include "int-util.h"

View File

@ -31,9 +31,10 @@
#pragma once
#include <cstdint>
#include <cstddef>
#include <vector>
#include "crypto/hash.h"
namespace crypto { struct hash; }
namespace cryptonote
{

View File

@ -30,7 +30,6 @@
#pragma once
#include <boost/program_options.hpp>
#include <atomic>
#include <thread>
#include "cryptonote_basic/blobdatatype.h"
@ -42,6 +41,8 @@
#include <windows.h>
#endif
namespace boost::program_options { class variables_map; class options_description; }
namespace cryptonote
{
using namespace std::literals;

View File

@ -1,14 +1,12 @@
#include <bitset>
#include "loki_name_system.h"
#include "checkpoints/checkpoints.h"
#include "common/loki.h"
#include "common/string_util.h"
#include "crypto/hash.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_basic/cryptonote_format_utils.h"
#include "cryptonote_core/cryptonote_tx_utils.h"
#include "cryptonote_basic/tx_extra.h"
#include "cryptonote_core/blockchain.h"
#include "loki_economy.h"
@ -21,7 +19,11 @@
extern "C"
{
#include <sodium.h>
#include <sodium/crypto_generichash.h>
#include <sodium/crypto_generichash_blake2b.h>
#include <sodium/crypto_pwhash.h>
#include <sodium/crypto_secretbox.h>
#include <sodium/crypto_sign.h>
}
#undef LOKI_DEFAULT_LOG_CATEGORY

View File

@ -7,6 +7,7 @@
#include "cryptonote_basic/tx_extra.h"
#include <lokimq/hex.h>
#include <cassert>
#include <string>
struct sqlite3;

View File

@ -32,8 +32,8 @@
#include "cryptonote_protocol/cryptonote_protocol_handler_common.h"
#include "cryptonote_basic/cryptonote_basic_impl.h"
#include "cryptonote_core/service_node_voting.h"
#include "common/loki.h"
#include <cassert>
#include <mutex>
namespace cryptonote
{

View File

@ -39,12 +39,9 @@
#include "misc_log_ex.h"
#include "string_tools.h"
#include <random>
#include <string>
#include <vector>
#include <boost/endian/conversion.hpp>
#undef LOKI_DEFAULT_LOG_CATEGORY
#define LOKI_DEFAULT_LOG_CATEGORY "service_nodes"

View File

@ -28,16 +28,14 @@
#pragma once
#include <cassert>
#include <mutex>
#include <vector>
#include <unordered_map>
#include <utility>
#include "crypto/crypto.h"
#include "cryptonote_basic/cryptonote_basic.h"
#include "cryptonote_basic/blobdatatype.h"
#include "cryptonote_basic/tx_extra.h"
#include "string_tools.h"
#include "common/periodic_task.h"
#include "syncobj.h"

View File

@ -30,6 +30,7 @@
#pragma once
#include "common/util.h"
#include "common/file.h"
#include "daemonizer/windows_service.h"
#include "daemonizer/windows_service_runner.h"
#include "cryptonote_core/cryptonote_core.h"

View File

@ -35,6 +35,7 @@
#include <string>
#include <vector>
#include <optional>
#include <shared_mutex>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>

View File

@ -31,13 +31,11 @@
#include "transaction_info.h"
using namespace std;
namespace Monero {
TransactionInfo::~TransactionInfo() {}
TransactionInfo::Transfer::Transfer(uint64_t _amount, const string &_address)
TransactionInfo::Transfer::Transfer(uint64_t _amount, const std::string &_address)
: amount(_amount), address(_address) {}
@ -112,13 +110,13 @@ uint32_t TransactionInfoImpl::subaddrAccount() const
return m_subaddrAccount;
}
string TransactionInfoImpl::label() const
std::string TransactionInfoImpl::label() const
{
return m_label;
}
string TransactionInfoImpl::hash() const
std::string TransactionInfoImpl::hash() const
{
return m_hash;
}
@ -128,7 +126,7 @@ std::time_t TransactionInfoImpl::timestamp() const
return m_timestamp;
}
string TransactionInfoImpl::paymentId() const
std::string TransactionInfoImpl::paymentId() const
{
return m_paymentid;
}

View File

@ -34,8 +34,6 @@
namespace Monero {
class TransactionHistoryImpl;
enum class reward_type {
unspecified,
service_node,

View File

@ -29,6 +29,7 @@
#include "gtest/gtest.h"
#include "common/sha256sum.h"
#include "crypto/hash.h"
#include "string_tools.h"
static bool check(const std::string &data, const char *expected_hash_hex)