make logging with threads compile on mac os and fix a couple of string literal warnings.

This commit is contained in:
Bernhard Amann 2012-01-30 12:12:14 -08:00
parent e4e770d475
commit 6cc29a7832
3 changed files with 11 additions and 13 deletions

View file

@ -322,7 +322,7 @@ const uint32* mask_addr(const uint32* a, uint32 top_bits_to_keep)
if ( top_bits_to_keep == 0 || top_bits_to_keep > max_bits ) if ( top_bits_to_keep == 0 || top_bits_to_keep > max_bits )
{ {
reporter->Error("bad address mask value %s", top_bits_to_keep); reporter->Error("bad address mask value %u", top_bits_to_keep);
return addr; return addr;
} }

View file

@ -90,7 +90,7 @@ void Manager::Process()
else else
{ {
string s = msg->Name() + " failed, terminating thread"; string s = msg->Name() + " failed, terminating thread";
reporter->Error(s.c_str()); reporter->Error("%s", s.c_str());
t->Stop(); t->Stop();
} }

View file

@ -28,7 +28,7 @@ namespace threading {
class TerminateMessage : public InputMessage<MsgThread> class TerminateMessage : public InputMessage<MsgThread>
{ {
public: public:
TerminateMessage(MsgThread* thread) : InputMessage("Terminate", thread) { } TerminateMessage(MsgThread* thread) : InputMessage<MsgThread>("Terminate", thread) { }
virtual bool Process() { return true; } virtual bool Process() { return true; }
}; };
@ -56,7 +56,7 @@ class HeartbeatMessage : public InputMessage<MsgThread>
{ {
public: public:
HeartbeatMessage(MsgThread* thread, double arg_network_time, double arg_current_time) HeartbeatMessage(MsgThread* thread, double arg_network_time, double arg_current_time)
: InputMessage("Heartbeat", thread) : InputMessage<MsgThread>("Heartbeat", thread)
{ network_time = arg_network_time; current_time = arg_current_time; } { network_time = arg_network_time; current_time = arg_current_time; }
virtual bool Process() { return Object()->DoHeartbeat(network_time, current_time); } virtual bool Process() { return Object()->DoHeartbeat(network_time, current_time); }
@ -98,38 +98,36 @@ Message::~Message()
bool ReporterMessage::Process() bool ReporterMessage::Process()
{ {
string s = Object()->Name() + ": " + msg; string s = Object()->Name() + ": " + msg;
strreplace(s, "%", "%%");
const char* cmsg = s.c_str(); const char* cmsg = s.c_str();
switch ( type ) { switch ( type ) {
case INFO: case INFO:
reporter->Info(cmsg); reporter->Info("%s", cmsg);
break; break;
case WARNING: case WARNING:
reporter->Warning(cmsg); reporter->Warning("%s", cmsg);
break; break;
case ERROR: case ERROR:
reporter->Error(cmsg); reporter->Error("%s", cmsg);
break; break;
case FATAL_ERROR: case FATAL_ERROR:
reporter->FatalError(cmsg); reporter->FatalError("%s", cmsg);
break; break;
case FATAL_ERROR_WITH_CORE: case FATAL_ERROR_WITH_CORE:
reporter->FatalErrorWithCore(cmsg); reporter->FatalErrorWithCore("%s", cmsg);
break; break;
case INTERNAL_WARNING: case INTERNAL_WARNING:
reporter->InternalWarning(cmsg); reporter->InternalWarning("%s", cmsg);
break; break;
case INTERNAL_ERROR : case INTERNAL_ERROR :
reporter->InternalError(cmsg); reporter->InternalError("%s", cmsg);
break; break;
default: default: