Skip to content

Commit f077078

Browse files
jenshannoschwalmTurboGit
authored andcommitted
Fix gphoto conf compares
When comparing gphoto config float data we must do this independent from system locale.
1 parent a469638 commit f077078

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/common/camera_control.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2251,13 +2251,14 @@ static void _camera_configuration_notify_change(const dt_camctl_t *c,
22512251
// https://redmine.darktable.org/issues/12004 for the crash
22522252
// resulting from that.
22532253

2254-
// Get new_config and old_config value to be compared
2254+
// Get new_config and old_config value to be compared independent from locale
22552255
if(new_config_type == GP_WIDGET_RANGE)
22562256
{
22572257
float value;
22582258
if(gp_widget_get_value(new_config, &value) != GP_OK)
22592259
goto end;
2260-
new_config_value = g_strdup_printf("%.0f", value);
2260+
new_config_value = (char *)g_malloc(G_ASCII_DTOSTR_BUF_SIZE);
2261+
g_ascii_dtostr(new_config_value, G_ASCII_DTOSTR_BUF_SIZE, value);
22612262
}
22622263
else
22632264
if(gp_widget_get_value(new_config, &new_config_value) != GP_OK)
@@ -2268,7 +2269,8 @@ static void _camera_configuration_notify_change(const dt_camctl_t *c,
22682269
float value;
22692270
if(gp_widget_get_value(old_config_child, &value) != GP_OK)
22702271
goto end;
2271-
old_config_value = g_strdup_printf("%.0f", value);
2272+
old_config_value = (char *)g_malloc(G_ASCII_DTOSTR_BUF_SIZE);
2273+
g_ascii_dtostr(old_config_value, G_ASCII_DTOSTR_BUF_SIZE, value);
22722274
}
22732275
else
22742276
if(gp_widget_get_value(old_config_child, &old_config_value) != GP_OK)

0 commit comments

Comments
 (0)