performance fixes on win32 plus clean up of some warnings. also

improved error messages when uninstalling service.
This commit is contained in:
crs
2002-06-14 18:08:20 +00:00
parent 21af7b2f17
commit e3dcf7febf
21 changed files with 340 additions and 177 deletions

View File

@@ -11,6 +11,11 @@ CFunctionJob::CFunctionJob(void (*func)(void*), void* arg) :
// do nothing
}
CFunctionJob::~CFunctionJob()
{
// do nothing
}
void
CFunctionJob::run()
{

View File

@@ -6,6 +6,7 @@
class CFunctionJob : public IJob {
public:
CFunctionJob(void (*func)(void*), void* arg = NULL);
virtual ~CFunctionJob();
// IJob overrides
virtual void run();

View File

@@ -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;

View File

@@ -7,6 +7,7 @@ template <class T>
class TMethodJob : public IJob {
public:
TMethodJob(T* object, void (T::*method)(void*), void* arg = NULL);
virtual ~TMethodJob();
// IJob overrides
virtual void run();
@@ -27,6 +28,13 @@ TMethodJob<T>::TMethodJob(T* object, void (T::*method)(void*), void* arg) :
// do nothing
}
template <class T>
inline
TMethodJob<T>::~TMethodJob()
{
// do nothing
}
template <class T>
inline
void

View File

@@ -30,6 +30,12 @@
// this one's a little too aggressive
#pragma warning(disable: 4127) // conditional expression is constant
// emitted incorrectly under release build in some circumstances
#if defined(NDEBUG)
#pragma warning(disable: 4702) // unreachable code
#pragma warning(disable: 4701) // local variable maybe used uninitialized
#endif
#endif // (_MSC_VER >= 1200)
#else