[gimp/gimp-2-10] app: write floating-point vars using C locale in performance logs
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: write floating-point vars using C locale in performance logs
- Date: Fri, 4 Jan 2019 18:05:21 +0000 (UTC)
commit f08065b8c6cff7409efca992bf2ed817ab5dcd4b
Author: Ell <ell_se yahoo com>
Date: Fri Jan 4 13:01:37 2019 -0500
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
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]