Skip to content

Commit

Permalink
Cleanup: minor corrections to monero-project#162.
Browse files Browse the repository at this point in the history
* Derived from comments in monero-project#162.
  • Loading branch information
anonimal committed Apr 11, 2016
1 parent 292ee95 commit 90fcced
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 32 deletions.
38 changes: 13 additions & 25 deletions src/core/Reseed.cpp
Expand Up @@ -117,7 +117,7 @@ bool Reseed::ProcessCerts() {
// Instantiate X.509 object
i2p::crypto::X509 x509;
// Iterate through directory and get signing key from each certificate
std::uint8_t num_certs = 0;
std::size_t num_certs = 0;
BOOST_FOREACH(boost::filesystem::path const& cert, std::make_pair(it, end)) {
if (boost::filesystem::is_regular_file(cert)) {
LogPrint(eLogDebug, "Reseed: acquiring signing key from ", cert);
Expand Down Expand Up @@ -151,8 +151,7 @@ bool Reseed::ProcessCerts() {
}
}
LogPrint(eLogInfo,
"Reseed: successfuly loaded ",
static_cast<std::size_t>(num_certs), " certificates");
"Reseed: successfuly loaded ", num_certs, " certificates");
return (num_certs > 0);
}

Expand Down Expand Up @@ -311,58 +310,47 @@ bool SU3::PrepareStream() {
// Get file type that contains non-su3 data
m_Stream.Read(m_Data->file_type, Size::file_type);
switch (m_Data->file_type) {
case static_cast<std::size_t>(FileType::zip_file): {
case static_cast<std::size_t>(FileType::zip_file):
break;
}
case static_cast<std::size_t>(FileType::xml_file): {
case static_cast<std::size_t>(FileType::xml_file):
LogPrint(eLogError, "SU3: XML not supported");
return false;
}
case static_cast<std::size_t>(FileType::html_file): {
case static_cast<std::size_t>(FileType::html_file):
LogPrint(eLogError, "SU3: HTML not supported");
return false;
}
case static_cast<std::size_t>(FileType::xml_gz_file): {
case static_cast<std::size_t>(FileType::xml_gz_file):
LogPrint(eLogError, "SU3: Gzip compressed XML not supported");
return false;
}
default: {
default:
LogPrint(eLogError,
"SU3: invalid file type ",
static_cast<std::size_t>(m_Data->file_type));
return false;
}
}
// Unused offset
m_Stream.Seekg(Offset::unused, std::ios::cur);
// Get content type that contains the RI's
m_Stream.Read(m_Data->content_type, Size::content_type);
switch (m_Data->content_type) {
case static_cast<std::size_t>(ContentType::unknown): {
case static_cast<std::size_t>(ContentType::unknown):
break;
}
case static_cast<std::size_t>(ContentType::router_update): {
case static_cast<std::size_t>(ContentType::router_update):
LogPrint(eLogError, "SU3: Router Update not yet supported");
return false;
}
case static_cast<std::size_t>(ContentType::plugin_related): {
case static_cast<std::size_t>(ContentType::plugin_related):
LogPrint(eLogError, "SU3: Plugins not yet supported");
return false;
}
case static_cast<std::size_t>(ContentType::reseed_data): {
case static_cast<std::size_t>(ContentType::reseed_data):
LogPrint(eLogDebug, "SU3: found reseed data");
break;
}
case static_cast<std::size_t>(ContentType::news_feed): {
case static_cast<std::size_t>(ContentType::news_feed):
LogPrint(eLogError, "SU3: News Feed not yet supported");
return false;
}
default: {
default:
LogPrint(eLogError,
"SU3: invalid content type ",
static_cast<std::size_t>(m_Data->content_type));
return false;
}
}
// Unused offset
m_Stream.Seekg(static_cast<std::size_t>(Offset::unused) * 12, std::ios::cur);
Expand Down
2 changes: 1 addition & 1 deletion src/core/crypto/X509.h
Expand Up @@ -35,7 +35,7 @@

#include <map>
#include <memory>
#include <sstream>
#include <iosfwd>
#include <string>

#include "Identity.h" // i2p::data::Tag
Expand Down
12 changes: 6 additions & 6 deletions src/core/util/ZIP.h
Expand Up @@ -35,8 +35,6 @@

#include <array>
#include <cstdint>
#include <iostream>
#include <istream>
#include <memory>
#include <string>
#include <unordered_map>
Expand All @@ -57,13 +55,15 @@ namespace util {
/**
* @class ZIP
* @brief ZIP implementation
* @param String in ZIP file format
* @param zip String in ZIP file format
* @param length Content length (length of zip)
* @param pos Starting position (optional)
*/
class ZIP {
public:
ZIP(const std::string& zip, // ZIP file
std::size_t len, // Content length (length of zip)
std::size_t pos = 0) // Starting position (optional)
ZIP(const std::string& zip,
std::size_t len,
std::size_t pos = 0)
: m_Stream(zip),
m_Data(new Data()) {
m_Data->content_length = len;
Expand Down

0 comments on commit 90fcced

Please sign in to comment.