# HG changeset patch
# User Mike Becker <universe@uap-core.de>
# Date 1399379729 -7200
# Node ID 49cebb8eceff43f419b36c681bb7913c93d331b8
# Parent  5fbb9efebe4a7b46053fb70b1091d8ff698e5370
logger: removed unnecessary boundary checks and limited string parts so they always respect buffer lengths

diff -r 5fbb9efebe4a -r 49cebb8eceff ucx/logging.c
--- a/ucx/logging.c	Tue May 06 14:22:08 2014 +0200
+++ b/ucx/logging.c	Tue May 06 14:35:29 2014 +0200
@@ -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++] = ' ';
diff -r 5fbb9efebe4a -r 49cebb8eceff ucx/logging.h
--- a/ucx/logging.h	Tue May 06 14:22:08 2014 +0200
+++ b/ucx/logging.h	Tue May 06 14:35:29 2014 +0200
@@ -162,7 +162,8 @@
  * <code>[LEVEL] [TIMESTAMP] [SOURCEFILE]:[LINENO] message</code>
  * 
  * <b>Attention:</b> the message (including automatically generated information)
- * <b>MUST NOT</b> exceed the size of 4 KB.
+ * is limited to 4096 characters. The level description is limited to
+ * 256 characters and the timestamp string is limited to 128 characters.
  * 
  * @param logger the logger to use
  * @param level the level to log on