1
0
Fork 0

Codechange: rename ClearTypeInformation so it can be used for preparing for the next run

pull/11049/head
Rubidium 2023-06-18 10:53:08 +02:00 committed by rubidium42
parent 01abcdfcac
commit 9c3c90effa
2 changed files with 9 additions and 6 deletions

View File

@ -62,11 +62,15 @@ static uint64 _global_string_params_data[20]; ///< Global array of string pa
static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_global_string_params static WChar _global_string_params_type[20]; ///< Type of parameters stored in #_global_string_params
StringParameters _global_string_params(_global_string_params_data, 20, _global_string_params_type); StringParameters _global_string_params(_global_string_params_data, 20, _global_string_params_type);
/** Reset the type array. */ /**
void StringParameters::ClearTypeInformation() * Prepare the string parameters for the next formatting run. This means
* resetting the type information and resetting the offset to the begin.
*/
void StringParameters::PrepareForNextRun()
{ {
assert(this->type != nullptr); assert(this->type != nullptr);
MemSetT(this->type, 0, this->num_param); MemSetT(this->type, 0, this->num_param);
this->offset = 0;
} }
@ -313,8 +317,7 @@ void GetStringWithArgs(StringBuilder &builder, StringID string, StringParameters
*/ */
std::string GetString(StringID string) std::string GetString(StringID string)
{ {
_global_string_params.ClearTypeInformation(); _global_string_params.PrepareForNextRun();
_global_string_params.offset = 0;
return GetStringWithArgs(string, _global_string_params); return GetStringWithArgs(string, _global_string_params);
} }
@ -907,7 +910,7 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara
bool sub_args_need_free[20]; bool sub_args_need_free[20];
StringParameters sub_args(sub_args_data, 20, sub_args_type); StringParameters sub_args(sub_args_data, 20, sub_args_type);
sub_args.ClearTypeInformation(); sub_args.PrepareForNextRun(); // Needed to reset the currently undefined types
memset(sub_args_need_free, 0, sizeof(sub_args_need_free)); memset(sub_args_need_free, 0, sizeof(sub_args_need_free));
char *p; char *p;

View File

@ -57,7 +57,7 @@ public:
} }
} }
void ClearTypeInformation(); void PrepareForNextRun();
void SetTypeOfNextParameter(WChar type) { this->next_type = type; } void SetTypeOfNextParameter(WChar type) { this->next_type = type; }
int64 GetInt64(); int64 GetInt64();