summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* mktime: improve heuristic for ca-1986 Indiana DSTPaul Eggert2022-02-191-8/+20
| | | | | | | | | | | | | | | | Problem reported by Mark Krenz <https://bugs.gnu.org/48085>. * lib/mktime.c (__mktime_internal): Be more generous about accepting arguments with the wrong value of tm_isdst, by falling back to a one-hour DST difference if we find no nearby DST that is unusual. This fixes a problem where "1986-04-28 00:00 EDT" was rejected when TZ="America/Indianapolis" because the nearest DST timestamp occurred in 1970, a temporal distance too great for the old heuristic. This also also narrows the search a bit, which is a minor performance win. * m4/mktime.m4 (gl_FUNC_MKTIME_WORKS): Check for putenv failures and for Bug#48085. * tests/test-parse-datetime.c (main): Test for setenv failures and for Bug#48085.
* filevercmp: fix several unexpected resultsPaul Eggert2022-02-122-107/+146
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problems reported by Michael Debertol in <https://bugs.gnu.org/49239>. While looking into this, I spotted some more areas where the code and documentation did not agree, or where the documentation was unclear. The biggest change needed by coreutils is a new function filenvercmp that can compare byte strings containing NUL. * lib/filevercmp.c: Do not include sys/types.h, stdlib.h, string.h. Include idx.h, verify.h. (match_suffix): Remove, replacing all uses with calls to ... (file_prefixlen): ... this new function. Simplify it by avoiding the need for a confusing READ_ALPHA state variable. Change its API to something more useful, with a *LEN arg. it with a new *LEN arg. (file_prefixlen, verrevcmp): Prefer idx_t to size_t where either will do. (order): Change args to S, POS, LEN instead of just S[POS]. This lets us handle NUL bytes correctly. Callers changed. Verify that ints are sufficiently wide for its API. (verrevcmp): Don't assume that S1[S1_LEN] is a non-digit, and likewise for S2[S2_LEN]. The byte might not be accessible if filenvercmp is being called. (filevercmp): Reimplement by calling filenvercmp. (filenvercmp): New function, rewritten without the assumption that the inputs are null-terminated. Remove "easy comparison to see if strings are identical", as the use of it later (a) was undocumented, and (b) caused sort -V to be unstable. When both strings start with ".", do not skip past the "."s before looking for suffixes, as this disagreed with the documentation. * lib/filevercmp.h: Fix comments, which had many mistakes. (filenvercmp): New decl. * modules/filevercmp (Depends-on): Add idx, verify. Remove string. * tests/test-filevercmp.c: Include string.h. (examples): Reorder examples ".0" and ".9" that matched the code but not the documentation. The code has been fixed to match the documentation. Add some examples involving \1 so that they can be tried with both \1 and \0. Add some other examples taken from the bug report. (equals): New set of test cases. (sign, test_filevercmp): New functions. (main): Remove test case where the fixed filevercmp disagrees with strverscmp. Use test_filevercmp instead of filevercmp, so that we also test filenvercmp. Test the newly-introduced EQUALS cases.
* string: Fix "mismatched allocation function" warnings regarding strndup.Bruno Haible2022-02-101-8/+21
| | | | | | | * lib/string.in.h (strndup): Mark with _GL_ATTRIBUTE_MALLOC and _GL_ATTRIBUTE_DEALLOC_FREE. For GCC >= 11: Declare also when the platform already declares the function or when the module 'strndup' is not in use.
* parse-datetime: allow calculations to yield -1Paul Eggert2022-02-051-11/+11
| | | | | | | | Problem reported by Jeremy Cantrell <https://bugs.gnu.org/50115>. * lib/parse-datetime.y (parse_datetime_body): When calling mktime, use an unmodifed and negative tm_wday or tm_yday to detect an error, as a (time_t) -1 return value is valid on most hosts. * tests/test-parse-datetime.c (main): Add a test for the bug.
* userspec: help fix GNU ‘id’ incompatibilityPaul Eggert2022-02-041-0/+2
| | | | | | * lib/userspec.c (parse_with_separator): Don’t set *username to a numeric string that is not a user name, and similarly for *groupname. Needed to fix Bug#53631.
* argmatch: add variants that only match full argumentPádraig Brady2022-01-302-6/+43
| | | | | | | | * lib/argmatch.h (argmatch_exact, [X]ARGMATCH_EXACT): New interfaces that don't allow abbreviations. * lib/argmatch.c (argmatch_exact): Likewise. (__xargmatch_internal): Add a bool parameter to disable abbreviations. * tests/test-argmatch.c: Add tests.
* terminfo, terminfo-h: New modules.Bruno Haible2022-01-301-0/+116
| | | | | | | * lib/terminfo.h: New file, from GNU gettext. * m4/terminfo.m4: New file, from GNU gettext. * modules/terminfo: New file, from GNU gettext. * modules/terminfo-h: New file, from GNU gettext.
* termcap, termcap-h: New modules.Bruno Haible2022-01-303-0/+1056
| | | | | | | | | | * lib/termcap.h: New file, from GNU gettext. * lib/tparm.c: New file, from GNU gettext. * lib/tputs.c: New file, from GNU gettext. * m4/termcap.m4: New file, from GNU gettext. * m4/curses.m4: New file, from GNU gettext. * modules/termcap: New file, from GNU gettext. * modules/termcap-h: New file, from GNU gettext.
* maint: fix up stale XARGCASEMATCH commentPádraig Brady2022-01-301-1/+1
| | | | * lib/argmatch.c: Remove reference to no longer available macro.
* alignalloc: work around AddressSanitizer bugPaul Eggert2022-01-271-0/+15
| | | | | | | | | | | | * doc/posix-functions/aligned_alloc.texi (aligned_alloc): Mention AddressSanitizer bug. * lib/alignalloc.h (ALIGNALLOC_VIA_ALIGNED_ALLOC): Define to 0 if AddressSanitizer is in use. * tests/test-alignalloc.c (test_alignalloc): New function, which tests for non-aligned sizes too. (main): Use it. Don’t bother checking for alignments greater than 16 MiB, as this flummoxes AddressSanitizer and there seems little point to testing them.
* xstrtoimax, xstrtoumax: depend on inttypes-incompletePaul Eggert2022-01-233-0/+6
| | | | | | | | | | This fixes a call to strtoimax without declaring it, and similarly for strtoumax. * lib/xstrtoimax.c, lib/xstrtoumax.c (XSTRTOL_INCLUDE_INTTYPES_H): Define, so that strtoimax and strtoumax are declared. * lib/xstrtol.c [XSTRTOL_INCLUDE_INTTYPES_H]: Include inttypes.h. * modules/xstrtoimax, modules/xstrtoumax (Depends-on): Add inttypes-incomplete.
* alignalloc, xalignalloc: new modulesPaul Eggert2022-01-233-0/+252
| | | | | | | * lib/alignalloc.c, lib/alignalloc.h, lib/xalignalloc.c: * m4/alignalloc.m4, modules/alignalloc, modules/alignalloc-tests: * modules/xalignalloc, tests/test-alignalloc.c: New files.
* xstrtol: Trim dependencies.Bruno Haible2022-01-171-1/+2
| | | | | * lib/xstrtol.h: Include <stdint.h>, not <inttypes.h>. * modules/xstrtol (Depends-on): Add stdint. Remove inttypes-incomplete.
* xstrtol: remove unnecessary else after returnJim Meyering2022-01-171-2/+2
| | | | * lib/xstrtol.c (bkm_scale): Drop "else" after return.
* xstrtol: simplify integer overflow checkingPaul Eggert2022-01-161-10/+7
| | | | | | | * lib/xstrtol.c: Include intprops.h. (TYPE_SIGNED): Remove, as intprops.h defines that for us now. (bkm_scale): Use INT_MULTIPLY_WRAPV instead of checking for overflow by hand.
* oset-c++: Avoid compilation error with nvc++ 22.1.Bruno Haible2022-01-151-1/+1
| | | | * lib/gl_oset.hh: With EDG C++ compilers, avoid 'friend'.
* nstrftime: pacify nvc 22.1 unreachable statementPaul Eggert2022-01-141-1/+0
| | | | | * lib/nstrftime.c (__strftime_internal): Omit unreachable ‘break;’.
* intprops: work around nvc 22.1 bugPaul Eggert2022-01-141-2/+6
| | | | | | | Problem reported by Olivier Cessenat (Bug#53256). * lib/intprops.h (_GL_HAS_BUILTIN_ADD_OVERFLOW) [__EDG__]: Define to 0, since __builtin_add_overflow doesn’t work on NVIDIA HPC SDK 22.1.
* copy-file-range: work around Linux kernel bugPaul Eggert2022-01-142-1/+49
| | | | | | | | | | | | | | | | This workaround is adapted from Coreutils. * lib/copy-file-range.c [__linux__ && HAVE_COPY_FILE_RANGE]: Include <sys/utsname.h>. (copy_file_range): Use a stub to replace the copy_file_range of Linux kernel versions 4.5 through 5.2. * lib/unistd.in.h (copy_file_range): * m4/unistd_h.m4 (gl_UNISTD_H_DEFAULTS): * modules/copy-file-range (configure.ac): * modules/unistd (unistd.h): Support replacement of copy_file_range. * m4/copy-file-range.m4 (gl_FUNC_COPY_FILE_RANGE): Define HAVE_COPY_FILE_RANGE if the system has copy_file_range, and on Linux check whether the system’s is known to work.
* autoupdateKarl Berry2022-01-131-1/+2
|
* backupfile: fix bug when renaming not from wdPaul Eggert2022-01-101-7/+4
| | | | | | | | | | | * lib/backupfile.c (backupfile_internal): Fix bug when DIR_FD does not specify the working directory, and when RENAME. Without the bug fix, FILE is treated as relative to the working directory, not relative to DIR_FD, when renaming FILE. This bug was introduced when DIR_FD and RENAME were introduced, in 2018-10-24T02:10:21Z!eggert@cs.ucla.edu. While we’re at it, when SDIR is nonnegative improve performance a bit by passing an SDIR-relative old name to renameatu.
* c-stack: Adapt header file for use in C++ applications.Marc Nieper-Wißkirchen2022-01-081-0/+8
| | | | * lib/c-stack.h: Add extern "C" block.
* version-etc: Adapt header file for use in C++ applications.Marc Nieper-Wißkirchen2022-01-081-0/+9
| | | | * lib/version-etc.h: Add extern "C" block.
* sigsegv: Improve support for Linux/LoongArch64.Bruno Haible2022-01-071-0/+9
| | | | | * lib/sigsegv.c (SIGSEGV_FAULT_STACKPOINTER): Add special case for Linux/LoongArch.
* stack: also update stack_size to return idx_tPaul Eggert2022-01-051-3/+3
| | | | * lib/stack.h (_GL_STACK_PREFIX (size)): Return idx_t, not size_t.
* stack: pacify gcc -Wsign-comparePaul Eggert2022-01-051-1/+1
| | | | | | * lib/stack.h (_GL_STACK_TYPE): Use idx_t for size too. Suggested by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2022-01/msg00035.html
* license: fix GPLv3 texts to use a comma instead of semicolon.Bernhard Voelker2022-01-051464-1467/+1467
| | | | | | | | | See: https://www.gnu.org/licenses/gpl-3.0.html#howto Run: $ git grep -l 'Foundation; either version 3' \ | xargs sed -i '/Foundation; either version 3/ s/n; e/n, e/' * All files using GPLv3: Adjust via the above command.
* string, wchar: Fix compilation error on MSVC (regression 2021-09-07).Bruno Haible2022-01-042-6/+34
| | | | | | * lib/string.in.h (free): Don't redeclare as rpl_free. Instead, redefine _GL_ATTRIBUTE_DEALLOC_FREE to reference rpl_free directly. * lib/wchar.in.h (free): Likewise.
* getpass-gnu: Allow use as dependency from test modules.Bruno Haible2022-01-031-1/+2
| | | | | | | | | | | | | | | | * m4/getpass.m4 (gl_FUNC_GETPASS_GNU): Set REPLACE_GETPASS_FOR_GETPASS_GNU instead of REPLACE_GETPASS. * m4/unistd_h.m4 (gl_UNISTD_H_REQUIRE_DEFAULTS): Initialize the getpass-gnu module indicator. (gl_UNISTD_H_DEFAULTS): Initialize REPLACE_GETPASS_FOR_GETPASS_GNU. * modules/unistd (Makefile.am): Substitute GNULIB_GETPASS_GNU, REPLACE_GETPASS_FOR_GETPASS_GNU. * modules/getpass-gnu (configure.ac): Test REPLACE_GETPASS_FOR_GETPASS_GNU instead of REPLACE_GETPASS. Set a module indicator. * lib/unistd.in.h (getpass): Test REPLACE_GETPASS, REPLACE_GETPASS_FOR_GETPASS_GNU, and the respective module indicators instead of just REPLACE_GETPASS.
* fopen-gnu: Allow use as dependency from test modules.Bruno Haible2022-01-031-1/+2
| | | | | | | | | | | | | | | | * m4/fopen.m4 (gl_FUNC_FOPEN_GNU): Set REPLACE_FOPEN_FOR_FOPEN_GNU instead of REPLACE_FOPEN. * m4/stdio_h.m4 (gl_STDIO_H_REQUIRE_DEFAULTS): Initialize the fopen-gnu module indicator. (gl_STDIO_H_DEFAULTS): Initialize REPLACE_FOPEN_FOR_FOPEN_GNU. * modules/stdio (Makefile.am): Substitute GNULIB_FOPEN_GNU, REPLACE_FOPEN_FOR_FOPEN_GNU. * modules/fopen-gnu (Depends-on): Add more dependencies. (configure.ac): Test REPLACE_FOPEN_FOR_FOPEN_GNU instead of REPLACE_FOPEN. * lib/stdio.in.h (fopen): Test REPLACE_FOPEN, REPLACE_FOPEN_FOR_FOPEN_GNU, and the respective module indicators instead of just REPLACE_FOPEN.
* realloc-gnu: Allow use as dependency from test modules.Bruno Haible2022-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | * m4/realloc.m4 (gl_FUNC_REALLOC_GNU): Set REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC. (gl_FUNC_REALLOC_POSIX): Set REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the realloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_GNU, REPLACE_REALLOC_FOR_REALLOC_POSIX, not REPLACE_REALLOC. * modules/realloc-posix (Depends-on, configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_POSIX instead of REPLACE_REALLOC. * modules/realloc-gnu (Comment): Remove section. (Depends-on): Add free-posix, malloc-gnu, xalloc-oversized. (configure.ac): Test REPLACE_REALLOC_FOR_REALLOC_GNU instead of REPLACE_REALLOC. Set a module indicator. * lib/stdlib.in.h (realloc): Test REPLACE_REALLOC_FOR_REALLOC_POSIX, REPLACE_REALLOC_FOR_REALLOC_GNU, and the respective module indicators instead of just REPLACE_REALLOC.
* calloc-gnu: Allow use as dependency from test modules.Bruno Haible2022-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | * m4/calloc.m4 (gl_FUNC_CALLOC_GNU): Set REPLACE_CALLOC_FOR_CALLOC_GNU instead of REPLACE_CALLOC. (gl_FUNC_CALLOC_POSIX): Set REPLACE_CALLOC_FOR_CALLOC_POSIX instead of REPLACE_CALLOC. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the calloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_CALLOC_FOR_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_POSIX, not REPLACE_CALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_GNU, REPLACE_CALLOC_FOR_CALLOC_POSIX, not REPLACE_CALLOC. * modules/calloc-posix (Depends-on, configure.ac): Test REPLACE_CALLOC_FOR_CALLOC_POSIX instead of REPLACE_CALLOC. * modules/calloc-gnu (Depends-on): Add xalloc-oversized. (configure.ac): Test REPLACE_CALLOC_FOR_CALLOC_GNU instead of REPLACE_CALLOC. Set a module indicator. * lib/stdlib.in.h (calloc): Test REPLACE_CALLOC_FOR_CALLOC_POSIX, REPLACE_CALLOC_FOR_CALLOC_GNU, and the respective module indicators instead of just REPLACE_CALLOC.
* malloc-gnu: Allow use as dependency from test modules.Bruno Haible2022-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | * m4/malloc.m4 (gl_FUNC_MALLOC_GNU): Set REPLACE_MALLOC_FOR_MALLOC_GNU instead of REPLACE_MALLOC. (gl_FUNC_MALLOC_PTRDIFF, gl_FUNC_MALLOC_POSIX): Set REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC. * m4/calloc.m4 (gl_FUNC_CALLOC_POSIX): Test REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC. * m4/realloc.m4 (gl_FUNC_REALLOC_POSIX): Likewise. * m4/stdlib_h.m4 (gl_STDLIB_H_REQUIRE_DEFAULTS): Initialize the malloc-gnu module indicator. (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_MALLOC_FOR_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_POSIX, not REPLACE_MALLOC. * modules/stdlib (Makefile.am): Substitute GNULIB_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_GNU, REPLACE_MALLOC_FOR_MALLOC_POSIX, not REPLACE_MALLOC. * modules/malloc-posix (Depends-on, configure.ac): Test REPLACE_MALLOC_FOR_MALLOC_POSIX instead of REPLACE_MALLOC. * modules/malloc-gnu (Comment): Remove section. (Depends-on): Add xalloc-oversized. (configure.ac): Test REPLACE_MALLOC_FOR_MALLOC_GNU instead of REPLACE_MALLOC. Set a module indicator. * lib/stdlib.in.h (malloc): Test REPLACE_MALLOC_FOR_MALLOC_POSIX, REPLACE_MALLOC_FOR_MALLOC_GNU, and the respective module indicators instead of just REPLACE_MALLOC.
* striconveh: Make the last change also work on Solaris 11.Bruno Haible2022-01-031-7/+10
| | | | * lib/striconveh.c (mem_cd_iconveh_internal): Tweak last commit.
* striconveh: Make the last change also work on musl libc.Bruno Haible2022-01-021-4/+23
| | | | | * lib/striconveh.c (mem_cd_iconveh_internal): Make the U+FFFD conversion also work with non-GNU iconv() implementations.
* autoupdatePaul Eggert2022-01-0111-11/+11
|
* striconveh: Support an error handler that produces a Unicode U+FFFD.Bruno Haible2022-01-012-15/+66
| | | | | | | | | | | | Suggested by Marc Nieper-Wißkirchen in <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00175.html>. * lib/iconveh.h (iconveh_replacement_character): New enum value. * lib/striconveh.c (mem_cd_iconveh_internal): When the handler is iconveh_replacement_character, try to produce U+FFFD when possible, instead of '?'. * tests/test-striconveh.c (main): Add GB18030 tests. Test also iconveh_replacement_character.
* maint: Update copyright notices in code generating programs.Bruno Haible2022-01-01178-212/+212
| | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (output_predicate_test, output_predicate, output_category, output_combclass, output_bidi_category, output_decimal_digit_test, output_decimal_digit, output_digit_test, output_digit, output_numeric_test, output_numeric, output_mirror, output_joining_type_test, output_joining_type, output_joining_group_test, output_joining_group, output_scripts, output_scripts_byname, output_blocks, output_ident_category, output_nonspacing_property, output_lbrk_tables, output_lbrk_rules_as_tables, output_wbrk_tables, output_gbp_test, output_gbp_table, output_decomposition_tables, output_composition_tables, output_simple_mapping_test, output_simple_mapping, output_casing_rules): Extend copyright year of generated file to 2022. * lib/uniname/gen-uninames.lisp (main): Likewise. Produce license notice that is consistent with the gnulib/etc/license-notices/ files. * All files regenerated.
* maint: run 'make update-copyright'Paul Eggert2022-01-012108-2109/+2109
|
* uniwidth: Optimize.Bruno Haible2021-12-314-579/+1177
| | | | | | | | | | | | | | | * lib/gen-uni-tables.c (output_nonspacing_property): Add version parameter. Emit the usual boilerplate header for generated files. (is_width2): New function, based on lib/uniwidth/width.c. (output_width2_property): New function. (main): Create uniwidth/width0.h instead of uniwidth/width.c.part. Create uniwidth/width2.h. * lib/uniwidth/width.c: Include width0.h, width2.h, bitmap.h. (nonspacing_table_data, nonspacing_table_ind): Remove here. (uc_width): Replace the double-width character with an u_width2 bitmap lookup. * modules/uniwidth/width (Files): Add lib/uniwidth/width0.h, lib/uniwidth/width2.h, lib/unictype/bitmap.h.
* Update to Unicode 14.0.0.Bruno Haible2021-12-31183-104710/+108896
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (UC_JOINING_GROUP_THIN_YEH, UC_JOINING_GROUP_VERTICAL_TAIL): New enum values. (fill_arabicshaping, joining_group_as_c_identifier): Recognize these joining groups. * lib/unictype.in.h (UC_JOINING_GROUP_THIN_YEH, UC_JOINING_GROUP_VERTICAL_TAIL): New enum values. * lib/unictype/joininggroup_name.h: Add the THIN_YEH, VERTICAL_TAIL joining groups. * lib/unictype/joininggroup_byname.gperf: Likewise. * lib/gen-uni-tables.c (LBP_ID1, LBP_ID2): New enum values. (LBP_ID): Assign artificial value. (get_lbp): Use the extended_pictographic property to assign LBP_ID1, LBP_ID2 instead of LBP_ID. Update such that unilbrk/lbrkprop.txt comes out as expected. (debug_output_lbp): Print either LBP_ID1 or LBP_ID2 as LBP_ID. (lbp_value_to_string): Handle LBP_ID1, LBP_ID2 instead of LBP_ID. (output_lbrk_rules_as_tables): Treat LBP_ID as macro that maps to two table rows/columns. In rule LB30b, use LBP_ID2 in addition to LBP_EB. Remove redundant part of rule LB27. * lib/unilbrk/lbrktables.h (LBP_ID1, LBP_ID2): New enum values. (LBP_ID): Remove enum value. (unilbrk_table): Update declaration. * lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop): Use LBP_ID1 instead of LBP_ID. * lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop): Likewise. * lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop): Likewise. * tests/unilbrk/test-u8-possible-linebreaks.c (test_function): Add a test of potential future emoji. * tests/unilbrk/test-u16-possible-linebreaks.c (test_function): Likewise. * tests/unilbrk/test-u32-possible-linebreaks.c (test_function): Likewise. * lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind): Update. (uc_width): Assign width 2 to the characters 0x1AFF0..0x1AFF3, 0x1AFF5..0x1AFFB, 0x1AFFD..0x1AFFE, 0x1B120..0x1B122, 0x1F6DD..0x1F6DF, 0x1F7F0, 0x1FA7B..0x1FA7C, 0x1FAA9..0x1FAAC, 0x1FAB7..0x1FABA, 0x1FAC3..0x1FAC5, 0x1FAD7..0x1FAD9, 0x1FAE0..0x1FAE7, 0x1FAF0..0x1FAF6. * tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters 0x0890..0x0891, 0x0898..0x089F, 0x08CA..0x0902, 0x0C3C, 0x180F, 0x1AC1..0x1ACE, 0x1DFA, 0x10F82..0x10F85, 0x11070, 0x11073..0x11074, 0x110C2, 0x1CF00..0x1CF2D, 0x1CF30..0x1CF46, 0x1E2AE. Expect ambiguous width for the character 0x1734. Expect width 2 for the characters 0x1AFF0..0x1AFF3, 0x1AFF5..0x1AFFB, 0x1AFFD..0x1AFFE, 0x1B120..0x1B122, 0x1F6DD..0x1F6DF, 0x1F7F0, 0x1FA7B..0x1FA7C, 0x1FAA9..0x1FAAC, 0x1FAB7..0x1FABA, 0x1FAC3..0x1FAC5, 0x1FAD7..0x1FAD9, 0x1FAE0..0x1FAE7, 0x1FAF0..0x1FAF6. * All generated files under lib/uni* and tests/uni*: Regenerate. * tests/uniname/NameAliases.txt: Update. * tests/uniname/UnicodeData.txt: Update. * tests/uninorm/NormalizationTest.txt: Update. * tests/unigbrk/GraphemeBreakTest.txt: Update. * tests/uniwbrk/WordBreakTest.txt: Update. * All the affected modules: Bump required libunistring version.
* Update to Unicode 13.0.0.Bruno Haible2021-12-31177-104377/+111174
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (is_WBP_MIDLETTER): Add character 0x055F. (get_wbp): Assign value WBP_ALETTER to the characters 0x02E5..0x02EB, 0x055A, 0x058A, 0xA708..0xA716. * lib/gen-uni-tables.c (LBP_CP1, LBP_CP2, LBP_OP1, LBP_OP2): New enum values. (LBP_OP, LBP_CP): Assign artificial values. (get_lbp): Use the unicode_width[] table to assign LBP_CP1, LBP_CP2 instead of LBP_CP, and LBP_OP1, LBP_OP2 instead of LBP_OP. Update such that unilbrk/lbrkprop.txt comes out as expected. (debug_output_lbp): Print either LBP_CP1 or LBP_CP2 as LBP_CP. Print either LBP_OP1 or LBP_OP2 as LBP_OP. (lbp_value_to_string): Handle LBP_CP1, LBP_CP2, LBP_OP1, LBP_OP2 instead of LBP_CP, LBP_OP. (output_lbrk_rules_as_tables): Treat LBP_CP and LBP_OP as macros that map to two table rows/columns. In rule LB30, use only LBP_OP1 instead of LBP_OP, and only LBP_CP1 instead of LBP_CP. Simplify rule LB22. * lib/unilbrk/lbrktables.h (LBP_CP1, LBP_CP2, LBP_OP1, LBP_OP2): New enum values. (LBP_OP, LBP_CP): Remove enum values. (unilbrk_table): Update declaration. * lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop): Add a test for East Asian opening parenthesis. * lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop): Likewise. * lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop): Likewise. * lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind): Update. (uc_width): Assign width 2 to the characters 0x16FF0..0x16FF1, 0x18AF3..0x18CD5, 0x18D00..0x18D08, 0x1F6D6..0x1F6D7, 0x1F6FB..0x1F6FC, 0x1F90C, 0x1FA74, 0x1FA83..0x1FA86, 0x1FA96..0x1FAA8, 0x1FAB0..0x1FAB6, 0x1FAC0..0x1FAC2, 0x1FAD0..0x1FAD6. Assign width 1 to the characters 0x1F93B, 0x1F946. * tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters 0x0B55, 0x0D81, 0x1ABF..0x1AC0, 0xA82C, 0x10EAB..0x10EAC, 0x111CF, 0x1193B..0x1193C, 0x1193E, 0x11943, 0x16FE4. Expect width 2 for the characters 0x16FF0..0x16FF1, 0x18AF3..0x18CD5, 0x18D00..0x18D08, 0x1F6D6..0x1F6D7, 0x1F6FB..0x1F6FC, 0x1F90C, 0x1FA74, 0x1FA83..0x1FA86, 0x1FA96..0x1FAA8, 0x1FAB0..0x1FAB6, 0x1FAC0..0x1FAC2, 0x1FAD0..0x1FAD6. Expect width 1 for the characters 0x1F93B, 0x1F946. * All generated files under lib/uni* and tests/uni*: Regenerate. * tests/uniname/NameAliases.txt: Update. * tests/uniname/UnicodeData.txt: Update. * tests/uninorm/NormalizationTest.txt: Update. * tests/unigbrk/GraphemeBreakTest.txt: Update. * tests/uniwbrk/WordBreakTest.txt: Update. * All the affected modules: Bump required libunistring version.
* uniwbrk: Correction of Unicode 10.0.0 support.Bruno Haible2021-12-301-2/+1
| | | | | * lib/gen-uni-tables.c (is_WBP_MIDLETTER): Remove character 0x02D7. The generated files are not affected.
* Update to Unicode 12.1.0.Bruno Haible2021-12-30175-83902/+83891
| | | | | | | | | | | | | * lib/gen-uni-tables.c: Update comments. * All generated files under lib/uni* and tests/uni*: Regenerate. * tests/uniname/NameAliases.txt: Update. * tests/uniname/UnicodeData.txt: Update. * tests/uninorm/NormalizationTest.txt: Update. * tests/unigbrk/GraphemeBreakTest.txt: Update. * tests/uniwbrk/WordBreakTest.txt: Update. * All the affected modules: Bump required libunistring version.
* Update to Unicode 12.0.0.Bruno Haible2021-12-30176-95674/+98607
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (is_property_default_ignorable_code_point): Exclude 0x13430..0x13438. (get_lbp): Update such that unilbrk/lbrkprop.txt comes out as expected. (get_wbp): Map 0xFF10..0xFF19 to WBP_NUMERIC. * lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind): Update. (uc_width): Assign width 2 to the characters 0x16FE2..0x16FE3, 0x187F2..0x187F7, 0x1B150..0x1B152, 0x1B164..0x1B167, 0x1F6D5, 0x1F6FA, 0x1F7E0..0x1F7EB, 0x1F90D..0x1F90F, 0x1FA70..0x1FA73, 0x1FA78..0x1FA7A, 0x1FA80..0x1FA82, 0x1FA90..0x1FA95. * tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters 0x0EBA, 0xA9BD, 0x119D4..0x119D7, 0x119DA..0x119DB, 0x119E0, 0x13430..0x13438, 0x16F4F, 0x1E130..0x1E136, 0x1E2EC..0x1E2EF. Expect width 2 for the characters 0x16FE2..0x16FE3, 0x187F2..0x187F7, 0x1B150..0x1B152, 0x1B164..0x1B167, 0x1F6D5, 0x1F6FA, 0x1F7E0..0x1F7EB, 0x1F90D..0x1F90F, 0x1FA70..0x1FA73, 0x1FA78..0x1FA7A, 0x1FA80..0x1FA82, 0x1FA90..0x1FA95. * All generated files under lib/uni* and tests/uni*: Regenerate. * tests/uniname/NameAliases.txt: Update. * tests/uniname/UnicodeData.txt: Update. * tests/uninorm/NormalizationTest.txt: Update. * tests/unigbrk/GraphemeBreakTest.txt: Update. * tests/uniwbrk/WordBreakTest.txt: Update. * All the affected modules: Bump required libunistring version.
* crypto/sm3-buffer: fix C99 conformance bugPaul Eggert2021-12-301-2/+2
| | | | | * lib/sm3.c (sm3_process_block): Call varargs macro with enough arguments. Problem found by IBM XL/C 12.1.0.0 for AIX.
* Update to Unicode 11.0.0.Bruno Haible2021-12-30195-96254/+99641
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (is_property_default_ignorable_code_point): Simplify by use of PROP_PREPENDED_CONCATENATION_MARK. (UC_JOINING_GROUP_HANIFI_ROHINGYA_PA, UC_JOINING_GROUP_HANIFI_ROHINGYA_KINNA_YA): New enum values. (fill_arabicshaping, joining_group_as_c_identifier): Recognize these joining groups. (get_lbp): Update such that unilbrk/lbrkprop.txt comes out as expected. (WBP_EB, WBP_EM, WBP_GAZ, WBP_EBG): Remove enum values. (WBP_WSS): New enum value. (get_wbp): Update such that uniwbrk/wbrkprop.txt comes out as expected. (debug_output_wbp, fill_org_wbp, debug_output_org_wbp, output_wbp): Update for changed enum values. * lib/unictype.in.h (UC_JOINING_GROUP_HANIFI_ROHINGYA_*): New enum values. * lib/unictype/joininggroup_name.h: Add the HANIFI_ROHINGYA_* joining groups. * lib/unictype/joininggroup_byname.gperf: Likewise. * lib/unigbrk.in.h: Mark 4 enum values as obsolete. * lib/unigbrk/u-grapheme-breaks.h (FUNC): Handle emoji modifier sequence according to Unicode 11.0.0. * lib/unigbrk/u8-grapheme-breaks.c: Include <stdbool.h>, unictype.h. * lib/unigbrk/u16-grapheme-breaks.c: Likewise. * lib/unigbrk/u32-grapheme-breaks.c: Likewise. * lib/unigbrk/uc-grapheme-breaks.c: Likewise. * modules/unigbrk/u8-grapheme-breaks (Depends-on): Add unictype/property-extended-pictographic, stdbool. * modules/unigbrk/u16-grapheme-breaks (Depends-on): Likewise. * modules/unigbrk/u32-grapheme-breaks (Depends-on): Likewise. * modules/unigbrk/uc-grapheme-breaks (Depends-on): Likewise. * tests/unigbrk/test-u8-grapheme-breaks.c (main): Add test for emoji modifier / ZWJ sequence. * tests/unigbrk/test-u16-grapheme-breaks.c (main): Likewise. * tests/unigbrk/test-u32-grapheme-breaks.c (main): Likewise. * tests/unigbrk/test-uc-is-grapheme-break.c: Include <stdbool.h>, unictype.h. (main): Update workaround logic to match the one in lib/unigbrk/u-grapheme-breaks.h. * modules/unigbrk/uc-is-grapheme-break-tests (Depends-on): Add unictype/property-extended-pictographic, stdbool. * lib/uniwbrk.in.h: Mark 4 enum values as obsolete. (WBP_WSS): New enum value. * lib/uniwbrk/u-wordbreaks.h (FUNC): Handle emoji ZWJ sequences and horizontal whitespace according to Unicode 11.0.0. * lib/uniwbrk/u8-wordbreaks.c: Include unictype.h. * lib/uniwbrk/u16-wordbreaks.c: Likewise. * lib/uniwbrk/u32-wordbreaks.c: Likewise. * lib/uniwbrk/wbrktable.c (uniwbrk_prop_index, uniwbrk_table): Add a row and column for WBP_WSS. * lib/uniwbrk/wbrktable.h (uniwbrk_prop_index, uniwbrk_table): Update declarations. * modules/uniwbrk/u8-wordbreaks (Depends-on): Add unictype/property-extended-pictographic. * modules/uniwbrk/u16-wordbreaks (Depends-on): Likewise. * modules/uniwbrk/u32-wordbreaks (Depends-on): Likewise. * tests/uniwbrk/test-u8-wordbreaks.c (main): Update expected results. * tests/uniwbrk/test-u16-wordbreaks.c (main): Likewise. * tests/uniwbrk/test-u32-wordbreaks.c (main): Likewise. * tests/uniwbrk/test-uc-wordbreaks.c (wordbreakproperty_to_string): Update. * lib/unilbrk/u8-possible-linebreaks.c (u8_possible_linebreaks_loop): Handle ZWJ according to Unicode 11.0.0. * lib/unilbrk/u16-possible-linebreaks.c (u16_possible_linebreaks_loop): Likewise. * lib/unilbrk/u32-possible-linebreaks.c (u32_possible_linebreaks_loop): Likewise. * lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind): Update. (uc_width): Assign width 2 to the characters 0x187ED..0x187F1, 0x1F6F9, 0x1F9E7..0x1F9FF. * tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters 0x07FD, 0x08D3, 0x09FE, 0x0C04, 0xA8FF, 0x10D24..0x10D27, 0x10F46..0x10F50, 0x110CD, 0x111C9, 0x1133B, 0x1145E, 0x1182F..0x11837, 0x11839..0x1183A, 0x11D90..0x11D91, 0x11D95, 0x11D97, 0x11EF3..0x11EF4. Expect width 2 for the characters 0x187ED..0x187F1, 0x1F6F9, 0x1F9E7..0x1F9FF. * All generated files under lib/uni* and tests/uni*: Regenerate. * tests/uniname/NameAliases.txt: Update. * tests/uniname/UnicodeData.txt: Update. * tests/uninorm/NormalizationTest.txt: Update. * tests/unigbrk/GraphemeBreakTest.txt: Update. * tests/uniwbrk/WordBreakTest.txt: Update. * All the affected modules: Bump required libunistring version.
* unictype: Add Emoji properties from Unicode 11.0.0.Bruno Haible2021-12-3014-18/+2425
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/gen-uni-tables.c (PROP_EMOJI*, PROP_EXTENDED_PICTOGRAPHIC): New enum values. (fill_properties): Don't require a space between the property name and the comment. Handle the property names from emoji-data.txt. (is_property_emoji, is_property_emoji_presentation, is_property_emoji_modifier, is_property_emoji_modifier_base, is_property_emoji_component, is_property_extended_pictographic): New declarations. (output_properties): Emit the properties emoji, emoji_presentation, emoji_modifier, emoji_modifier_base, emoji_component, extended_pictographic. (get_lbp): Use the emoji_modifier property. (main): Expect one more argument, for the emoji-data.txt file. * lib/unictype.in.h (UC_PROPERTY_EMOJI, UC_PROPERTY_EMOJI_PRESENTATION, UC_PROPERTY_EMOJI_MODIFIER, UC_PROPERTY_EMOJI_MODIFIER_BASE, UC_PROPERTY_EMOJI_COMPONENT, UC_PROPERTY_EXTENDED_PICTOGRAPHIC, uc_is_property_emoji, uc_is_property_emoji_presentation, uc_is_property_emoji_modifier, uc_is_property_emoji_modifier_base, uc_is_property_emoji_component, uc_is_property_extended_pictographic): New declarations. * lib/unictype/pr_emoji.c: New file. * lib/unictype/pr_emoji_presentation.c: New file. * lib/unictype/pr_emoji_modifier.c: New file. * lib/unictype/pr_emoji_modifier_base.c: New file. * lib/unictype/pr_emoji_component.c: New file. * lib/unictype/pr_extended_pictographic.c: New file. * modules/unictype/property-emoji: New file. * modules/unictype/property-emoji-tests: New file. * modules/unictype/property-emoji-presentation: New file. * modules/unictype/property-emoji-presentation-tests: New file. * modules/unictype/property-emoji-modifier: New file. * modules/unictype/property-emoji-modifier-tests: New file. * modules/unictype/property-emoji-modifier-base: New file. * modules/unictype/property-emoji-modifier-base-tests: New file. * modules/unictype/property-emoji-component: New file. * modules/unictype/property-emoji-component-tests: New file. * modules/unictype/property-extended-pictographic: New file. * modules/unictype/property-extended-pictographic-tests: New file. * modules/unictype/property-all (Depends-on): Depend on the new modules.
* uniwidth: Give width 0 to conjoining Hangul Jamo jungseong, jongseong.Bruno Haible2021-12-302-25/+65
| | | | | | | | | | | | Reported by Luis Javier Merino <ninjalj@gmail.com> in <https://lists.gnu.org/archive/html/bug-libunistring/2021-12/msg00006.html>. * lib/gen-uni-tables.c (is_nonspacing): Return true for the conjoining Hangul Jamo jungseong and jongseong characters. * lib/uniwidth/width.c (nonspacing_table_data, nonspacing_table_ind): Regenerated. * tests/uniwidth/test-uc_width2.sh: Expect width 0 for the characters 0x1160..0x11FF, 0xD7B0..0xD7C6, 0xD7CB..0xD7FB.
* uniwidth: Update to Unicode 10.0.0.Bruno Haible2021-12-291-4/+83
| | | | | | | | | | | | | | | | | | | * lib/uniwidth/width.c (uc_width): Assign width 2 to the characters 0x231A..0x231B, 0x23E9..0x23EC, 0x23F0, 0x23F3, 0x25FD..0x25FE, 0x2614..0x2615, 0x2648..0x2653, 0x267F, 0x2693, 0x26A1, 0x26AA..0x26AB, 0x26BD..0x26BE, 0x26C4..0x26C5, 0x26CE, 0x26D4, 0x26EA, 0x26F2..0x26F3, 0x26F5, 0x26FA, 0x26FD, 0x2705, 0x270A..0x270B, 0x2728, 0x274C, 0x274E, 0x2753..0x2755, 0x2757, 0x2795..0x2797, 0x27B0, 0x27BF, 0x2B1B..0x2B1C, 0x2B50, 0x2B55, 0xA960..0xA97C, 0x16FE0..0x16FE1, 0x17000..0x187EC, 0x18800..0x18AF2, 0x1B000..0x1B11F, 0x1B170..0x1B2FB, 0x1F004, 0x1F0CF, 0x1F18E, 0x1F191..0x1F19A, 0x1F200..0x1F320, 0x1F32D..0x1F335, 0x1F337..0x1F37C, 0x1F37E..0x1F393, 0x1F3A0..0x1F3CA, 0x1F3CF..0x1F3D3, 0x1F3E0..0x1F3F0, 0x1F3F4, 0x1F3F8..0x1F43E, 0x1F440, 0x1F442..0x1F4FC, 0x1F4FF..0x1F53D, 0x1F54B..0x1F54E, 0x1F550..0x1F567, 0x1F57A, 0x1F595..0x1F596, 0x1F5A4, 0x1F5FB..0x1F64F, 0x1F680..0x1F6C5, 0x1F6CC, 0x1F6D0..0x1F6D2, 0x1F6EB..0x1F6EC, 0x1F6F4..0x1F6F8, 0x1F910..0x1F9E6. Assign ambiguous width to the characters 0x3248..0x324F. * tests/uniwidth/test-uc_width2.sh: Expect these changes.