X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fhameg-hmo%2Fprotocol.c;h=de93e74a7438c0919b2ddc4f84f6912a83d96efe;hb=9cfc695ffe5f04622f61acb98ea4ac91c3f4ffc3;hp=60731ec46574a35f98f3594d96b523039e55a0a4;hpb=8cccbac8da97397b61aa094c67e62ee922b628ed;p=libsigrok.git diff --git a/src/hardware/hameg-hmo/protocol.c b/src/hardware/hameg-hmo/protocol.c index 60731ec4..de93e74a 100644 --- a/src/hardware/hameg-hmo/protocol.c +++ b/src/hardware/hameg-hmo/protocol.c @@ -355,7 +355,8 @@ static int scope_state_get_array_option(struct sr_scpi_dev_inst *scpi, static int array_float_get(gchar *value, const uint64_t array[][2], int array_len, unsigned int *result) { - int i, pos, e; + int i, e; + size_t pos; uint64_t f; float s; unsigned int s_int; @@ -365,8 +366,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);