Fix log messages

This commit is contained in:
Stas Degteff 2011-02-21 22:01:54 +00:00
parent 68c5b9a098
commit 6c0ee5823a

View File

@ -743,14 +743,14 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
}
if (!sizeOfBuffer)
{
LOG.errpointer(__file, __line);
LOG.errmemory(__file, __line);
LOG.printf("! Buffer size is 0: gsprintf(buf,0,...).");
TestErrorExit();
MemoryErrorExit();
return -1;
}
if (!*format)
{
LOG.errpointer(__file, __line);
LOG.errtest(__file, __line);
LOG.printf("! Format is empty string: gsprintf(buffer,%i,"",...).", sizeOfBuffer);
return 0;
}
@ -765,7 +765,7 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
{
if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
else buffer[sizeOfBuffer-1] = '\0';
LOG.errpointer(__FILE__,__LINE__-5);
LOG.errtest(__FILE__,__LINE__-5);
LOG.printf("! gsprintf()(buffer,%i,%s,...): _vsnprintf_s() error: \"%s\".", sizeOfBuffer, format, strerror(errno));
return -1;
}
@ -780,12 +780,12 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
if (sizeOfBuffer>17) strcpy(buffer, " ERROR, see log! ");
else if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
buffer[sizeOfBuffer-1] = '\0'; // Microsoft implementation don't write final '\0' when buffer full.
LOG.errpointer(__file, __line);
LOG.errmemory(__file, __line);
LOG.printf("! gsprintf(buffer,%i,%s,...): buffer overflow (need %i bytes).", sizeOfBuffer, format, ret);
}
else if (ret < 0)
{
LOG.errpointer(__file, __line);
LOG.errtest(__file, __line);
LOG.printf("! gsprintf()(buffer,%i,%s,...): _vsnprintf() error: \"%s\".", sizeOfBuffer, format, strerror(errno));
TestErrorExit();
}
@ -795,7 +795,7 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
ret = vsnprintf(buffer, sizeOfBuffer, format, argptr);
if (ret < 0) // Until glibc 2.0.6 vsnprintf() would return -1 when the output was truncated.
{
LOG.errpointer(__file, __line);
LOG.errtest(__file, __line);
LOG.printf("! gsprintf(buffer,%i,%s,...): vsnprintf() error: \"%s\".", sizeOfBuffer, format, strerror(errno));
TestErrorExit();
}
@ -804,7 +804,7 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
if (sizeOfBuffer>17) strcpy(buffer, " ERROR, see log! ");
else if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
else buffer[sizeOfBuffer-1] = '\0';
LOG.errpointer(__file, __line);
LOG.errmemory(__file, __line);
LOG.printf("! gsprintf(buffer,%i,%s,...): buffer overflow (need %i bytes).", sizeOfBuffer, format, ret);
}