From 629c72c5847b62e6ebd17c37d23bae6658ec4046 Mon Sep 17 00:00:00 2001 From: Kristof Szabados <Kristof.Szabados@ericsson.com> Date: Wed, 10 Jun 2020 21:51:44 +0200 Subject: [PATCH] This should not cause problems, and still be a code better documenting itself. Signed-off-by: Kristof Szabados <Kristof.Szabados@ericsson.com> --- compiler2/ustring.hh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler2/ustring.hh b/compiler2/ustring.hh index 02acb2598..0df60ceaa 100644 --- a/compiler2/ustring.hh +++ b/compiler2/ustring.hh @@ -21,6 +21,7 @@ #define _Common_ustring_HH #include <string.h> +#include <limits.h> class string; @@ -53,9 +54,9 @@ private: public: - /** The largest possible value of type size_t. That is, size_t(-1). */ + /** The largest possible string length that can theoretically fit into the memory. */ static const size_t max_string_len = - (-1 - sizeof(ustring_struct)) / sizeof(universal_char) + 1; + (UINT_MAX - sizeof(ustring_struct)) / sizeof(universal_char) + 1; /** Constructs an empty string. */ ustring() : val_ptr(0) { init_struct(0); } -- GitLab