mirror of
https://github.com/debauchee/barrier.git
synced 2026-02-13 15:15:21 +08:00
performance fixes on win32 plus clean up of some warnings. also
improved error messages when uninstalling service.
This commit is contained in:
@@ -65,6 +65,11 @@ CLog::print(
|
||||
fmt += 3;
|
||||
}
|
||||
|
||||
// done if below priority threshold
|
||||
if (priority > getMaxPriority()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// compute prefix padding length
|
||||
int pad = g_priorityPad;
|
||||
|
||||
@@ -98,6 +103,11 @@ CLog::printt(
|
||||
fmt += 3;
|
||||
}
|
||||
|
||||
// done if below priority threshold
|
||||
if (priority > getMaxPriority()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// compute prefix padding length
|
||||
char stack[1024];
|
||||
sprintf(stack, "%d", line);
|
||||
@@ -217,34 +227,32 @@ CLog::output(
|
||||
char* msg)
|
||||
{
|
||||
assert(priority >= -1 && priority < g_numPriority);
|
||||
assert(msg != 0);
|
||||
assert(msg != NULL);
|
||||
|
||||
if (priority <= getMaxPriority()) {
|
||||
// insert priority label
|
||||
int n = -g_prioritySuffixLength;
|
||||
if (priority >= 0) {
|
||||
n = strlen(g_priority[priority]);
|
||||
sprintf(msg + g_maxPriorityLength - n,
|
||||
"%s:", g_priority[priority]);
|
||||
msg[g_maxPriorityLength + 1] = ' ';
|
||||
}
|
||||
// insert priority label
|
||||
int n = -g_prioritySuffixLength;
|
||||
if (priority >= 0) {
|
||||
n = strlen(g_priority[priority]);
|
||||
sprintf(msg + g_maxPriorityLength - n,
|
||||
"%s:", g_priority[priority]);
|
||||
msg[g_maxPriorityLength + 1] = ' ';
|
||||
}
|
||||
|
||||
// put a newline at the end
|
||||
// put a newline at the end
|
||||
#if defined(CONFIG_PLATFORM_WIN32)
|
||||
strcat(msg + g_priorityPad, "\r\n");
|
||||
strcat(msg + g_priorityPad, "\r\n");
|
||||
#else
|
||||
strcat(msg + g_priorityPad, "\n");
|
||||
strcat(msg + g_priorityPad, "\n");
|
||||
#endif
|
||||
|
||||
// print it
|
||||
CHoldLock lock(s_lock);
|
||||
if (s_outputter == NULL ||
|
||||
!s_outputter(priority, msg + g_maxPriorityLength - n)) {
|
||||
// print it
|
||||
CHoldLock lock(s_lock);
|
||||
if (s_outputter == NULL ||
|
||||
!s_outputter(priority, msg + g_maxPriorityLength - n)) {
|
||||
#if defined(CONFIG_PLATFORM_WIN32)
|
||||
openConsole();
|
||||
openConsole();
|
||||
#endif
|
||||
fprintf(stderr, "%s", msg + g_maxPriorityLength - n);
|
||||
}
|
||||
fprintf(stderr, "%s", msg + g_maxPriorityLength - n);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +275,7 @@ CLog::vsprint(
|
||||
}
|
||||
|
||||
// start allocating buffers until we write the whole string
|
||||
buffer = 0;
|
||||
buffer = NULL;
|
||||
do {
|
||||
delete[] buffer;
|
||||
len *= 2;
|
||||
|
||||
Reference in New Issue
Block a user