From f08065b8c6cff7409efca992bf2ed817ab5dcd4b Mon Sep 17 00:00:00 2001 From: Ell Date: Fri, 4 Jan 2019 13:01:37 -0500 Subject: [PATCH] app: write floating-point vars using C locale in performance logs When writing floating-point instrumentation variables in performance logs, always use the C locale, rather than the current locale. (cherry picked from commit 626208b17cc23158a5251bd43aa638e75a98fbe8) --- app/widgets/gimpdashboard.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/widgets/gimpdashboard.c b/app/widgets/gimpdashboard.c index bd2feb5c5f..afd905db40 100644 --- a/app/widgets/gimpdashboard.c +++ b/app/widgets/gimpdashboard.c @@ -3493,6 +3493,16 @@ gimp_dashboard_log_sample (GimpDashboard *dashboard, __VA_ARGS__, \ variable_info->name) + #define LOG_VAR_FLOAT(value) \ + G_STMT_START \ + { \ + gchar buffer[G_ASCII_DTOSTR_BUF_SIZE]; \ + \ + LOG_VAR ("%s", g_ascii_dtostr (buffer, sizeof (buffer), \ + value)); \ + } \ + G_STMT_END + switch (variable_info->type) { case VARIABLE_TYPE_BOOLEAN: @@ -3528,25 +3538,23 @@ gimp_dashboard_log_sample (GimpDashboard *dashboard, break; case VARIABLE_TYPE_PERCENTAGE: - LOG_VAR ( - "%.16g", + LOG_VAR_FLOAT ( variable_data->value.percentage); break; case VARIABLE_TYPE_DURATION: - LOG_VAR ( - "%.16g", + LOG_VAR_FLOAT ( variable_data->value.duration); break; case VARIABLE_TYPE_RATE_OF_CHANGE: - LOG_VAR ( - "%.16g", + LOG_VAR_FLOAT ( variable_data->value.rate_of_change); break; } #undef LOG_VAR + #undef LOG_VAR_FLOAT } else {