Skip to content

Commit

Permalink
Merge branch 'google:master' into parseWithOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
KarolJakubKrawiec authored Jan 29, 2025
2 parents 2b6d054 + f0e422d commit 65f0f44
Show file tree
Hide file tree
Showing 147 changed files with 28,544 additions and 28,796 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0

- name: Install Protoc
uses: arduino/setup-protoc@v1
uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0
with:
version: '3.x'

Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/osv-scanner-unified.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,20 @@ jobs:
scan-scheduled:
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' }}
# If you want to copy this config, highly suggest pinning this version to a release rather than tracking the main branch
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@c80d3cb8d7bfabae9f047f6b8ea68792dd2ebcf6 # v1.9.0
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@8bd1ce1c4be9d98053ffd9e6e14585276a36762c" # v1.9.1
with:
# Just scan the root directory and docs, since everything else is fixtures
scan-args: |-
-r
--skip-git
./
scan-pr:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
# If you want to copy this config, highly suggest pinning this version to a release rather than tracking the main branch
uses: google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@c80d3cb8d7bfabae9f047f6b8ea68792dd2ebcf6 # v1.9.0
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable-pr.yml@8bd1ce1c4be9d98053ffd9e6e14585276a36762c" # v1.9.1
with:
# Just scan the root directory and docs, since everything else is fixtures
scan-args: |-
-r
--skip-git
./
19 changes: 14 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
target/
!tools/java/cpp-build/target/cpp-build-1.0-SNAPSHOT-jar-with-dependencies.jar
build/
lib/
generated/
# Ignore build directories and any files generated by the update script.
cpp/build/
cpp/src/phonenumbers/geocoding/geocoding_data.cc
cpp/src/phonenumbers/phonemetadata.pb.*
cpp/src/phonenumbers/phonenumber.pb.*
cpp/test/phonenumbers/geocoding/geocoding_test_data.cc
java/build/
java/demo/war/WEB-INF/classes/
java/demo/war/WEB-INF/lib/
java/**/target/
# Ignore the logs directory
/logs/
# Ignore ourselves because this is not intended to be submitted.
/.gitignore
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Cream Sandwich).
The [Java demo](https://libphonenumber.appspot.com/) is updated with a slight
delay after the GitHub release.

Last demo update: v8.13.50.
Last demo update: v8.13.53.

Note: Even though the library (main branch/[maven release](https://repo1.maven.org/maven2/com/googlecode/libphonenumber/libphonenumber/8.12.56/))
is at v8.12.57, because of some deployment issues, we were unable to update the
Expand Down
22,490 changes: 11,249 additions & 11,241 deletions cpp/src/phonenumbers/lite_metadata.cc

Large diffs are not rendered by default.

24,961 changes: 12,484 additions & 12,477 deletions cpp/src/phonenumbers/metadata.cc

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions cpp/src/phonenumbers/phonenumberutil.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,17 @@ void PhoneNumberUtil::FormatOutOfCountryKeepingAlphaChars(
PrefixNumberWithCountryCallingCode(country_code, INTERNATIONAL,
formatted_number);
}
std::string region_code;
GetRegionCodeForCountryCode(country_code, &region_code);
// Metadata cannot be null because the country code is valid.
const PhoneMetadata* metadata_for_region =
GetMetadataForRegionOrCallingCode(country_code, region_code);
// Strip any extension
std::string extension;
MaybeStripExtension(formatted_number, &extension);
// Append the formatted extension
MaybeAppendFormattedExtension(number, *metadata_for_region, INTERNATIONAL,
formatted_number);
}

const NumberFormat* PhoneNumberUtil::ChooseFormattingPatternForNumber(
Expand Down
14 changes: 14 additions & 0 deletions cpp/src/phonenumbers/phonenumberutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,13 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// would most likely be area codes) and length (obviously includes the
// length of area codes for fixed line numbers), it will return false for
// the subscriber-number-only version.
//
// There is a known issue with this method: if a number is possible only in a
// certain region among several regions that share the same country calling
// code, this method will consider only the "main" region. For example,
// +1310xxxx are valid numbers in Canada. However, they are not possible in
// the US. As a result, this method will return false for +1310xxxx. See
// https://issuetracker.google.com/issues/335892662 for more details.
ValidationResult IsPossibleNumberWithReason(const PhoneNumber& number) const;

// Convenience wrapper around IsPossibleNumberWithReason(). Instead of
Expand Down Expand Up @@ -568,6 +575,13 @@ class PhoneNumberUtil : public Singleton<PhoneNumberUtil> {
// would most likely be area codes) and length (obviously includes the
// length of area codes for fixed line numbers), it will return false for
// the subscriber-number-only version.
//
// There is a known issue with this method: if a number is possible only in a
// certain region among several regions that share the same country calling
// code, this method will consider only the "main" region. For example,
// +1310xxxx are valid numbers in Canada. However, they are not possible in
// the US. As a result, this method will return false for +1310xxxx. See
// https://issuetracker.google.com/issues/335892662 for more details.
ValidationResult IsPossibleNumberForTypeWithReason(
const PhoneNumber& number, PhoneNumberType type) const;

Expand Down
Loading

0 comments on commit 65f0f44

Please sign in to comment.