Log truncated revision strings at debug level 1 instead of 0.
This commit is contained in:
@@ -415,7 +415,7 @@ void GamelogRevision()
|
|||||||
if (lc == NULL) return;
|
if (lc == NULL) return;
|
||||||
|
|
||||||
memset(lc->revision.text, 0, sizeof(lc->revision.text));
|
memset(lc->revision.text, 0, sizeof(lc->revision.text));
|
||||||
strecpy(lc->revision.text, _openttd_revision, lastof(lc->revision.text));
|
strecpy(lc->revision.text, _openttd_revision, lastof(lc->revision.text), true);
|
||||||
lc->revision.slver = SAVEGAME_VERSION;
|
lc->revision.slver = SAVEGAME_VERSION;
|
||||||
lc->revision.modified = _openttd_revision_modified;
|
lc->revision.modified = _openttd_revision_modified;
|
||||||
lc->revision.newgrf = _openttd_newgrf_version;
|
lc->revision.newgrf = _openttd_newgrf_version;
|
||||||
|
@@ -87,8 +87,7 @@ char *strecat(char *dst, const char *src, const char *last)
|
|||||||
*
|
*
|
||||||
* Copies the source string to the destination buffer with respect of the
|
* Copies the source string to the destination buffer with respect of the
|
||||||
* terminating null-character and the last pointer to the last element in
|
* terminating null-character and the last pointer to the last element in
|
||||||
* the destination buffer. If the last pointer is set to NULL no boundary
|
* the destination buffer.
|
||||||
* check is performed.
|
|
||||||
*
|
*
|
||||||
* @note usage: strecpy(dst, src, lastof(dst));
|
* @note usage: strecpy(dst, src, lastof(dst));
|
||||||
* @note lastof() applies only to fixed size arrays
|
* @note lastof() applies only to fixed size arrays
|
||||||
@@ -96,9 +95,10 @@ char *strecat(char *dst, const char *src, const char *last)
|
|||||||
* @param dst The destination buffer
|
* @param dst The destination buffer
|
||||||
* @param src The buffer containing the string to copy
|
* @param src The buffer containing the string to copy
|
||||||
* @param last The pointer to the last element of the destination buffer
|
* @param last The pointer to the last element of the destination buffer
|
||||||
|
* @param quiet_mode If set to true, emitted warning for truncating the input string is emitted at level 1 instead of 0
|
||||||
* @return The pointer to the terminating null-character in the destination buffer
|
* @return The pointer to the terminating null-character in the destination buffer
|
||||||
*/
|
*/
|
||||||
char *strecpy(char *dst, const char *src, const char *last)
|
char *strecpy(char *dst, const char *src, const char *last, bool quiet_mode)
|
||||||
{
|
{
|
||||||
assert(dst <= last);
|
assert(dst <= last);
|
||||||
while (dst != last && *src != '\0') {
|
while (dst != last && *src != '\0') {
|
||||||
@@ -110,7 +110,7 @@ char *strecpy(char *dst, const char *src, const char *last)
|
|||||||
#if defined(STRGEN) || defined(SETTINGSGEN)
|
#if defined(STRGEN) || defined(SETTINGSGEN)
|
||||||
error("String too long for destination buffer");
|
error("String too long for destination buffer");
|
||||||
#else /* STRGEN || SETTINGSGEN */
|
#else /* STRGEN || SETTINGSGEN */
|
||||||
DEBUG(misc, 0, "String too long for destination buffer");
|
DEBUG(misc, quiet_mode ? 1 : 0, "String too long for destination buffer");
|
||||||
#endif /* STRGEN || SETTINGSGEN */
|
#endif /* STRGEN || SETTINGSGEN */
|
||||||
}
|
}
|
||||||
return dst;
|
return dst;
|
||||||
|
@@ -32,7 +32,7 @@
|
|||||||
#include "string_type.h"
|
#include "string_type.h"
|
||||||
|
|
||||||
char *strecat(char *dst, const char *src, const char *last);
|
char *strecat(char *dst, const char *src, const char *last);
|
||||||
char *strecpy(char *dst, const char *src, const char *last);
|
char *strecpy(char *dst, const char *src, const char *last, bool quiet_mode = false);
|
||||||
char *stredup(const char *src, const char *last = NULL);
|
char *stredup(const char *src, const char *last = NULL);
|
||||||
|
|
||||||
int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4);
|
int CDECL seprintf(char *str, const char *last, const char *format, ...) WARN_FORMAT(3, 4);
|
||||||
|
Reference in New Issue
Block a user