Replacing set_format_arg_on macro in favor of a more C++zy solution (#11350)

This commit is contained in:
Breno Rodrigues Guimarães authored and GitHub committed 2020-04-20 07:10:33 +02:00
1 parent 6992299c1a
commit d4a2a98e20
10 files changed
+146 -129

No files matched your search

+8 -10
View File
@@ -112,22 +112,20 @@ private:
{
char str_downloading_objects[256]{};
uint8_t args[32]{};
Formatter ft(args);
if (_downloadStatusInfo.Source.empty())
{
set_format_arg_on(args, 0, int16_t, static_cast<int16_t>(_downloadStatusInfo.Count));
set_format_arg_on(args, 2, int16_t, static_cast<int16_t>(_downloadStatusInfo.Total));
set_format_arg_on(args, 4, char*, _downloadStatusInfo.Name.c_str());
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
ft.add<char*>(_downloadStatusInfo.Name.c_str());
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, args);
}
else
{
set_format_arg_on(args, 0, char*, _downloadStatusInfo.Name.c_str());
set_format_arg_on(args, sizeof(char*), char*, _downloadStatusInfo.Source.c_str());
set_format_arg_on(
args, sizeof(char*) + sizeof(char*), int16_t, static_cast<int16_t>(_downloadStatusInfo.Count));
set_format_arg_on(
args, sizeof(char*) + sizeof(char*) + sizeof(int16_t), int16_t,
static_cast<int16_t>(_downloadStatusInfo.Total));
ft.add<char*>(_downloadStatusInfo.Name.c_str());
ft.add<char*>(_downloadStatusInfo.Source.c_str());
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
ft.add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, args);
}