[libvirt] [PATCH v2] util: fix locale problem with virStrToDouble().

Martin Kletzander mkletzan at redhat.com
Tue Jun 20 14:42:14 UTC 2017


On Sun, Jun 18, 2017 at 03:20:11PM -0300, Julio Faracco wrote:
>This commit fixes a locale problem with locales that use comma as a mantissa
>separator. Example: 12.34 en_US = 12,34 pt_BR. Since strtod() is a non-safe
>function, virStrToDouble() will have problems to parse double numbers from
>kernel settings and other double numbers from static files (XMLs, JSONs, etc).
>
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457634
>Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457481
>
>Signed-off-by: Julio Faracco <jcfaracco at gmail.com>
>---
> src/util/virstring.c | 27 +++++++++++++++++++++++++++
> 1 file changed, 27 insertions(+)
>

I don't really like the duplication of the data and code.  I would
rather see virDoubleToStr move to virstring (it can be called
virStrFromDouble if some don't like the move), it is called from one
place anyway and that way it can share some of the code and data at
least.

I apologize for asking you for yet another version (and possibly
splitting it into two patches -- the move and the fix), but I haven't
notice in the previous submission.

Have a nice day,
Martin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20170620/a4baa07f/attachment-0001.sig>


More information about the libvir-list mailing list