From 33859f3a2a6acccd1310fcf3c75f30c03347d938 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Mon, 17 Jul 2023 13:01:56 +0200 Subject: [PATCH] string: silence the code analysis warning for (nullptr, 0) combinations Functions are allowed to be called with nullptr string input as long as the length of those strings is set to 0. Signed-off-by: Simon Rozman --- include/stdex/string.hpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/stdex/string.hpp b/include/stdex/string.hpp index cddf3e321..ae4831c41 100644 --- a/include/stdex/string.hpp +++ b/include/stdex/string.hpp @@ -113,6 +113,7 @@ namespace stdex template inline size_t islbreak(_In_reads_or_z_opt_(count) const T* chr, _In_ size_t count) { + _Analysis_assume_(chr || !count); if (count >= 2 && (chr[0] == '\r' && chr[1] == '\n' || chr[0] == '\n' && chr[1] == '\r')) return 2; if (count > 1 && (chr[0] == '\n' || chr[0] == '\r')) @@ -128,6 +129,7 @@ namespace stdex /// inline size_t glyphlen(_In_reads_or_z_opt_(count) const wchar_t* glyph, size_t count) { + _Analysis_assume_(glyph || !count); if (count) { #ifdef _WIN32 size_t i = count < 2 || !is_surrogate_pair(glyph) ? 1 : 2;