Fix a number of format errors when using debug macros.

This commit is contained in:
Johanna Amann 2016-08-12 15:42:02 -07:00
parent 1889f409e9
commit c464cf78dd
7 changed files with 13 additions and 13 deletions

View file

@ -58,8 +58,8 @@ public:
void OpenDebugLog(const char* filename = 0); void OpenDebugLog(const char* filename = 0);
void Log(DebugStream stream, const char* fmt, ...); void Log(DebugStream stream, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
void Log(const plugin::Plugin& plugin, const char* fmt, ...); void Log(const plugin::Plugin& plugin, const char* fmt, ...) __attribute__((format(printf, 3, 4)));
void PushIndent(DebugStream stream) void PushIndent(DebugStream stream)
{ ++streams[int(stream)].indent; } { ++streams[int(stream)].indent; }

View file

@ -250,7 +250,7 @@ struct ping_args {
}; };
#ifdef DEBUG #ifdef DEBUG
# define DEBUG_COMM(msg) DBG_LOG(DBG_COMM, msg) # define DEBUG_COMM(msg) DBG_LOG(DBG_COMM, "%s", msg)
#else #else
# define DEBUG_COMM(msg) # define DEBUG_COMM(msg)
#endif #endif

View file

@ -126,7 +126,7 @@ bool BinarySerializationFormat::Read(uint32* v, const char* tag)
return false; return false;
*v = ntohl(*v); *v = ntohl(*v);
DBG_LOG(DBG_SERIAL, "Read uint32 %ld [%s]", *v, tag); DBG_LOG(DBG_SERIAL, "Read uint32 %u [%s]", *v, tag);
return true; return true;
} }
@ -313,7 +313,7 @@ bool BinarySerializationFormat::Write(uint16 v, const char* tag)
bool BinarySerializationFormat::Write(uint32 v, const char* tag) bool BinarySerializationFormat::Write(uint32 v, const char* tag)
{ {
DBG_LOG(DBG_SERIAL, "Write uint32 %ld [%s]", v, tag); DBG_LOG(DBG_SERIAL, "Write uint32 %u [%s]", v, tag);
v = htonl(v); v = htonl(v);
return WriteData(&v, sizeof(v)); return WriteData(&v, sizeof(v));
} }
@ -327,7 +327,7 @@ bool BinarySerializationFormat::Write(int v, const char* tag)
bool BinarySerializationFormat::Write(uint64 v, const char* tag) bool BinarySerializationFormat::Write(uint64 v, const char* tag)
{ {
DBG_LOG(DBG_SERIAL, "Write uint64 %lu [%s]", v, tag); DBG_LOG(DBG_SERIAL, "Write uint64 %llu [%s]", v, tag);
uint32 x[2]; uint32 x[2];
x[0] = htonl(v >> 32); x[0] = htonl(v >> 32);
x[1] = htonl(v & 0xffffffff); x[1] = htonl(v & 0xffffffff);
@ -336,7 +336,7 @@ bool BinarySerializationFormat::Write(uint64 v, const char* tag)
bool BinarySerializationFormat::Write(int64 v, const char* tag) bool BinarySerializationFormat::Write(int64 v, const char* tag)
{ {
DBG_LOG(DBG_SERIAL, "Write int64 %ld [%s]", v, tag); DBG_LOG(DBG_SERIAL, "Write int64 %lld [%s]", v, tag);
uint32 x[2]; uint32 x[2];
x[0] = htonl(v >> 32); x[0] = htonl(v >> 32);
x[1] = htonl(v & 0xffffffff); x[1] = htonl(v & 0xffffffff);

View file

@ -441,7 +441,7 @@ void Analyzer::RemoveChildAnalyzer(ID id)
LOOP_OVER_CHILDREN(i) LOOP_OVER_CHILDREN(i)
if ( (*i)->id == id && ! ((*i)->finished || (*i)->removing) ) if ( (*i)->id == id && ! ((*i)->finished || (*i)->removing) )
{ {
DBG_LOG(DBG_ANALYZER, "%s disabling child %s", GetAnalyzerName(), id, DBG_LOG(DBG_ANALYZER, "%s disabling child %s",
fmt_analyzer(this).c_str(), fmt_analyzer(*i).c_str()); fmt_analyzer(this).c_str(), fmt_analyzer(*i).c_str());
// See comment above. // See comment above.
(*i)->removing = true; (*i)->removing = true;
@ -638,7 +638,7 @@ void Analyzer::EndOfData(bool is_orig)
void Analyzer::FlipRoles() void Analyzer::FlipRoles()
{ {
DBG_LOG(DBG_ANALYZER, "%s FlipRoles()"); DBG_LOG(DBG_ANALYZER, "%s FlipRoles()", fmt_analyzer(this).c_str());
LOOP_OVER_CHILDREN(i) LOOP_OVER_CHILDREN(i)
(*i)->FlipRoles(); (*i)->FlipRoles();

View file

@ -533,7 +533,7 @@ void File::EndOfFile()
void File::Gap(uint64 offset, uint64 len) void File::Gap(uint64 offset, uint64 len)
{ {
DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Gap of size %" PRIu64 " at offset %," PRIu64, DBG_LOG(DBG_FILE_ANALYSIS, "[%s] Gap of size %" PRIu64 " at offset %" PRIu64,
id.c_str(), len, offset); id.c_str(), len, offset);
if ( file_reassembler && ! file_reassembler->IsCurrentlyFlushing() ) if ( file_reassembler && ! file_reassembler->IsCurrentlyFlushing() )

View file

@ -9,7 +9,7 @@ FileTimer::FileTimer(double t, const string& id, double interval)
: Timer(t + interval, TIMER_FILE_ANALYSIS_INACTIVITY), file_id(id) : Timer(t + interval, TIMER_FILE_ANALYSIS_INACTIVITY), file_id(id)
{ {
DBG_LOG(DBG_FILE_ANALYSIS, "New %f second timeout timer for %s", DBG_LOG(DBG_FILE_ANALYSIS, "New %f second timeout timer for %s",
file_id.c_str(), interval); interval, file_id.c_str());
} }
void FileTimer::Dispatch(double t, int is_expire) void FileTimer::Dispatch(double t, int is_expire)

View file

@ -1853,7 +1853,7 @@ bool Manager::SendEvent(ReaderFrontend* reader, const string& name, const int nu
} }
#ifdef DEBUG #ifdef DEBUG
DBG_LOG(DBG_INPUT, "SendEvent for event %s with num_vals vals", DBG_LOG(DBG_INPUT, "SendEvent for event %s with %d vals",
name.c_str(), num_vals); name.c_str(), num_vals);
#endif #endif
@ -1909,7 +1909,7 @@ void Manager::SendEvent(EventHandlerPtr ev, list<Val*> events)
val_list* vl = new val_list; val_list* vl = new val_list;
#ifdef DEBUG #ifdef DEBUG
DBG_LOG(DBG_INPUT, "SendEvent with %d vals (list)", DBG_LOG(DBG_INPUT, "SendEvent with %lu vals (list)",
events.size()); events.size());
#endif #endif