X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fpipistrello-ols%2Fprotocol.c;fp=src%2Fhardware%2Fpipistrello-ols%2Fprotocol.c;h=62515050511b67ead751998e9f7bdd44ee100cc0;hb=4389a54204729b60c003814e7e91756b5c6ea454;hp=66430acb9544ad25f6e148e4d3b895d86ef48e2e;hpb=411b2f68227398fa7bdde653a37d3e739277fc08;p=libsigrok.git diff --git a/src/hardware/pipistrello-ols/protocol.c b/src/hardware/pipistrello-ols/protocol.c index 66430acb..62515050 100644 --- a/src/hardware/pipistrello-ols/protocol.c +++ b/src/hardware/pipistrello-ols/protocol.c @@ -210,7 +210,7 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str uint8_t key, type, token; GString *tmp_str, *devname, *version; guchar tmp_c; - int index, i; + int index; sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi->status = SR_ST_INACTIVE; @@ -264,10 +264,8 @@ SR_PRIV struct sr_dev_inst *p_ols_get_metadata(uint8_t *buf, int bytes_read, str break; case 1: /* 32-bit unsigned integer */ - tmp_int = 0; - for (i = 0; i < 4; i++) { - tmp_int = (tmp_int << 8) | buf[index++]; - } + tmp_int = RB32(&buf[index]); + index += sizeof(uint32_t); sr_dbg("Got metadata key 0x%.2x value 0x%.8x.", key, tmp_int); switch (token) {