correct some of my erroneous snprintfs

This commit is contained in:
DarthArgus
2016-07-31 07:20:21 +00:00
parent 1dff426bbe
commit 04ed17a152
3 changed files with 5 additions and 5 deletions
@@ -62,7 +62,7 @@ void FileLogObserver::prepareFile()
else
{
char buf[512];
IGNORE_RETURN( snprintf(buf, 512, "%s-%d", m_filename.c_str(), m_fileIndex+1) );
IGNORE_RETURN( snprintf(buf, sizeof(buf), "%s-%d", m_filename.c_str(), m_fileIndex+1) );
m_file = new StdioFile(buf, "a");
}
NOT_NULL(m_file);
@@ -91,7 +91,7 @@ void FileLogObserver::log(LogMessage const &msg)
std::string uniAttach(Unicode::wideToNarrow(msg.getUnicodeAttach()));
char tsbuf[16]; // yyyymmddhhmmss (14)
IGNORE_RETURN( snprintf(tsbuf, 16, UINT64_FORMAT_SPECIFIER, timestamp) );
IGNORE_RETURN( snprintf(tsbuf, sizeof(tsbuf), UINT64_FORMAT_SPECIFIER, timestamp) );
IGNORE_RETURN( m_file->write(14, tsbuf) );
IGNORE_RETURN( m_file->write(1, ":") );
IGNORE_RETURN( m_file->write(static_cast<int>(procId.length()), procId.c_str()) );
@@ -93,7 +93,7 @@ void TailFileLogObserver::prepareFile()
else
{
char buf[512];
IGNORE_RETURN( snprintf(buf, 512, "%s-%d", m_filename.c_str(), m_fileIndex+1) );
IGNORE_RETURN( snprintf(buf, sizeof(buf), "%s-%d", m_filename.c_str(), m_fileIndex+1) );
m_file = new StdioFile(buf, "a");
}
NOT_NULL(m_file);
@@ -123,7 +123,7 @@ void TailFileLogObserver::log(LogMessage const &msg)
char tsbuf[16]; // yyyymmddhhmmss (14)
newLogMessage.clear();
IGNORE_RETURN( snprintf(tsbuf, 16, UINT64_FORMAT_SPECIFIER, timestamp) );
IGNORE_RETURN( snprintf(tsbuf, sizeof(tsbuf), UINT64_FORMAT_SPECIFIER, timestamp) );
newLogMessage.append(tsbuf);
newLogMessage.append(":");
newLogMessage.append(procId);