Fix log messages
This commit is contained in:
parent
68c5b9a098
commit
6c0ee5823a
@ -743,14 +743,14 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
|
|||||||
}
|
}
|
||||||
if (!sizeOfBuffer)
|
if (!sizeOfBuffer)
|
||||||
{
|
{
|
||||||
LOG.errpointer(__file, __line);
|
LOG.errmemory(__file, __line);
|
||||||
LOG.printf("! Buffer size is 0: gsprintf(buf,0,...).");
|
LOG.printf("! Buffer size is 0: gsprintf(buf,0,...).");
|
||||||
TestErrorExit();
|
MemoryErrorExit();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!*format)
|
if (!*format)
|
||||||
{
|
{
|
||||||
LOG.errpointer(__file, __line);
|
LOG.errtest(__file, __line);
|
||||||
LOG.printf("! Format is empty string: gsprintf(buffer,%i,"",...).", sizeOfBuffer);
|
LOG.printf("! Format is empty string: gsprintf(buffer,%i,"",...).", sizeOfBuffer);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -765,7 +765,7 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
|
|||||||
{
|
{
|
||||||
if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
|
if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
|
||||||
else buffer[sizeOfBuffer-1] = '\0';
|
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));
|
LOG.printf("! gsprintf()(buffer,%i,%s,...): _vsnprintf_s() error: \"%s\".", sizeOfBuffer, format, strerror(errno));
|
||||||
return -1;
|
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! ");
|
if (sizeOfBuffer>17) strcpy(buffer, " ERROR, see log! ");
|
||||||
else if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
|
else if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
|
||||||
buffer[sizeOfBuffer-1] = '\0'; // Microsoft implementation don't write final '\0' when buffer full.
|
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);
|
LOG.printf("! gsprintf(buffer,%i,%s,...): buffer overflow (need %i bytes).", sizeOfBuffer, format, ret);
|
||||||
}
|
}
|
||||||
else if (ret < 0)
|
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));
|
LOG.printf("! gsprintf()(buffer,%i,%s,...): _vsnprintf() error: \"%s\".", sizeOfBuffer, format, strerror(errno));
|
||||||
TestErrorExit();
|
TestErrorExit();
|
||||||
}
|
}
|
||||||
@ -795,7 +795,7 @@ int gsprintf(TCHAR* buffer, size_t sizeOfBuffer, const TCHAR* __file, int __line
|
|||||||
ret = vsnprintf(buffer, sizeOfBuffer, format, argptr);
|
ret = vsnprintf(buffer, sizeOfBuffer, format, argptr);
|
||||||
if (ret < 0) // Until glibc 2.0.6 vsnprintf() would return -1 when the output was truncated.
|
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));
|
LOG.printf("! gsprintf(buffer,%i,%s,...): vsnprintf() error: \"%s\".", sizeOfBuffer, format, strerror(errno));
|
||||||
TestErrorExit();
|
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! ");
|
if (sizeOfBuffer>17) strcpy(buffer, " ERROR, see log! ");
|
||||||
else if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
|
else if (sizeOfBuffer>7) strcpy(buffer," ERROR ");
|
||||||
else buffer[sizeOfBuffer-1] = '\0';
|
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);
|
LOG.printf("! gsprintf(buffer,%i,%s,...): buffer overflow (need %i bytes).", sizeOfBuffer, format, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user