integration fix: attempt to clarify ODD_PARITY

This may need to be refined.

The variable ODD_PARITY is defined at various places,
with different values, causing compilation warnings.

It's wrong to define a variable with different values.

A new variable is created, specific to IMEI case: IMEI_ODD_PARITY.
Maybe ODD_PARITY should also have 0xf as value, and so maybe only
one variable is necessary. To be checked at some point...
This commit is contained in:
Cedric Roux
2016-12-08 17:51:02 +01:00
parent 752ceb1922
commit 46b2ee9577
4 changed files with 6 additions and 5 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ typedef struct {
Byte_t digit14:4;
Byte_t digit13:4;
#define EVEN_PARITY 0
#define ODD_PARITY 0xf
#define ODD_PARITY 1
Byte_t parity:4;
Byte_t digit15:4;
} num;
+2 -2
View File
@@ -93,7 +93,7 @@ typedef struct imeisv_s{
uint8_t digit15:4;
uint8_t digit16:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
#define IMEI_ODD_PARITY 0xf
uint8_t parity:4;
} imeisv_t;
@@ -119,7 +119,7 @@ typedef struct imeisv_s {
uint8_t svn2:4;
uint8_t svn1:4;
#define EVEN_PARITY 0
#define ODD_PARITY 1
#define IMEI_ODD_PARITY 0xf
uint8_t parity:4;
} num;
#define IMEISV_BCD8_SIZE 9
+1 -1
View File
@@ -879,7 +879,7 @@ int emm_send_security_mode_complete(const emm_as_security_t *msg,
emm_msg->imeisv.imeisv.digit14 = 0x3;
emm_msg->imeisv.imeisv.digit15 = 0x0;
emm_msg->imeisv.imeisv.digit16 = 0x0;
emm_msg->imeisv.imeisv.parity = ODD_PARITY;
emm_msg->imeisv.imeisv.parity = IMEI_ODD_PARITY;
size += SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH;
}
+2 -1
View File
@@ -40,6 +40,7 @@ Description Defines the EPS Mobility Management procedure call manager,
#include "emm_main.h"
#include "nas_log.h"
#include "emmData.h"
#include "MobileIdentity.h"
#include "memory.h"
#include "usim_api.h"
@@ -919,7 +920,7 @@ static int _emm_main_get_imei(imei_t *imei, const char *imei_str)
int len = strlen(imei_str);
if (len % 2) {
imei->u.num.parity = ODD_PARITY;
imei->u.num.parity = IMEI_ODD_PARITY;
} else {
imei->u.num.parity = EVEN_PARITY;
}