From ec158fe72c120ad253dbb133b5309b98cd414798 Mon Sep 17 00:00:00 2001 From: Caiwen Zhang Date: Thu, 6 Nov 2014 02:45:54 +0800 Subject: [PATCH] fix darwin and ios build error 1) the logger implementation only consider arduino/android/linux should add more platform in consider, such as darwin/ios ... 2) Without include , there will be build error with xcode compiler. Change-Id: I6c98efdf40dc682f519faf90d04ae81ea406507b Signed-off-by: Caiwen Zhang --- csdk/logger/include/logger.h | 6 ++---- csdk/logger/src/logger.c | 8 ++------ include/OCException.h | 2 ++ 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/csdk/logger/include/logger.h b/csdk/logger/include/logger.h index b475464..9dc80cf 100644 --- a/csdk/logger/include/logger.h +++ b/csdk/logger/include/logger.h @@ -59,7 +59,7 @@ typedef enum { } LogLevel; -#if defined(__ANDROID__) || defined(__linux__) +#ifndef ARDUINO /** * Configure logger to use a context that defines a custom logger function @@ -109,9 +109,7 @@ typedef enum { * @param bufferSize - max number of byte in buffer */ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint16_t bufferSize); -#endif - -#ifdef ARDUINO +#else /** * Initialize the serial logger for Arduino * Only defined for Arduino diff --git a/csdk/logger/src/logger.c b/csdk/logger/src/logger.c index c560367..684c0ba 100644 --- a/csdk/logger/src/logger.c +++ b/csdk/logger/src/logger.c @@ -59,7 +59,7 @@ static const uint16_t LINE_BUFFER_SIZE = (16 * 2) + 16 + 1; // Show 16 bytes, 2 #endif // __ANDROID__ -#if defined(__ANDROID__) || defined(__linux__) +#ifndef ARDUINO void OCLogConfig(oc_log_ctx_t *ctx) { logCtx = ctx; @@ -160,11 +160,7 @@ void OCLogBuffer(LogLevel level, const char * tag, const uint8_t * buffer, uint1 } } -#endif - - - -#ifdef ARDUINO +#else /** * Initialize the serial logger for Arduino * Only defined for Arduino diff --git a/include/OCException.h b/include/OCException.h index 7fa8943..b297a0c 100644 --- a/include/OCException.h +++ b/include/OCException.h @@ -22,7 +22,9 @@ #define __INTEL_OCEXCEPTION_H_2014_07_10 #include +#include #include + namespace OC { class OCException : public std::runtime_error -- 2.7.4