diff options
author | Thomas Munro <tmunro@postgresql.org> | 2020-07-22 16:38:20 +1200 |
---|---|---|
committer | Thomas Munro <tmunro@postgresql.org> | 2020-07-22 16:50:03 +1200 |
commit | a5073871ea655e37759f22f30c4c70359ad9759b (patch) | |
tree | b5f25334430c2999f01a6c76eee7cdf9f5ecd365 /src/backend/utils/mb/Unicode/convutils.pm | |
parent | e47c2602aa4d35a4e3eb6ada40454c6c0f1279bf (diff) | |
download | postgresql-a5073871ea655e37759f22f30c4c70359ad9759b.tar.gz postgresql-a5073871ea655e37759f22f30c4c70359ad9759b.zip |
Fix conversion table generator scripts.
convutils.pm used implicit conversion of undefined value to integer
zero. Some of conversion scripts are susceptible to regexp greediness.
Fix, avoiding whitespace changes in the output. Also update ICU URLs
that moved.
No need to back-patch, because the output of these scripts is also in
the source tree so we shouldn't need to rerun them on back-branches.
Author: Kyotaro Horiguchi <horikyoga.ntt@gmail.com>
Discussion: https://postgr.es/m/CA%2BhUKGJ7SEGLbj%3D%3DTQCcyKRA9aqj8%2B6L%3DexSq1y25TA%3DWxLziQ%40mail.gmail.com
Diffstat (limited to 'src/backend/utils/mb/Unicode/convutils.pm')
-rw-r--r-- | src/backend/utils/mb/Unicode/convutils.pm | 62 |
1 files changed, 33 insertions, 29 deletions
diff --git a/src/backend/utils/mb/Unicode/convutils.pm b/src/backend/utils/mb/Unicode/convutils.pm index 2f64a12ea14..9d97061c6fe 100644 --- a/src/backend/utils/mb/Unicode/convutils.pm +++ b/src/backend/utils/mb/Unicode/convutils.pm @@ -380,7 +380,8 @@ sub print_radix_table { header => "Dummy map, for invalid values", min_idx => 0, - max_idx => $widest_range + max_idx => $widest_range, + label => "dummy map" }; ### @@ -471,35 +472,37 @@ sub print_radix_table } # Also look up the positions of the roots in the table. - my $b1root = $segmap{"1-byte"}; - my $b2root = $segmap{"2-byte"}; - my $b3root = $segmap{"3-byte"}; - my $b4root = $segmap{"4-byte"}; + # Missing map represents dummy mapping. + my $b1root = $segmap{"1-byte"} || 0; + my $b2root = $segmap{"2-byte"} || 0; + my $b3root = $segmap{"3-byte"} || 0; + my $b4root = $segmap{"4-byte"} || 0; # And the lower-upper values of each level in each radix tree. - my $b1_lower = $min_idx{1}{1}; - my $b1_upper = $max_idx{1}{1}; - - my $b2_1_lower = $min_idx{2}{1}; - my $b2_1_upper = $max_idx{2}{1}; - my $b2_2_lower = $min_idx{2}{2}; - my $b2_2_upper = $max_idx{2}{2}; - - my $b3_1_lower = $min_idx{3}{1}; - my $b3_1_upper = $max_idx{3}{1}; - my $b3_2_lower = $min_idx{3}{2}; - my $b3_2_upper = $max_idx{3}{2}; - my $b3_3_lower = $min_idx{3}{3}; - my $b3_3_upper = $max_idx{3}{3}; - - my $b4_1_lower = $min_idx{4}{1}; - my $b4_1_upper = $max_idx{4}{1}; - my $b4_2_lower = $min_idx{4}{2}; - my $b4_2_upper = $max_idx{4}{2}; - my $b4_3_lower = $min_idx{4}{3}; - my $b4_3_upper = $max_idx{4}{3}; - my $b4_4_lower = $min_idx{4}{4}; - my $b4_4_upper = $max_idx{4}{4}; + # Missing values represent zero. + my $b1_lower = $min_idx{1}{1} || 0; + my $b1_upper = $max_idx{1}{1} || 0; + + my $b2_1_lower = $min_idx{2}{1} || 0; + my $b2_1_upper = $max_idx{2}{1} || 0; + my $b2_2_lower = $min_idx{2}{2} || 0; + my $b2_2_upper = $max_idx{2}{2} || 0; + + my $b3_1_lower = $min_idx{3}{1} || 0; + my $b3_1_upper = $max_idx{3}{1} || 0; + my $b3_2_lower = $min_idx{3}{2} || 0; + my $b3_2_upper = $max_idx{3}{2} || 0; + my $b3_3_lower = $min_idx{3}{3} || 0; + my $b3_3_upper = $max_idx{3}{3} || 0; + + my $b4_1_lower = $min_idx{4}{1} || 0; + my $b4_1_upper = $max_idx{4}{1} || 0; + my $b4_2_lower = $min_idx{4}{2} || 0; + my $b4_2_upper = $max_idx{4}{2} || 0; + my $b4_3_lower = $min_idx{4}{3} || 0; + my $b4_3_upper = $max_idx{4}{3} || 0; + my $b4_4_lower = $min_idx{4}{4} || 0; + my $b4_4_upper = $max_idx{4}{4} || 0; ### ### Find the maximum value in the whole table, to determine if we can @@ -607,7 +610,8 @@ sub print_radix_table for (my $j = 0; $j < $vals_per_line && $i <= $seg->{max_idx}; $j++) { - my $val = $seg->{values}->{$i}; + # missing values represent zero. + my $val = $seg->{values}->{$i} || 0; printf $out " 0x%0*x", $colwidth, $val; $off++; |