Codechange: replace some min/clamp constructs to ClampTo
This commit is contained in:
@@ -132,7 +132,7 @@ void SaveToHighScore()
|
||||
for (i = 0; i < SP_SAVED_HIGHSCORE_END; i++) {
|
||||
for (hs = _highscore_table[i]; hs != endof(_highscore_table[i]); hs++) {
|
||||
/* First character is a command character, so strlen will fail on that */
|
||||
byte length = std::min(sizeof(hs->company), StrEmpty(hs->company) ? 0 : strlen(&hs->company[1]) + 1);
|
||||
byte length = ClampTo<byte>(std::min(sizeof(hs->company), StrEmpty(hs->company) ? 0 : strlen(&hs->company[1]) + 1));
|
||||
|
||||
if (fwrite(&length, sizeof(length), 1, fp) != 1 || // write away string length
|
||||
fwrite(hs->company, length, 1, fp) > 1 || // Yes... could be 0 bytes too
|
||||
|
Reference in New Issue
Block a user