From 51ed2fc42297d779e3e54c31c61dde5d47683742 Mon Sep 17 00:00:00 2001 From: couriersud Date: Tue, 23 Apr 2019 21:23:43 +0200 Subject: [PATCH] netlist: fix validation errors. (nw) --- src/lib/netlist/plib/putil.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/lib/netlist/plib/putil.h b/src/lib/netlist/plib/putil.h index cca55c732ef..771588831e9 100644 --- a/src/lib/netlist/plib/putil.h +++ b/src/lib/netlist/plib/putil.h @@ -163,12 +163,19 @@ namespace plib if (CLOCALE) { std::stringstream ss; - //ss.imbue(std::locale("C")); ss.imbue(std::locale::classic()); ss << arg; + long int len(ss.tellp()); long double x(0.0); - *idx = (ss >> x) ? static_cast(ss.tellg()) : 0; - //printf("%s, %f, %ld\n", arg, (double)x, *idx); + long int pos(0); + if (ss >> x) + { + pos = static_cast(ss.tellg()); + if (pos == -1) + pos = len; + } + *idx = static_cast(pos); + //printf("%s, %f, %lu %ld\n", arg, (double)x, *idx, (long int) ss.tellg()); return x; } else