Cleanup for defines

pull/454/head
Tatsuhiro Tsujikawa 2015-06-21 17:42:27 +09:00
parent f5ff5da9da
commit 8ba9b04747
4 changed files with 8 additions and 11 deletions

View File

@ -89,7 +89,7 @@ bool DHTNode::isGood() const
return !isBad() && !isQuestionable();
}
#define BAD_CONDITION 5
constexpr int BAD_CONDITION = 5;
bool DHTNode::isBad() const
{

View File

@ -52,7 +52,7 @@ class ARC4Encryptor;
// The maximum length of buffer. If the message length (including 4
// bytes length and payload length) is larger than this value, it is
// dropped.
#define MAX_BUFFER_CAPACITY (16*1024+128)
constexpr size_t MAX_BUFFER_CAPACITY = 16 * 1024 + 128;
class PeerConnection {
private:

View File

@ -72,10 +72,10 @@
#endif // HAVE_LIBGMP
#include "LogFactory.h"
#define A2_MIN_GCRYPT_VERSION "1.2.4"
namespace aria2 {
namespace {
#ifdef HAVE_LIBGNUTLS
namespace {
void gnutls_log_callback(int level, const char *str)
{
using namespace aria2;
@ -84,11 +84,8 @@ namespace {
msg.resize(msg.size() - 1);
A2_LOG_DEBUG(fmt("GnuTLS: <%d> %s", level, msg.c_str()));
}
#endif // HAVE_LIBGNUTLS
}
namespace aria2 {
#endif // HAVE_LIBGNUTLS
bool Platform::initialized_ = false;
@ -126,7 +123,7 @@ bool Platform::setUp()
OpenSSL_add_all_algorithms();
#endif // HAVE_OPENSSL
#ifdef HAVE_LIBGCRYPT
if(!gcry_check_version(A2_MIN_GCRYPT_VERSION)) {
if(!gcry_check_version("1.2.4")) {
throw DL_ABORT_EX("gcry_check_version() failed.");
}
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);

View File

@ -45,8 +45,8 @@
namespace aria2 {
#define BUFSIZE (256*1024)
#define ALIGNMENT 512
constexpr size_t BUFSIZE = 256 * 1024;
constexpr size_t ALIGNMENT = 512;
SingleFileAllocationIterator::SingleFileAllocationIterator
(BinaryStream* stream,