osmith has posted comments on this change. ( https://gerrit.osmocom.org/12524 )

Change subject: gsm23003: add osmo_imei_str_valid()
......................................................................


Patch Set 3:

(2 comments)

https://gerrit.osmocom.org/#/c/12524/3/src/gsm/gsm23003.c
File src/gsm/gsm23003.c:

https://gerrit.osmocom.org/#/c/12524/3/src/gsm/gsm23003.c@83
PS3, Line 83: bool
> I think it may be interesting to the caller *why* it failed validation. […]
This would be inconsistent with osmo_msisdn_str_valid() and 
osmo_imsi_str_valid() above, which return booleans. Should I implement it 
regardless of that?


https://gerrit.osmocom.org/#/c/12524/3/src/gsm/gsm23003.c@93
PS3, Line 93:   /* Verify Luhn algorithm (see Wikipedia)
            :    * digit id (i)  | 00 01 02 03 04 05 06 07 08 09 10 11 12 13 CHK
            :    * double        |     x     x     x     x     x     x     x
            :    * do not double |  x     x     x     x     x     x     x
            :          */
            :
            :   /* Double every second digit and add it to sum */
            :   for (i = 1; i < 14; i += 2) {
            :           int check = 2 * (imei[i] - '0');
            :           if (check > 9)
            :                   check -= 9;
            :           sum += check;
            :   }
> the IMEI checksumming function should definitely be a separate function, as 
> it may be useful in othe […]
Done



--
To view, visit https://gerrit.osmocom.org/12524
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: Id2d2a3a93b033bafc74c62e15297034bf4aafe61
Gerrit-Change-Number: 12524
Gerrit-PatchSet: 3
Gerrit-Owner: osmith <[email protected]>
Gerrit-Reviewer: Harald Welte <[email protected]>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Max <[email protected]>
Gerrit-Reviewer: Neels Hofmeyr <[email protected]>
Gerrit-Reviewer: Pau Espin Pedrol <[email protected]>
Gerrit-Reviewer: Vadim Yanitskiy <[email protected]>
Gerrit-Reviewer: osmith <[email protected]>
Gerrit-Comment-Date: Mon, 14 Jan 2019 14:06:27 +0000
Gerrit-HasComments: Yes
Gerrit-HasLabels: No

Reply via email to