diff --git a/src/nmt/frame.c b/src/nmt/frame.c index bb3adc2..9457581 100644 --- a/src/nmt/frame.c +++ b/src/nmt/frame.c @@ -71,7 +71,9 @@ void nmt_value2digits(uint64_t value, char *digits, int num) digit = (value >> ((num - 1 - i) << 2)) & 0xf; if (digit == 10) digits[i] = '0'; - else if (digit == 0 || digit > 10) + else if (digit == 0) + digits[i] = 'N'; + else if (digit > 10) digits[i] = '?'; else digits[i] = digit + '0'; @@ -88,8 +90,10 @@ uint64_t nmt_digits2value(const char *digits, int num) digit = *digits++; if (digit >= '1' && digit <= '9') value |= digit - '0'; - else + else if (digit == '0') value |= 10; + else + value |= 0; } return value; diff --git a/src/nmt/main.c b/src/nmt/main.c index 0c3df64..46ef79b 100644 --- a/src/nmt/main.c +++ b/src/nmt/main.c @@ -168,7 +168,10 @@ error_ta: goto error_ta; if (*p < '0' || *p > '9') goto error_ta; - traffic_area[0] = rc + '0'; + if (rc == -1) + traffic_area[0] = 'N'; + else + traffic_area[0] = rc + '0'; traffic_area[1] = *p; traffic_area[2] = '\0'; } diff --git a/src/nmt/nmt.c b/src/nmt/nmt.c index 7a92608..af0abe1 100644 --- a/src/nmt/nmt.c +++ b/src/nmt/nmt.c @@ -284,6 +284,8 @@ static struct nmt_country { { 2, "RU2", "", "" }, { 3, "RU3", "", "" }, { 4, "RU4", "", "" }, + { 4, "RU4", "", "" }, + { -1, "NULL", "", "" }, { 0, NULL, NULL, NULL } };