]> sigrok.org Git - libsigrok.git/commitdiff
agilent-dmm: Make protocol parser locale-independent.
authorBert Vermeulen <redacted>
Tue, 21 Jan 2014 15:43:49 +0000 (16:43 +0100)
committerBert Vermeulen <redacted>
Tue, 21 Jan 2014 15:43:49 +0000 (16:43 +0100)
hardware/agilent-dmm/sched.c

index 290a2e7aee6a3ae56e0c0e1bdf2d151a0d6d181b..81fd333aabff735a0d295d663719cd0194711edb 100644 (file)
@@ -234,7 +234,7 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
        struct sr_datafeed_packet packet;
        struct sr_datafeed_analog analog;
        float fvalue;
-       char *mstr, *eptr;
+       char *mstr;
 
        sr_spew("FETC reply '%s'.", g_match_info_get_string(match));
        devc = sdi->priv;
@@ -252,12 +252,12 @@ static int recv_fetc(const struct sr_dev_inst *sdi, GMatchInfo *match)
                fvalue = NAN;
        } else {
                mstr = g_match_info_fetch(match, 1);
-               fvalue = strtof(mstr, &eptr);
-               g_free(mstr);
-               if (fvalue == 0.0 && eptr == mstr) {
+               if (sr_atof_ascii(mstr, &fvalue) != SR_OK || fvalue == 0.0) {
+                       g_free(mstr);
                        sr_err("Invalid float.");
                        return SR_ERR;
                }
+               g_free(mstr);
                if (devc->cur_divider > 0)
                        fvalue /= devc->cur_divider;
        }