aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-07-27 00:11:09 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-07-27 00:11:09 +0300
commit304d00e5226a64707ec7ab74c06fd35a96e55389 (patch)
tree367139d67b3841a2a968c71766d1a81f7bf0451e
parentutils: fix usage messages (diff)
downloadaes-tools-304d00e5226a64707ec7ab74c06fd35a96e55389.tar.gz
aes-tools-304d00e5226a64707ec7ab74c06fd35a96e55389.zip
code style
Diffstat (limited to '')
-rw-r--r--cxx/include/aesnixx/debug.hpp8
-rw-r--r--cxx/include/aesnixx/error.hpp16
-rw-r--r--utils/aes_block_common.hpp54
-rw-r--r--utils/aes_file_common.hpp36
4 files changed, 57 insertions, 57 deletions
diff --git a/cxx/include/aesnixx/debug.hpp b/cxx/include/aesnixx/debug.hpp
index bb21f74..6c92a95 100644
--- a/cxx/include/aesnixx/debug.hpp
+++ b/cxx/include/aesnixx/debug.hpp
@@ -32,14 +32,14 @@ namespace aesni
CallStackFormatter()
{
#ifdef WIN32
- m_valid = SymInitialize(GetCurrentProcess(), NULL, TRUE) ? true : false;
+ valid_flag = SymInitialize(GetCurrentProcess(), NULL, TRUE) ? true : false;
#endif
}
std::string format(void* addr) const
{
#ifdef WIN32
- if (!m_valid)
+ if (!valid_flag)
return format_fallback(addr);
DWORD64 symbol_info_buf[sizeof(SYMBOL_INFO) + MAX_SYM_NAME];
@@ -73,7 +73,7 @@ namespace aesni
~CallStackFormatter()
{
#ifdef WIN32
- if (m_valid)
+ if (valid_flag)
SymCleanup(GetCurrentProcess());
#endif
}
@@ -119,7 +119,7 @@ namespace aesni
}
#ifdef WIN32
- bool m_valid = false;
+ bool valid_flag = false;
#endif
};
}
diff --git a/cxx/include/aesnixx/error.hpp b/cxx/include/aesnixx/error.hpp
index 5366c0b..552f832 100644
--- a/cxx/include/aesnixx/error.hpp
+++ b/cxx/include/aesnixx/error.hpp
@@ -36,7 +36,7 @@ namespace aesni
void for_each_in_call_stack(const std::function<void (void*, const std::string&)>& callback) const
{
aux::CallStackFormatter formatter;
- std::for_each(m_call_stack, m_call_stack + m_call_stack_size, [&formatter, &callback] (void* addr)
+ std::for_each(call_stack, call_stack + call_stack_size, [&formatter, &callback] (void* addr)
{
callback(addr, formatter.format(addr));
});
@@ -53,12 +53,12 @@ namespace aesni
void copy_call_stack(const AesNI_ErrorDetails& err_details)
{
- m_call_stack_size = err_details.call_stack_size;
- std::memcpy(m_call_stack, err_details.call_stack, m_call_stack_size * sizeof(void*));
+ call_stack_size = err_details.call_stack_size;
+ std::memcpy(call_stack, err_details.call_stack, call_stack_size * sizeof(void*));
}
- void* m_call_stack[AESNI_MAX_CALL_STACK_LENGTH];
- std::size_t m_call_stack_size;
+ void* call_stack[AESNI_MAX_CALL_STACK_LENGTH];
+ std::size_t call_stack_size;
};
std::ostream& operator<<(std::ostream& os, const Error& e)
@@ -87,14 +87,14 @@ namespace aesni
#endif
{
if (aesni_is_error(aesni_get_error_code(get())))
- throw Error(m_impl);
+ throw Error(impl);
}
- AesNI_ErrorDetails* get() { return &m_impl; }
+ AesNI_ErrorDetails* get() { return &impl; }
operator AesNI_ErrorDetails*() { return get(); }
private:
- AesNI_ErrorDetails m_impl;
+ AesNI_ErrorDetails impl;
};
}
diff --git a/utils/aes_block_common.hpp b/utils/aes_block_common.hpp
index 0a5e1d8..bdb6ac6 100644
--- a/utils/aes_block_common.hpp
+++ b/utils/aes_block_common.hpp
@@ -65,30 +65,30 @@ namespace
class CommandLineParser
{
public:
- CommandLineParser(const std::string& program_name)
- : m_program_name(program_name)
- , m_options("Options")
- , m_boxes(false)
- , m_verbose(false)
+ CommandLineParser(const std::string& prog_name)
+ : prog_name(prog_name)
+ , options("Options")
+ , boxes_flag(false)
+ , verbose_flag(false)
{ }
bool parse_options(int argc, char** argv)
{
namespace po = boost::program_options;
- m_options.add_options()
+ options.add_options()
("help,h", "show this message and exit")
- ("box,b", po::bool_switch(&m_boxes)->default_value(false), "use the \"boxes\" interface")
- ("mode,m", po::value<aesni::Mode>(&m_mode)->required(), "set mode of operation")
- ("algorithm,a", po::value<aesni::Algorithm>(&m_algorithm)->required(), "set algorithm")
- ("verbose,v", po::bool_switch(&m_verbose)->default_value(false), "enable verbose output");
+ ("box,b", po::bool_switch(&boxes_flag)->default_value(false), "use the \"boxes\" interface")
+ ("mode,m", po::value<aesni::Mode>(&encryption_mode)->required(), "set mode of operation")
+ ("algorithm,a", po::value<aesni::Algorithm>(&encryption_algo)->required(), "set algorithm")
+ ("verbose,v", po::bool_switch(&verbose_flag)->default_value(false), "enable verbose output");
po::options_description hidden_options;
hidden_options.add_options()
- ("positional", po::value<std::vector<std::string>>(&m_args));
+ ("positional", po::value<std::vector<std::string>>(&args));
po::options_description all_options;
- all_options.add(m_options).add(hidden_options);
+ all_options.add(options).add(hidden_options);
po::positional_options_description positional_options;
positional_options.add("positional", -1);
@@ -108,44 +108,44 @@ namespace
void print_usage()
{
- std::cout << "Usage: " << m_program_name << " [OPTIONS...] [-- KEY [IV] [BLOCK...]...]\n";
- std::cout << m_options << "\n";
+ std::cout << "Usage: " << prog_name << " [OPTIONS...] [-- KEY [IV] [BLOCK...]...]\n";
+ std::cout << options << "\n";
}
aesni::Mode get_mode() const
{
- return m_mode;
+ return encryption_mode;
}
aesni::Algorithm get_algorithm() const
{
- return m_algorithm;
+ return encryption_algo;
}
bool use_boxes() const
{
- return m_boxes;
+ return boxes_flag;
}
std::deque<std::string> get_args()
{
- return { std::make_move_iterator(m_args.begin()), std::make_move_iterator(m_args.end()) };
+ return { std::make_move_iterator(args.begin()), std::make_move_iterator(args.end()) };
}
bool verbose() const
{
- return m_verbose;
+ return verbose_flag;
}
private:
- const std::string m_program_name;
- boost::program_options::options_description m_options;
-
- aesni::Mode m_mode;
- aesni::Algorithm m_algorithm;
- bool m_boxes;
- std::vector<std::string> m_args;
- bool m_verbose;
+ const std::string prog_name;
+ boost::program_options::options_description options;
+
+ aesni::Mode encryption_mode;
+ aesni::Algorithm encryption_algo;
+ bool boxes_flag;
+ std::vector<std::string> args;
+ bool verbose_flag;
};
}
diff --git a/utils/aes_file_common.hpp b/utils/aes_file_common.hpp
index 28e16df..8a13b48 100644
--- a/utils/aes_file_common.hpp
+++ b/utils/aes_file_common.hpp
@@ -63,26 +63,26 @@ namespace
class CommandLineParser
{
public:
- CommandLineParser(const std::string& program_name)
- : m_program_name(program_name)
- , m_options("Options")
+ CommandLineParser(const std::string& prog_name)
+ : prog_name(prog_name)
+ , options("Options")
{ }
bool parse_options(int argc, char** argv)
{
namespace po = boost::program_options;
- m_options.add_options()
+ options.add_options()
("help,h", "show this message and exit")
- ("mode,m", po::value<aesni::Mode>(&m_mode)->required(), "set mode of operation")
- ("algorithm,a", po::value<aesni::Algorithm>(&m_algorithm)->required(), "set algorithm");
+ ("mode,m", po::value<aesni::Mode>(&encryption_mode)->required(), "set mode of operation")
+ ("algorithm,a", po::value<aesni::Algorithm>(&encryption_algo)->required(), "set algorithm");
po::options_description hidden_options;
hidden_options.add_options()
- ("positional", po::value<std::vector<std::string>>(&m_args));
+ ("positional", po::value<std::vector<std::string>>(&args));
po::options_description all_options;
- all_options.add(m_options).add(hidden_options);
+ all_options.add(options).add(hidden_options);
po::positional_options_description positional_options;
positional_options.add("positional", -1);
@@ -102,31 +102,31 @@ namespace
void print_usage()
{
- std::cout << "Usage: " << m_program_name << " [OPTIONS...] KEY [IV] SRC_PATH DEST_PATH\n";
- std::cout << m_options << "\n";
+ std::cout << "Usage: " << prog_name << " [OPTIONS...] KEY [IV] SRC_PATH DEST_PATH\n";
+ std::cout << options << "\n";
}
aesni::Mode get_mode() const
{
- return m_mode;
+ return encryption_mode;
}
aesni::Algorithm get_algorithm() const
{
- return m_algorithm;
+ return encryption_algo;
}
std::deque<std::string> get_args()
{
- return { std::make_move_iterator(m_args.begin()), std::make_move_iterator(m_args.end()) };
+ return { std::make_move_iterator(args.begin()), std::make_move_iterator(args.end()) };
}
private:
- const std::string m_program_name;
- boost::program_options::options_description m_options;
+ const std::string prog_name;
+ boost::program_options::options_description options;
- aesni::Mode m_mode;
- aesni::Algorithm m_algorithm;
- std::vector<std::string> m_args;
+ aesni::Mode encryption_mode;
+ aesni::Algorithm encryption_algo;
+ std::vector<std::string> args;
};
}