diff options
author | Aric Stewart <aric@codeweavers.com> | 2012-04-17 09:36:52 -0500 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2012-04-18 16:54:33 +0300 |
commit | 6bb8d93bbf0293aea33ab32340ae6308e8d76cc9 (patch) | |
tree | 31e4f2b17d2f1b0943bbef74b152b78b7cf6ca57 | |
parent | d77d056022206dc599033e31a20122e1a62f7888 (diff) |
allow log.c to compile under MSVC++
-rw-r--r-- | common/log.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/common/log.c b/common/log.c index ef4da06..5e2db4c 100644 --- a/common/log.c +++ b/common/log.c @@ -22,7 +22,9 @@ #include <stdlib.h> #include <stdio.h> #include <sys/types.h> +#ifndef _MSC_VER #include <unistd.h> +#endif #include "log.h" #include "backtrace.h" @@ -32,6 +34,15 @@ static int abort_level = -1; static const char * spice_log_level_to_string(SpiceLogLevel level) { +#ifdef _MSC_VER + /* MSVC++ does not implement C99 */ + static const char *to_string[] = { + "ERROR", + "CRITICAL", + "Warning", + "Info", + "Debug"}; +#else static const char *to_string[] = { [ SPICE_LOG_LEVEL_ERROR ] = "ERROR", [ SPICE_LOG_LEVEL_CRITICAL ] = "CRITICAL", @@ -39,6 +50,7 @@ static const char * spice_log_level_to_string(SpiceLogLevel level) [ SPICE_LOG_LEVEL_INFO ] = "Info", [ SPICE_LOG_LEVEL_DEBUG ] = "Debug", }; +#endif const char *str = NULL; if (level < SPICE_N_ELEMENTS(to_string)) { |