src/ucx/logging.c

changeset 99
b9a6af0ae41a
parent 91
fac51f87def0
child 135
471e28cca288
--- a/src/ucx/logging.c	Mon Apr 06 16:36:25 2015 +0200
+++ b/src/ucx/logging.c	Fri Oct 16 19:23:49 2015 +0200
@@ -1,7 +1,7 @@
 /*
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
  *
- * Copyright 2013 Olaf Wintermann. All rights reserved.
+ * Copyright 2015 Olaf Wintermann. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -75,6 +75,7 @@
         if ((logger->mask & UCX_LOGGER_LEVEL) > 0) {
             text = (char*) ucx_map_int_get(logger->levels, level);
             n = strlen(text);
+            n = n > 256 ? 256 : n;
             memcpy(msg+k, text, n);
             k += n;
             msg[k++] = ' ';
@@ -87,11 +88,7 @@
             n = strlen(file);
             memcpy(msg+k, file, n);
             k += n;
-#ifdef _WIN32
-            k += _snprintf(msg+k, UCX_LOGGER_MSGMAX-k, ":%d ", line);
-#else
-            k += snprintf(msg+k, UCX_LOGGER_MSGMAX-k, ":%d ", line);
-#endif /* _WIN32 */
+            k += sprintf(msg+k, ":%u ", line);
         }
         
         msg[k++] = '-'; msg[k++] = ' ';

mercurial