8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-27 20:03:03 +01:00

style, better asserts - thanks to Claudio

This commit is contained in:
alexpeshkoff 2009-06-04 13:01:08 +00:00
parent c5d8a8dfe7
commit d6d4a30671

View File

@ -3588,14 +3588,22 @@ static void safe_concat_path(TEXT *resultString, const TEXT *appendString)
* *
**************************************/ **************************************/
size_t len = strlen(resultString); size_t len = strlen(resultString);
if (resultString[len - 1] != PathUtils::dir_sep && len < MAXPATHLEN - 1) { if (resultString[len - 1] != PathUtils::dir_sep && len < MAXPATHLEN - 1)
{
resultString[len++] = PathUtils::dir_sep; resultString[len++] = PathUtils::dir_sep;
resultString[len] = 0; resultString[len] = 0;
} }
size_t alen = strlen(appendString); size_t alen = strlen(appendString);
if (len + alen > MAXPATHLEN - 1) if (len + alen > MAXPATHLEN - 1)
{
alen = MAXPATHLEN - 1 - len; alen = MAXPATHLEN - 1 - len;
fb_assert(len + alen <= MAXPATHLEN); }
fb_assert(len < MAXPATHLEN);
fb_assert(alen < MAXPATHLEN);
fb_assert(len + alen < MAXPATHLEN);
memcpy(&resultString[len], appendString, alen); memcpy(&resultString[len], appendString, alen);
resultString[len + alen] = 0; resultString[len + alen] = 0;
} }