mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 08:58:05 +02:00
Merge branch 'strtod-locale-fix' into 'master'
Strtod locale fix See merge request plymouth/plymouth!20
This commit is contained in:
commit
c8f12565fb
3 changed files with 25 additions and 5 deletions
|
|
@ -29,6 +29,7 @@
|
|||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <locale.h>
|
||||
#include <poll.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -1109,4 +1110,17 @@ ply_kernel_command_line_override (const char *command_line)
|
|||
kernel_command_line_is_set = true;
|
||||
}
|
||||
|
||||
double ply_strtod(const char *str)
|
||||
{
|
||||
char *old_locale;
|
||||
double ret;
|
||||
|
||||
/* Ensure strtod uses '.' as decimal separator, as we use this in our cfg files. */
|
||||
old_locale = setlocale(LC_NUMERIC, "C");
|
||||
ret = strtod(str, NULL);
|
||||
setlocale(LC_NUMERIC, old_locale);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */
|
||||
|
|
|
|||
|
|
@ -132,6 +132,8 @@ const char *ply_kernel_command_line_get_string_after_prefix (const char *prefix)
|
|||
bool ply_kernel_command_line_has_argument (const char *argument);
|
||||
void ply_kernel_command_line_override (const char *command_line);
|
||||
|
||||
double ply_strtod(const char *str);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* PLY_UTILS_H */
|
||||
|
|
|
|||
|
|
@ -423,6 +423,10 @@ view_load (view_t *view)
|
|||
view->watermark_area.height = ply_image_get_height (plugin->watermark_image);
|
||||
view->watermark_area.x = screen_width * plugin->watermark_horizontal_alignment - ply_image_get_width (plugin->watermark_image) * plugin->watermark_horizontal_alignment;
|
||||
view->watermark_area.y = screen_height * plugin->watermark_vertical_alignment - ply_image_get_height (plugin->watermark_image) * plugin->watermark_vertical_alignment;
|
||||
ply_trace ("using %ldx%ld watermark centered at %ldx%ld for %ldx%ld screen",
|
||||
view->watermark_area.width, view->watermark_area.height,
|
||||
view->watermark_area.x, view->watermark_area.y,
|
||||
screen_width, screen_height);
|
||||
}
|
||||
|
||||
ply_trace ("loading entry");
|
||||
|
|
@ -746,28 +750,28 @@ create_plugin (ply_key_file_t *key_file)
|
|||
|
||||
alignment = ply_key_file_get_value (key_file, "two-step", "HorizontalAlignment");
|
||||
if (alignment != NULL)
|
||||
plugin->animation_horizontal_alignment = strtod (alignment, NULL);
|
||||
plugin->animation_horizontal_alignment = ply_strtod (alignment);
|
||||
else
|
||||
plugin->animation_horizontal_alignment = .5;
|
||||
free (alignment);
|
||||
|
||||
alignment = ply_key_file_get_value (key_file, "two-step", "VerticalAlignment");
|
||||
if (alignment != NULL)
|
||||
plugin->animation_vertical_alignment = strtod (alignment, NULL);
|
||||
plugin->animation_vertical_alignment = ply_strtod (alignment);
|
||||
else
|
||||
plugin->animation_vertical_alignment = .5;
|
||||
free (alignment);
|
||||
|
||||
alignment = ply_key_file_get_value (key_file, "two-step", "WatermarkHorizontalAlignment");
|
||||
if (alignment != NULL)
|
||||
plugin->watermark_horizontal_alignment = strtod (alignment, NULL);
|
||||
plugin->watermark_horizontal_alignment = ply_strtod (alignment);
|
||||
else
|
||||
plugin->watermark_horizontal_alignment = 1.0;
|
||||
free (alignment);
|
||||
|
||||
alignment = ply_key_file_get_value (key_file, "two-step", "WatermarkVerticalAlignment");
|
||||
if (alignment != NULL)
|
||||
plugin->watermark_vertical_alignment = strtod (alignment, NULL);
|
||||
plugin->watermark_vertical_alignment = ply_strtod (alignment);
|
||||
else
|
||||
plugin->watermark_vertical_alignment = .5;
|
||||
free (alignment);
|
||||
|
|
@ -786,7 +790,7 @@ create_plugin (ply_key_file_t *key_file)
|
|||
|
||||
transition_duration = ply_key_file_get_value (key_file, "two-step", "TransitionDuration");
|
||||
if (transition_duration != NULL)
|
||||
plugin->transition_duration = strtod (transition_duration, NULL);
|
||||
plugin->transition_duration = ply_strtod (transition_duration);
|
||||
else
|
||||
plugin->transition_duration = 0.0;
|
||||
free (transition_duration);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue