summaryrefslogtreecommitdiff
path: root/android/OldPhoneNumberUtils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix false positives comparing local and intl numbersFrancisco Pimenta2017-07-181-31/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously when comparing local phone numbers with international it was possible to match the wrong number because the first digit of the area code was being treated as a skippable trunk digit, e.g: "550-123-4567" would be considered equal to "+14501234567". Since there are two different algorithms (loose/old and strict) there are two solutions with the same basic goal: Only ignore mismatches if there's an actual extra digit which could possibly be the trunk digit, i.e: "0550-123-4567" is acceptable as equal to "+15501234567". NB: The US not having a trunk digit to begin with is a different issue entirely - the code is agnostic on which country has which trunk digits! For "loose" matching we achieve this by checking the length of the mismatch. For "strict" matching we keep track of the supposed trunk digit and compare it against the current position in match. So for the above example 5 != 4. Several new unit tests were added (including replicating tests for OldPhoneNumberUtils). I broke down the c++ tests into smaller methods for additional readability. NB: By adding more tests I uncovered that two digit trunk prefixes were never handled correctly for the "strict" matching case. "Loose" matching is much more robust. I commented out the "strict" test cases. Test: All unit tests pass for PhoneNumberUtilsTest, OldPhoneNumberUtilsTest and DatabaseGeneralTest. Bug: 63179537 Bug: 63178542 Bug: 62916088 Change-Id: Idc2a1c2c2f64ed29995208503de4755c521e1c82
* Fix problem with const result from strchr()Mike Lockwood2010-05-191-1/+1
| | | | | | | Needed for simulator build on newer Ubuntu distributions. Change-Id: Ibb8cd3cdb4feae89a20eec56131e322f39721b1a Signed-off-by: Mike Lockwood <lockwood@android.com>
* bug #2180646: make comparing "404-04" and "40404" return true in the native ↵Wei Huang2009-10-231-4/+10
| | | | | | sqlite (loose) phone number comparison method. - when comparing two numbers whose dialable char length is less than the MIN_MATCH (7), treat them as equal if the dialable portion of the numbers match.
* make native sqlite phone_number_compare_loosely use MIN_MATCH of 7 instead of 5.Wei Huang2009-09-201-2/+2
| | | | Change-Id: Ie0dde105e810c07e05471182cd0c0f81045731ef
* Revert the default phone number comparation algorithm.Daisuke Miyakawa2009-09-201-0/+296
Now developers have to explicitly set the third argument of PHONE_NUMBERS_COMPARE() into 1, when they want to use "strict" phone number comparation algorithm, which was used in Donut. In default, PHONE_NUMBER_COMPARE() now uses "loose" phone number comparation algorithm, which had been used in Cupcake. Internal issue id: 1892808