diff options
| author | Martin Ridgers <[email protected]> | 2021-09-09 13:32:57 +0200 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2021-09-14 14:29:27 +0200 |
| commit | 1910f6dcb2c1a93a8bb8e4f0829aeefb81980207 (patch) | |
| tree | 3743d97411dd9b0deea8046132b5df9a84fa874a /zencore/include | |
| parent | Forward declare SharedBuffer (diff) | |
| download | zen-1910f6dcb2c1a93a8bb8e4f0829aeefb81980207.tar.xz zen-1910f6dcb2c1a93a8bb8e4f0829aeefb81980207.zip | |
Replaced use of str*_s variants as non-MSVC toolchains do not implement optional C11 component
Diffstat (limited to 'zencore/include')
| -rw-r--r-- | zencore/include/zencore/string.h | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/zencore/include/zencore/string.h b/zencore/include/zencore/string.h index de2ca71d9..2b5f20f86 100644 --- a/zencore/include/zencore/string.h +++ b/zencore/include/zencore/string.h @@ -560,15 +560,17 @@ NiceRate(uint64_t Num, uint32_t DurationMilliseconds, const char* Unit = "B") if (DurationMilliseconds) { - NiceNumToBuffer(Num * 1000 / DurationMilliseconds, Buffer); + // Leave a little of 'Buffer' for the "Unit/s" suffix + std::span<char> BufferSpan(Buffer, sizeof(Buffer) - 8); + NiceNumToBuffer(Num * 1000 / DurationMilliseconds, BufferSpan); } else { - strcpy_s(Buffer, "0"); + strcpy(Buffer, "0"); } - strcat_s(Buffer, Unit); - strcat_s(Buffer, "/s"); + strncat(Buffer, Unit, 4); + strcat(Buffer, "/s"); return Buffer; } |