pipistrello-ols: style nit, replace DIY endianess conversion

This commit is contained in:
Gerhard Sittig 2018-02-21 18:13:36 +01:00 committed by Uwe Hermann
parent 411b2f6822
commit 4389a54204
1 changed files with 3 additions and 5 deletions

View File

@ -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; uint8_t key, type, token;
GString *tmp_str, *devname, *version; GString *tmp_str, *devname, *version;
guchar tmp_c; guchar tmp_c;
int index, i; int index;
sdi = g_malloc0(sizeof(struct sr_dev_inst)); sdi = g_malloc0(sizeof(struct sr_dev_inst));
sdi->status = SR_ST_INACTIVE; 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; break;
case 1: case 1:
/* 32-bit unsigned integer */ /* 32-bit unsigned integer */
tmp_int = 0; tmp_int = RB32(&buf[index]);
for (i = 0; i < 4; i++) { index += sizeof(uint32_t);
tmp_int = (tmp_int << 8) | buf[index++];
}
sr_dbg("Got metadata key 0x%.2x value 0x%.8x.", sr_dbg("Got metadata key 0x%.2x value 0x%.8x.",
key, tmp_int); key, tmp_int);
switch (token) { switch (token) {