summaryrefslogtreecommitdiff
path: root/src/VBox/Runtime/common/log
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Runtime/common/log')
-rw-r--r--src/VBox/Runtime/common/log/log.cpp29
-rw-r--r--src/VBox/Runtime/common/log/logcom.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logellipsis.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logformat.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logrel.cpp2
-rw-r--r--src/VBox/Runtime/common/log/logrelellipsis.cpp2
6 files changed, 24 insertions, 15 deletions
diff --git a/src/VBox/Runtime/common/log/log.cpp b/src/VBox/Runtime/common/log/log.cpp
index 56e36c43..ed87266d 100644
--- a/src/VBox/Runtime/common/log/log.cpp
+++ b/src/VBox/Runtime/common/log/log.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2011 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -1492,6 +1492,7 @@ static unsigned rtlogGroupFlags(const char *psz)
}
} /* strincmp */
} /* for each flags */
+ AssertMsg(fFound, ("%.15s...", psz));
}
/*
@@ -2762,39 +2763,47 @@ static void rtlogRotate(PRTLOGGER pLogger, uint32_t uTimeSlot, bool fFirst)
*/
static void rtlogFlush(PRTLOGGER pLogger)
{
- if (pLogger->offScratch == 0)
+ uint32_t const cchScratch = pLogger->offScratch;
+ if (cchScratch == 0)
return; /* nothing to flush. */
+ /* Make sure the string is terminated. On Windows, RTLogWriteDebugger
+ will get upset if it isn't. */
+ if (RT_LIKELY(cchScratch < sizeof(pLogger->achScratch)))
+ pLogger->achScratch[cchScratch] = '\0';
+ else
+ AssertFailed();
+
#ifndef IN_RC
if (pLogger->fDestFlags & RTLOGDEST_USER)
- RTLogWriteUser(pLogger->achScratch, pLogger->offScratch);
+ RTLogWriteUser(pLogger->achScratch, cchScratch);
if (pLogger->fDestFlags & RTLOGDEST_DEBUGGER)
- RTLogWriteDebugger(pLogger->achScratch, pLogger->offScratch);
+ RTLogWriteDebugger(pLogger->achScratch, cchScratch);
# ifdef IN_RING3
if (pLogger->fDestFlags & RTLOGDEST_FILE)
{
if (pLogger->pInt->hFile != NIL_RTFILE)
{
- RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, pLogger->offScratch, NULL);
+ RTFileWrite(pLogger->pInt->hFile, pLogger->achScratch, cchScratch, NULL);
if (pLogger->fFlags & RTLOGFLAGS_FLUSH)
RTFileFlush(pLogger->pInt->hFile);
}
if (pLogger->pInt->cHistory)
- pLogger->pInt->cbHistoryFileWritten += pLogger->offScratch;
+ pLogger->pInt->cbHistoryFileWritten += cchScratch;
}
# endif
if (pLogger->fDestFlags & RTLOGDEST_STDOUT)
- RTLogWriteStdOut(pLogger->achScratch, pLogger->offScratch);
+ RTLogWriteStdOut(pLogger->achScratch, cchScratch);
if (pLogger->fDestFlags & RTLOGDEST_STDERR)
- RTLogWriteStdErr(pLogger->achScratch, pLogger->offScratch);
+ RTLogWriteStdErr(pLogger->achScratch, cchScratch);
# if (defined(IN_RING0) || defined(IN_RC)) && !defined(LOG_NO_COM)
if (pLogger->fDestFlags & RTLOGDEST_COM)
- RTLogWriteCom(pLogger->achScratch, pLogger->offScratch);
+ RTLogWriteCom(pLogger->achScratch, cchScratch);
# endif
#endif /* !IN_RC */
@@ -3249,7 +3258,7 @@ static DECLCALLBACK(size_t) rtLogOutputPrefixed(void *pv, const char *pachChars,
#define CCH_PREFIX_16 CCH_PREFIX_15 + 17
#define CCH_PREFIX ( CCH_PREFIX_16 )
- AssertCompile(CCH_PREFIX < 256);
+ { AssertCompile(CCH_PREFIX < 256); }
/*
* Done, figure what we've used and advance the buffer and free size.
diff --git a/src/VBox/Runtime/common/log/logcom.cpp b/src/VBox/Runtime/common/log/logcom.cpp
index 3ca78857..62400b7b 100644
--- a/src/VBox/Runtime/common/log/logcom.cpp
+++ b/src/VBox/Runtime/common/log/logcom.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/log/logellipsis.cpp b/src/VBox/Runtime/common/log/logellipsis.cpp
index dde4a096..00888921 100644
--- a/src/VBox/Runtime/common/log/logellipsis.cpp
+++ b/src/VBox/Runtime/common/log/logellipsis.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/log/logformat.cpp b/src/VBox/Runtime/common/log/logformat.cpp
index 38cdfd32..f17f4a0f 100644
--- a/src/VBox/Runtime/common/log/logformat.cpp
+++ b/src/VBox/Runtime/common/log/logformat.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/log/logrel.cpp b/src/VBox/Runtime/common/log/logrel.cpp
index 64f7eb2a..c72f5faf 100644
--- a/src/VBox/Runtime/common/log/logrel.cpp
+++ b/src/VBox/Runtime/common/log/logrel.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2010 Oracle Corporation
+ * Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
diff --git a/src/VBox/Runtime/common/log/logrelellipsis.cpp b/src/VBox/Runtime/common/log/logrelellipsis.cpp
index 5f1806c6..65239945 100644
--- a/src/VBox/Runtime/common/log/logrelellipsis.cpp
+++ b/src/VBox/Runtime/common/log/logrelellipsis.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2007 Oracle Corporation
+ * Copyright (C) 2006-2010 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;