From 304d00e5226a64707ec7ab74c06fd35a96e55389 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 27 Jul 2015 00:11:09 +0300 Subject: code style --- cxx/include/aesnixx/debug.hpp | 8 +++---- cxx/include/aesnixx/error.hpp | 16 ++++++------- utils/aes_block_common.hpp | 54 +++++++++++++++++++++---------------------- utils/aes_file_common.hpp | 36 ++++++++++++++--------------- 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& 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(&m_mode)->required(), "set mode of operation") - ("algorithm,a", po::value(&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(&encryption_mode)->required(), "set mode of operation") + ("algorithm,a", po::value(&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>(&m_args)); + ("positional", po::value>(&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 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 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 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(&m_mode)->required(), "set mode of operation") - ("algorithm,a", po::value(&m_algorithm)->required(), "set algorithm"); + ("mode,m", po::value(&encryption_mode)->required(), "set mode of operation") + ("algorithm,a", po::value(&encryption_algo)->required(), "set algorithm"); po::options_description hidden_options; hidden_options.add_options() - ("positional", po::value>(&m_args)); + ("positional", po::value>(&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 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 m_args; + aesni::Mode encryption_mode; + aesni::Algorithm encryption_algo; + std::vector args; }; } -- cgit v1.2.3