[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 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

Attachment: signature.asc
Description: Digital signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]