Minor fixes

This commit is contained in:
Stephen Seo 2019-08-30 14:57:24 +09:00
parent ba5d9178dc
commit ee85ced0e0
2 changed files with 6 additions and 5 deletions

View file

@ -1,3 +1,4 @@
// vim: foldmethod=marker
#ifndef UDPC_DEFINES_HPP #ifndef UDPC_DEFINES_HPP
#define UDPC_DEFINES_HPP #define UDPC_DEFINES_HPP
@ -143,7 +144,7 @@ private:
void log_impl(UDPC_LoggingType) {} void log_impl(UDPC_LoggingType) {}
template<typename... Targs> template<typename... Targs>
void log_impl(UDPC_LoggingType type, Targs... args) { void log_impl(UDPC_LoggingType type, Targs... args) { // {{{
switch(loggingType.load()) { switch(loggingType.load()) {
case UDPC_LoggingType::SILENT: case UDPC_LoggingType::SILENT:
return; return;
@ -204,14 +205,14 @@ private:
} }
log_impl_next(type, args...); log_impl_next(type, args...);
} } // }}}
void log_impl_next(UDPC_LoggingType) { void log_impl_next(UDPC_LoggingType) {
std::cerr << '\n'; std::cerr << '\n';
} }
template<typename T, typename... Targs> template<typename T, typename... Targs>
void log_impl_next(UDPC_LoggingType type, T value, Targs... args) { void log_impl_next(UDPC_LoggingType type, T value, Targs... args) { // {{{
switch(loggingType.load()) { switch(loggingType.load()) {
case UDPC_LoggingType::SILENT: case UDPC_LoggingType::SILENT:
return; return;
@ -240,7 +241,7 @@ private:
break; break;
} }
log_impl_next(type, args...); log_impl_next(type, args...);
} } // }}}
public: public:
uint_fast32_t _contextIdentifier; uint_fast32_t _contextIdentifier;

View file

@ -1010,7 +1010,7 @@ uint32_t UDPC_set_protocol_id(UDPC_HContext ctx, uint32_t id) {
UDPC_LoggingType set_logging_type(UDPC_HContext ctx, UDPC_LoggingType loggingType) { UDPC_LoggingType set_logging_type(UDPC_HContext ctx, UDPC_LoggingType loggingType) {
UDPC::Context *c = UDPC::verifyContext(ctx); UDPC::Context *c = UDPC::verifyContext(ctx);
if(!c) { if(!c) {
return static_cast<UDPC_LoggingType>(0); return UDPC_LoggingType::SILENT;
} }
return static_cast<UDPC_LoggingType>(c->loggingType.exchange(loggingType)); return static_cast<UDPC_LoggingType>(c->loggingType.exchange(loggingType));
} }