]> sigrok.org Git - libsigrok.git/blobdiff - src/hardware/yokogawa-dlm/protocol.c
hameg-hmo/yokogawa-dlm: Fix warning about pointer typecast
[libsigrok.git] / src / hardware / yokogawa-dlm / protocol.c
index 185f9d5c4b7b4944150c70d6a0dbc9a568fb2c49..e63e6357f0cc3a130ec49feaa38706fffb23911c 100644 (file)
@@ -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);