mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-14 08:04:40 +00:00
Cleaning up the checks
This commit is contained in:
parent
c4533b4dc4
commit
396fe5b0ad
1 changed files with 7 additions and 3 deletions
|
|
@ -47,21 +47,23 @@
|
||||||
|
|
||||||
#endif // defined(TORQUE_OS_WIN)
|
#endif // defined(TORQUE_OS_WIN)
|
||||||
|
|
||||||
#define DEBUG_CHECK_OVERFLOW 1
|
#define DEBUG_CHECK_STRING_OVERFLOW
|
||||||
|
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
// standard string functions [defined in platformString.cpp]
|
// standard string functions [defined in platformString.cpp]
|
||||||
|
|
||||||
|
#ifdef UNSAFE_STRING_FUNCTIONS
|
||||||
/// @deprecated Use dStrcat(char *, const char *, dsize_t) instead
|
/// @deprecated Use dStrcat(char *, const char *, dsize_t) instead
|
||||||
inline char *dStrcat(char *dst, const char *src)
|
inline char *dStrcat(char *dst, const char *src)
|
||||||
{
|
{
|
||||||
AssertFatal(false, "dStrcat without length is deprecated");
|
AssertFatal(false, "dStrcat without length is deprecated");
|
||||||
return strcat(dst,src);
|
return strcat(dst,src);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline char *dStrcat(char *dst, const char *src, dsize_t len)
|
inline char *dStrcat(char *dst, const char *src, dsize_t len)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CHECK_OVERFLOW
|
#ifdef DEBUG_CHECK_STRING_OVERFLOW
|
||||||
if (strlen(src) >= len) {
|
if (strlen(src) >= len) {
|
||||||
AssertWarn(false, "dStrcat out of range");
|
AssertWarn(false, "dStrcat out of range");
|
||||||
}
|
}
|
||||||
|
|
@ -99,16 +101,18 @@ inline S32 dStrnicmp(const char *str1, const char *str2, dsize_t len)
|
||||||
return strncasecmp( str1, str2, len );
|
return strncasecmp( str1, str2, len );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef UNSAFE_STRING_FUNCTIONS
|
||||||
/// @deprecated Use strcpy(char *, const char *, dsize_t) instead
|
/// @deprecated Use strcpy(char *, const char *, dsize_t) instead
|
||||||
inline char *dStrcpy(char *dst, const char *src)
|
inline char *dStrcpy(char *dst, const char *src)
|
||||||
{
|
{
|
||||||
AssertFatal(false, "dStrcpy without length is deprecated");
|
AssertFatal(false, "dStrcpy without length is deprecated");
|
||||||
return strcpy(dst,src);
|
return strcpy(dst,src);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
inline char *dStrcpy(char *dst, const char *src, dsize_t len)
|
inline char *dStrcpy(char *dst, const char *src, dsize_t len)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_CHECK_OVERFLOW
|
#ifdef DEBUG_CHECK_STRING_OVERFLOW
|
||||||
if (strlen(src) >= len) {
|
if (strlen(src) >= len) {
|
||||||
AssertWarn(false, "dStrcpy out of range");
|
AssertWarn(false, "dStrcpy out of range");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue