From: Gerhard Sittig Date: Wed, 21 Feb 2018 17:13:36 +0000 (+0100) Subject: pipistrello-ols: style nit, replace DIY endianess conversion X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=4389a54204729b60c003814e7e91756b5c6ea454;p=libsigrok.git pipistrello-ols: style nit, replace DIY endianess conversion --- 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) {