From 9dbbd0a36e59a8c557306f28776f671dcd371762 Mon Sep 17 00:00:00 2001
From: Lionel Gauthier <lionel.gauthier@eurecom.fr>
Date: Thu, 2 Oct 2014 13:12:49 +0000
Subject: [PATCH] To resolv mnc length

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5831 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair2/ENB_APP/enb_config.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c
index f05b14ebe3..e61903f074 100755
--- a/openair2/ENB_APP/enb_config.c
+++ b/openair2/ENB_APP/enb_config.c
@@ -237,7 +237,10 @@ static void enb_config_display(void) {
         printf( "\tCell type:          \t%s:\n",enb_properties.properties[i]->cell_type == CELL_MACRO_ENB ? "CELL_MACRO_ENB":"CELL_HOME_ENB");
         printf( "\tTAC:                \t%u:\n",enb_properties.properties[i]->tac);
         printf( "\tMCC:                \t%u:\n",enb_properties.properties[i]->mcc);
-        printf( "\tMNC:                \t%u:\n",enb_properties.properties[i]->mnc);
+        if (enb_properties.properties[i]->mnc_digit_length == 3)
+            printf( "\tMNC:                \t%03u:\n",enb_properties.properties[i]->mnc);
+        else
+            printf( "\tMNC:                \t%02u:\n",enb_properties.properties[i]->mnc);
 
 	for (j=0; j< enb_properties.properties[i]->nb_cc; j++) {
 	  printf( "\teutra band for CC %d:         \t%d:\n",j,enb_properties.properties[i]->eutra_band[j]);
@@ -545,9 +548,13 @@ const Enb_properties_array_t *enb_config_init(char* lib_config_file_name_pP) {
                   enb_properties.properties[enb_properties_index]->mcc              = (uint16_t)atoi(mcc);
                   enb_properties.properties[enb_properties_index]->mnc              = (uint16_t)atoi(mnc);
                   enb_properties.properties[enb_properties_index]->mnc_digit_length = strlen(mnc);
+                  AssertFatal((enb_properties.properties[enb_properties_index]->mnc_digit_length == 2) ||
+                          (enb_properties.properties[enb_properties_index]->mnc_digit_length == 3),
+                          "BAD MNC DIGIT LENGTH %d",
+                          enb_properties.properties[i]->mnc_digit_length);
 
 
-                  // Parse optional physical parameters
+        // Parse optional physical parameters
 
 
 		  setting_component_carriers = config_setting_get_member (setting_enb, ENB_CONFIG_STRING_COMPONENT_CARRIERS);
-- 
GitLab