From 01abcdfcac7e1b498252a6efcec3278b811f4946 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 18 Jun 2023 10:48:54 +0200 Subject: [PATCH] Codechange: make StringParameters#next_type only writable from outside the class --- src/strings.cpp | 2 +- src/strings_internal.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/strings.cpp b/src/strings.cpp index a7efd7b8b6..2c0549b9f1 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -899,7 +899,7 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara continue; } - args.next_type = b; + args.SetTypeOfNextParameter(b); switch (b) { case SCC_ENCODED: { uint64 sub_args_data[20]; diff --git a/src/strings_internal.h b/src/strings_internal.h index 9781c8f6b6..869ad121ed 100644 --- a/src/strings_internal.h +++ b/src/strings_internal.h @@ -19,10 +19,11 @@ protected: uint64 *data; ///< Array with the actual data. WChar *type; ///< Array with type information about the data. Can be nullptr when no type information is needed. See #StringControlCode. + WChar next_type = 0; ///< The type of the next data that is retrieved. + public: size_t offset = 0; ///< Current offset in the data/type arrays. size_t num_param; ///< Length of the data array. - WChar next_type = 0; ///< The type of the next data that is retrieved. /** Create a new StringParameters instance. */ StringParameters(uint64 *data, size_t num_param, WChar *type) : @@ -57,6 +58,7 @@ public: } void ClearTypeInformation(); + void SetTypeOfNextParameter(WChar type) { this->next_type = type; } int64 GetInt64();