From 6ee68fa294d1d9ab8fa8e61a009845dc31a9b771 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 14 Feb 2017 11:53:25 +0100 Subject: Compiles on MXE, but not working on Windows Signed-off-by: Szczepan Zalega --- include/log.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/log.h') diff --git a/include/log.h b/include/log.h index 8eda4fb..0b0df8c 100644 --- a/include/log.h +++ b/include/log.h @@ -6,6 +6,10 @@ namespace nitrokey { namespace log { +#ifdef ERROR +#undef ERROR +#endif + enum class Loglevel : int { DEBUG_L2, DEBUG, INFO, WARNING, ERROR }; class LogHandler { -- cgit v1.2.1 From ad286a23ba8a542afe0095b97caf52320778c5e6 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 21 Feb 2017 13:12:12 +0100 Subject: Feature check for 320 bits OTP secret Signed-off-by: Szczepan Zalega --- include/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/log.h') diff --git a/include/log.h b/include/log.h index 0b0df8c..30fc7fa 100644 --- a/include/log.h +++ b/include/log.h @@ -5,7 +5,7 @@ namespace nitrokey { namespace log { - + #ifdef ERROR #undef ERROR #endif -- cgit v1.2.1 From c13c7fda5b9f69cd46ba40ac5e6cf1cc4bc7e71d Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 21 Feb 2017 14:52:36 +0100 Subject: Comments Signed-off-by: Szczepan Zalega --- include/log.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/log.h') diff --git a/include/log.h b/include/log.h index 30fc7fa..695884b 100644 --- a/include/log.h +++ b/include/log.h @@ -5,11 +5,13 @@ namespace nitrokey { namespace log { - + +//for MSVC #ifdef ERROR #undef ERROR #endif + enum class Loglevel : int { DEBUG_L2, DEBUG, INFO, WARNING, ERROR }; class LogHandler { -- cgit v1.2.1 From 29fc4839b7aaf76c3587cf0d268546fd1d1390c4 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 21 Feb 2017 14:56:07 +0100 Subject: Build debug-log-free library for increased security Signed-off-by: Szczepan Zalega --- include/log.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include/log.h') diff --git a/include/log.h b/include/log.h index 695884b..a3e8281 100644 --- a/include/log.h +++ b/include/log.h @@ -53,4 +53,11 @@ class Log { } } + +#ifdef NO_LOG +#define LOG(string, level) while(false){} +#else +#define LOG(string, level) nitrokey::log::Log::instance()((string), (level)) +#endif + #endif -- cgit v1.2.1 From 49e45d532f80c6ffc60c2fbd754030a11dfc8893 Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Tue, 21 Feb 2017 15:58:47 +0100 Subject: Use nullptr instead of NULL Signed-off-by: Szczepan Zalega --- include/log.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/log.h') diff --git a/include/log.h b/include/log.h index a3e8281..7c25918 100644 --- a/include/log.h +++ b/include/log.h @@ -34,7 +34,7 @@ class Log { Log() : mp_loghandler(&stdlog_handler), m_loglevel(Loglevel::WARNING) {} static Log &instance() { - if (mp_instance == NULL) mp_instance = new Log; + if (mp_instance == nullptr) mp_instance = new Log; return *mp_instance; } -- cgit v1.2.1