fixbug:index error when endian in BL or LB

This commit is contained in:
xiang.zhou
2023-09-05 08:45:53 +08:00
parent 472c655a79
commit 02f90c7780
+4 -4
View File
@@ -411,7 +411,7 @@ static void fix_value(neu_datatag_t *tag, neu_type_e value_type,
switch (tag->option.value32.endian) {
case NEU_DATATAG_ENDIAN_LB32:
neu_ntohs_p((uint16_t *) value->value.bytes.bytes);
neu_ntohs_p((uint16_t *) value->value.bytes.bytes + 2);
neu_ntohs_p((uint16_t *) (value->value.bytes.bytes + 2));
break;
case NEU_DATATAG_ENDIAN_BB32:
value->value.u32 = htonl(value->value.u32);
@@ -419,7 +419,7 @@ static void fix_value(neu_datatag_t *tag, neu_type_e value_type,
case NEU_DATATAG_ENDIAN_BL32:
value->value.u32 = htonl(value->value.u32);
neu_ntohs_p((uint16_t *) value->value.bytes.bytes);
neu_ntohs_p((uint16_t *) value->value.bytes.bytes + 2);
neu_ntohs_p((uint16_t *) (value->value.bytes.bytes + 2));
break;
case NEU_DATATAG_ENDIAN_LL32:
default:
@@ -435,7 +435,7 @@ static void fix_value(neu_datatag_t *tag, neu_type_e value_type,
switch (tag->option.value32.endian) {
case NEU_DATATAG_ENDIAN_LB32:
neu_ntohs_p((uint16_t *) value->value.bytes.bytes);
neu_ntohs_p((uint16_t *) value->value.bytes.bytes + 2);
neu_ntohs_p((uint16_t *) (value->value.bytes.bytes + 2));
break;
case NEU_DATATAG_ENDIAN_BB32:
value->value.u32 = htonl(value->value.u32);
@@ -443,7 +443,7 @@ static void fix_value(neu_datatag_t *tag, neu_type_e value_type,
case NEU_DATATAG_ENDIAN_BL32:
value->value.u32 = htonl(value->value.u32);
neu_ntohs_p((uint16_t *) value->value.bytes.bytes);
neu_ntohs_p((uint16_t *) value->value.bytes.bytes + 2);
neu_ntohs_p((uint16_t *) (value->value.bytes.bytes + 2));
break;
case NEU_DATATAG_ENDIAN_LL32:
default: