X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fhardware%2Fyokogawa-dlm%2Fprotocol.c;h=e63e6357f0cc3a130ec49feaa38706fffb23911c;hb=3db03efa4ad43f6d127c3d949a300596cac74ce9;hp=185f9d5c4b7b4944150c70d6a0dbc9a568fb2c49;hpb=b18b8a92028475ca3d9ab33c06248d37075837be;p=libsigrok.git diff --git a/src/hardware/yokogawa-dlm/protocol.c b/src/hardware/yokogawa-dlm/protocol.c index 185f9d5c..e63e6357 100644 --- a/src/hardware/yokogawa-dlm/protocol.c +++ b/src/hardware/yokogawa-dlm/protocol.c @@ -372,7 +372,8 @@ static int array_option_get(char *value, const char *(*array)[], static int array_float_get(gchar *value, const uint64_t array[][2], int array_len, int *result) { - int i, pos, e; + int i, e; + size_t pos; uint64_t f; float s; unsigned int s_int; @@ -382,8 +383,7 @@ static int array_float_get(gchar *value, const uint64_t array[][2], memset(es, 0, sizeof(es)); /* Get index of the separating 'E' character and break up the string. */ - pos = (int)g_strstr_len(value, strlen(value), "E"); - pos -= (int)value; + pos = strcspn(value, "E"); strncpy(ss, value, pos); strncpy(es, &(value[pos+1]), 3);