mirror of
https://github.com/SWG-Source/src.git
synced 2026-08-02 02:15:58 -04:00
(nope, not worth the time since it's static) Revert "in theory this will "normalize" these chars...worst case i turn this into"
This reverts commit 9dc52fbc7f.
This commit is contained in:
-36
@@ -65,41 +65,5 @@ constexpr const uint32 constcrc(const char *string)
|
||||
return (crc ^ CRC_INIT);
|
||||
}
|
||||
|
||||
constexpr const uint32 constcrcnormalizecalc(const char *input)
|
||||
{
|
||||
char* output = (char*) malloc( input + 1 );
|
||||
bool previousIsSlash = true;
|
||||
for ( ; *input; ++input)
|
||||
{
|
||||
const char c = *input;
|
||||
if (c == '\\' || c == '/')
|
||||
{
|
||||
if (!previousIsSlash)
|
||||
{
|
||||
// convert all backslashes to forward slashes and disallow multiple slashes in a row
|
||||
*(output++) = '/';
|
||||
previousIsSlash = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
if (c == '.')
|
||||
{
|
||||
// disallow dots after slashes. this will also handle multiple dots, and slashes following the dots
|
||||
if (!previousIsSlash)
|
||||
*(output++) = '.';
|
||||
}
|
||||
else
|
||||
{
|
||||
// lowercase all other characters
|
||||
*(output++) = static_cast<char>(tolower(c));
|
||||
previousIsSlash = false;
|
||||
}
|
||||
}
|
||||
|
||||
*output = '\0';
|
||||
|
||||
return constcrc(output);
|
||||
}
|
||||
|
||||
// ======================================================================
|
||||
|
||||
|
||||
Reference in New Issue
Block a user