From a4dbe13c3d6412094aa2adce5a3e20b40c61ef81 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Fri, 16 Jan 2015 21:26:37 -0600 Subject: [PATCH] Remove EQEmuLog::Dump --- common/debug.cpp | 69 +----------------------------------------------- common/debug.h | 1 - 2 files changed, 1 insertion(+), 69 deletions(-) diff --git a/common/debug.cpp b/common/debug.cpp index 136c4ddf0..fc7a4cc16 100644 --- a/common/debug.cpp +++ b/common/debug.cpp @@ -269,71 +269,4 @@ bool EQEmuLog::writeNTS(LogIDs id, bool dofile, const char *fmt, ...) } va_end(argptr); return true; -}; - -bool EQEmuLog::Dump(LogIDs id, uint8* data, uint32 size, uint32 cols, uint32 skip) -{ - if (!logFileValid) { - logger.LogDebug(EQEmuLogSys::Detail, "Error: Dump() from null pointer"); - return false; - } - if (size == 0) { - return true; - } - if (!LogFile) { - return false; - } - if (id >= MaxLogID) { - return false; - } - bool dofile = false; - if (pLogStatus[id] & 1) { - dofile = open(id); - } - if (!(dofile || pLogStatus[id] & 2)) { - return false; - } - LockMutex lock(&MLog[id]); - if (!logFileValid) { - return false; //check again for threading race reasons (to avoid two mutexes) - } - write(id, "Dumping Packet: %i", size); - // Output as HEX - int beginningOfLineOffset = 0; - uint32 indexInData; - std::string asciiOutput; - for (indexInData = skip; indexInData < size; indexInData++) { - if ((indexInData - skip) % cols == 0) { - if (indexInData != skip) { - writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); - } - writeNTS(id, dofile, "%4i: ", indexInData - skip); - asciiOutput.clear(); - beginningOfLineOffset = 0; - } else if ((indexInData - skip) % (cols / 2) == 0) { - writeNTS(id, dofile, "- "); - } - writeNTS(id, dofile, "%02X ", (unsigned char)data[indexInData]); - if (data[indexInData] >= 32 && data[indexInData] < 127) { - // According to http://msdn.microsoft.com/en-us/library/vstudio/ee404875(v=vs.100).aspx - // Visual Studio 2010 doesn't have std::to_string(int) but it does have the long long - // version. - asciiOutput.append(std::to_string((long long)data[indexInData])); - } else { - asciiOutput.append("."); - } - } - uint32 k = ((indexInData - skip) - 1) % cols; - if (k < 8) { - writeNTS(id, dofile, " "); - } - for (uint32 h = k + 1; h < cols; h++) { - writeNTS(id, dofile, " "); - } - writeNTS(id, dofile, " | %s\n", asciiOutput.c_str()); - if (dofile) { - fflush(fp[id]); - } - return true; -} - +}; \ No newline at end of file diff --git a/common/debug.h b/common/debug.h index 85894ba59..5c32eadce 100644 --- a/common/debug.h +++ b/common/debug.h @@ -93,7 +93,6 @@ public: bool write(LogIDs id, const char *fmt, ...); bool writePVA(LogIDs id, const char *prefix, const char *fmt, va_list args); - bool Dump(LogIDs id, uint8* data, uint32 size, uint32 cols=16, uint32 skip=0); private: bool open(LogIDs id); bool writeNTS(LogIDs id, bool dofile, const char *fmt, ...); // no error checking, assumes is open, no locking, no timestamp, no newline