libgrapheme

Freestanding C library for unicode string handling
git clone https://git.sinitax.com/suckless/libgrapheme
Log | Files | Refs | README | LICENSE | sfeed.txt

commit f2fce2eb1e47acdb12655fab7c1159bf31fa7ee2
parent 7e82c69bf25b4937a62ab96c5f7bba05b0fd2604
Author: Laslo Hunhold <dev@frign.de>
Date:   Mon,  1 Jun 2020 12:18:43 +0200

Ensure POSIX-conformance in the data tables

Explicitly "cast" the constants to 32 bits, as POSIX only guarantees
16 bits for int and the constants might overflow otherwise.

Signed-off-by: Laslo Hunhold <dev@frign.de>

Diffstat:
Mdata/emo.awk | 4++--
Mdata/gbp.awk | 4++--
Mdata/gbt.awk | 2+-
3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/data/emo.awk b/data/emo.awk @@ -47,7 +47,7 @@ function mktable(name, array, arrlen) { upper = sprintf("0x%s", upper); # print lower bound - printf("\t{ %s, ", lower); + printf("\t{ UINT32_C(%s), ", lower); for (; j < arrlen - 1; j++) { # look ahead and check if we have adjacent arrays @@ -70,7 +70,7 @@ function mktable(name, array, arrlen) { } # print upper bound - printf("%s },\n", upper); + printf("UINT32_C(%s) },\n", upper); } printf("};\n"); diff --git a/data/gbp.awk b/data/gbp.awk @@ -71,7 +71,7 @@ function mktable(name, array, arrlen) { upper = sprintf("0x%s", upper); # print lower bound - printf("\t{ %s, ", lower); + printf("\t{ UINT32_C(%s), ", lower); for (; j < arrlen - 1; j++) { # look ahead and check if we have adjacent arrays @@ -94,7 +94,7 @@ function mktable(name, array, arrlen) { } # print upper bound - printf("%s },\n", upper); + printf("UINT32_C(%s) },\n", upper); } printf("};\n"); diff --git a/data/gbt.awk b/data/gbt.awk @@ -40,7 +40,7 @@ $0 ~ /^#/ || $0 ~ /^\s*$/ { next } # print code points printf("\t{\n\t\t.cp = (uint32_t[]){ "); for (i = 0; i < ncps; i++) { - printf("0x%s", cp[i]); + printf("UINT32_C(0x%s)", cp[i]); if (i + 1 < ncps) { printf(", "); }