diff options
| author | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
|---|---|---|
| committer | Jörg Frings-Fürst <debian@jff.email> | 2026-03-08 17:28:33 +0100 |
| commit | 5f59a34ab747dde8ede7357f3431bf06bd6002fe (patch) | |
| tree | 056a4477fd870d454d5be5868cddab829a47f4d2 /lib/unilbrk | |
| parent | 27dae84ed92f1ef0300263091972338d12e78348 (diff) | |
New upstream version 1.4.2upstream/1.4.2upstream
Diffstat (limited to 'lib/unilbrk')
| -rw-r--r-- | lib/unilbrk/internal.h | 2 | ||||
| -rw-r--r-- | lib/unilbrk/lbrktables.h | 2 | ||||
| -rw-r--r-- | lib/unilbrk/u16-possible-linebreaks.c | 2 | ||||
| -rw-r--r-- | lib/unilbrk/u16-width-linebreaks.c | 19 | ||||
| -rw-r--r-- | lib/unilbrk/u32-possible-linebreaks.c | 2 | ||||
| -rw-r--r-- | lib/unilbrk/u32-width-linebreaks.c | 19 | ||||
| -rw-r--r-- | lib/unilbrk/u8-possible-linebreaks.c | 8 | ||||
| -rw-r--r-- | lib/unilbrk/u8-width-linebreaks.c | 25 | ||||
| -rw-r--r-- | lib/unilbrk/ulc-common.c | 2 | ||||
| -rw-r--r-- | lib/unilbrk/ulc-common.h | 2 | ||||
| -rw-r--r-- | lib/unilbrk/ulc-possible-linebreaks.c | 19 | ||||
| -rw-r--r-- | lib/unilbrk/ulc-width-linebreaks.c | 23 |
12 files changed, 45 insertions, 80 deletions
diff --git a/lib/unilbrk/internal.h b/lib/unilbrk/internal.h index 8a7e4300..be059b5d 100644 --- a/lib/unilbrk/internal.h +++ b/lib/unilbrk/internal.h @@ -1,5 +1,5 @@ /* Internal functions for line breaking of Unicode strings. - Copyright (C) 2001-2003, 2005-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2005-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2021. This file is free software. diff --git a/lib/unilbrk/lbrktables.h b/lib/unilbrk/lbrktables.h index ea2114c5..27d17926 100644 --- a/lib/unilbrk/lbrktables.h +++ b/lib/unilbrk/lbrktables.h @@ -1,5 +1,5 @@ /* Line breaking auxiliary tables. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. diff --git a/lib/unilbrk/u16-possible-linebreaks.c b/lib/unilbrk/u16-possible-linebreaks.c index d313d942..c85cc374 100644 --- a/lib/unilbrk/u16-possible-linebreaks.c +++ b/lib/unilbrk/u16-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-16 strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. diff --git a/lib/unilbrk/u16-width-linebreaks.c b/lib/unilbrk/u16-width-linebreaks.c index 70c31ace..0af01e25 100644 --- a/lib/unilbrk/u16-width-linebreaks.c +++ b/lib/unilbrk/u16-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-16 strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. @@ -39,17 +39,12 @@ u16_width_linebreaks_internal (const uint16_t *s, size_t n, const char *o, const char *encoding, int cr, char *p) { - const uint16_t *s_end; - char *last_p; - int last_column; - int piece_width; - u16_possible_linebreaks_loop (s, n, encoding, cr, p); - s_end = s + n; - last_p = NULL; - last_column = start_column; - piece_width = 0; + const uint16_t *s_end = s + n; + char *last_p = NULL; + int last_column = start_column; + int piece_width = 0; while (s < s_end) { ucs4_t uc; @@ -82,8 +77,6 @@ u16_width_linebreaks_internal (const uint16_t *s, size_t n, else { /* uc is not a line break character. */ - int w; - if (*p == UC_BREAK_POSSIBLE) { /* Start a new piece. */ @@ -96,7 +89,7 @@ u16_width_linebreaks_internal (const uint16_t *s, size_t n, *p = UC_BREAK_PROHIBITED; - w = uc_width (uc, encoding); + int w = uc_width (uc, encoding); if (w >= 0) /* ignore control characters in the string */ piece_width += w; } diff --git a/lib/unilbrk/u32-possible-linebreaks.c b/lib/unilbrk/u32-possible-linebreaks.c index f953be75..33f84378 100644 --- a/lib/unilbrk/u32-possible-linebreaks.c +++ b/lib/unilbrk/u32-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-32 strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. diff --git a/lib/unilbrk/u32-width-linebreaks.c b/lib/unilbrk/u32-width-linebreaks.c index 5fa73639..4a4f84b5 100644 --- a/lib/unilbrk/u32-width-linebreaks.c +++ b/lib/unilbrk/u32-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-32 strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. @@ -38,17 +38,12 @@ u32_width_linebreaks_internal (const uint32_t *s, size_t n, const char *o, const char *encoding, int cr, char *p) { - const uint32_t *s_end; - char *last_p; - int last_column; - int piece_width; - u32_possible_linebreaks_loop (s, n, encoding, cr, p); - s_end = s + n; - last_p = NULL; - last_column = start_column; - piece_width = 0; + const uint32_t *s_end = s + n; + char *last_p = NULL; + int last_column = start_column; + int piece_width = 0; while (s < s_end) { ucs4_t uc = *s; @@ -80,8 +75,6 @@ u32_width_linebreaks_internal (const uint32_t *s, size_t n, else { /* uc is not a line break character. */ - int w; - if (*p == UC_BREAK_POSSIBLE) { /* Start a new piece. */ @@ -94,7 +87,7 @@ u32_width_linebreaks_internal (const uint32_t *s, size_t n, *p = UC_BREAK_PROHIBITED; - w = uc_width (uc, encoding); + int w = uc_width (uc, encoding); if (w >= 0) /* ignore control characters in the string */ piece_width += w; } diff --git a/lib/unilbrk/u8-possible-linebreaks.c b/lib/unilbrk/u8-possible-linebreaks.c index bc4796f4..86a8e941 100644 --- a/lib/unilbrk/u8-possible-linebreaks.c +++ b/lib/unilbrk/u8-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-8 strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. @@ -457,7 +457,6 @@ read_file (FILE *stream) char *buf = NULL; int alloc = 0; int size = 0; - int count; while (! feof (stream)) { @@ -473,7 +472,7 @@ read_file (FILE *stream) exit (1); } } - count = fread (buf + size, 1, BUFSIZE, stream); + int count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) { if (ferror (stream)) @@ -505,11 +504,10 @@ main (int argc, char * argv[]) char *input = read_file (stdin); int length = strlen (input); char *breaks = malloc (length); - int i; u8_possible_linebreaks_v2 ((uint8_t *) input, length, "UTF-8", breaks); - for (i = 0; i < length; i++) + for (int i = 0; i < length; i++) { switch (breaks[i]) { diff --git a/lib/unilbrk/u8-width-linebreaks.c b/lib/unilbrk/u8-width-linebreaks.c index 0cb18ba0..28190645 100644 --- a/lib/unilbrk/u8-width-linebreaks.c +++ b/lib/unilbrk/u8-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of UTF-8 strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. @@ -39,17 +39,12 @@ u8_width_linebreaks_internal (const uint8_t *s, size_t n, const char *o, const char *encoding, int cr, char *p) { - const uint8_t *s_end; - char *last_p; - int last_column; - int piece_width; - u8_possible_linebreaks_loop (s, n, encoding, cr, p); - s_end = s + n; - last_p = NULL; - last_column = start_column; - piece_width = 0; + const uint8_t *s_end = s + n; + char *last_p = NULL; + int last_column = start_column; + int piece_width = 0; while (s < s_end) { ucs4_t uc; @@ -82,8 +77,6 @@ u8_width_linebreaks_internal (const uint8_t *s, size_t n, else { /* uc is not a line break character. */ - int w; - if (*p == UC_BREAK_POSSIBLE) { /* Start a new piece. */ @@ -96,7 +89,7 @@ u8_width_linebreaks_internal (const uint8_t *s, size_t n, *p = UC_BREAK_PROHIBITED; - w = uc_width (uc, encoding); + int w = uc_width (uc, encoding); if (w >= 0) /* ignore control characters in the string */ piece_width += w; } @@ -163,7 +156,6 @@ read_file (FILE *stream) char *buf = NULL; int alloc = 0; int size = 0; - int count; while (! feof (stream)) { @@ -179,7 +171,7 @@ read_file (FILE *stream) exit (1); } } - count = fread (buf + size, 1, BUFSIZE, stream); + int count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) { if (ferror (stream)) @@ -212,11 +204,10 @@ main (int argc, char * argv[]) char *input = read_file (stdin); int length = strlen (input); char *breaks = malloc (length); - int i; u8_width_linebreaks_v2 ((uint8_t *) input, length, width, 0, 0, NULL, "UTF-8", breaks); - for (i = 0; i < length; i++) + for (int i = 0; i < length; i++) { switch (breaks[i]) { diff --git a/lib/unilbrk/ulc-common.c b/lib/unilbrk/ulc-common.c index c9c97da2..979fc335 100644 --- a/lib/unilbrk/ulc-common.c +++ b/lib/unilbrk/ulc-common.c @@ -1,5 +1,5 @@ /* Line breaking auxiliary functions. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. diff --git a/lib/unilbrk/ulc-common.h b/lib/unilbrk/ulc-common.h index 8df4eff8..21ad8e1b 100644 --- a/lib/unilbrk/ulc-common.h +++ b/lib/unilbrk/ulc-common.h @@ -1,5 +1,5 @@ /* Line breaking auxiliary functions. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. diff --git a/lib/unilbrk/ulc-possible-linebreaks.c b/lib/unilbrk/ulc-possible-linebreaks.c index 0dc1ff41..1e112b4b 100644 --- a/lib/unilbrk/ulc-possible-linebreaks.c +++ b/lib/unilbrk/ulc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. @@ -66,26 +66,23 @@ ulc_possible_linebreaks_internal (const char *s, size_t n, const char *encoding, if (offsets != NULL) { - uint8_t *t; size_t m; - - t = u8_conv_from_encoding (encoding, iconveh_question_mark, - s, n, offsets, NULL, &m); + uint8_t *t = + u8_conv_from_encoding (encoding, iconveh_question_mark, + s, n, offsets, NULL, &m); if (t != NULL) { char *q = (char *) (m > 0 ? malloc (m) : NULL); if (m == 0 || q != NULL) { - size_t i; - /* Determine the possible line breaks of the UTF-8 string. */ u8_possible_linebreaks_loop (t, m, encoding, cr, q); /* Translate the result back to the original string. */ memset (p, UC_BREAK_PROHIBITED, n); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) if (offsets[i] != (size_t)(-1)) p[i] = q[offsets[i]]; @@ -169,7 +166,6 @@ read_file (FILE *stream) char *buf = NULL; int alloc = 0; int size = 0; - int count; while (! feof (stream)) { @@ -185,7 +181,7 @@ read_file (FILE *stream) exit (1); } } - count = fread (buf + size, 1, BUFSIZE, stream); + int count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) { if (ferror (stream)) @@ -218,11 +214,10 @@ main (int argc, char * argv[]) char *input = read_file (stdin); int length = strlen (input); char *breaks = malloc (length); - int i; ulc_possible_linebreaks_v2 (input, length, locale_charset (), breaks); - for (i = 0; i < length; i++) + for (int i = 0; i < length; i++) { switch (breaks[i]) { diff --git a/lib/unilbrk/ulc-width-linebreaks.c b/lib/unilbrk/ulc-width-linebreaks.c index ee3a394a..3ce412e8 100644 --- a/lib/unilbrk/ulc-width-linebreaks.c +++ b/lib/unilbrk/ulc-width-linebreaks.c @@ -1,5 +1,5 @@ /* Line breaking of strings. - Copyright (C) 2001-2003, 2006-2025 Free Software Foundation, Inc. + Copyright (C) 2001-2003, 2006-2026 Free Software Foundation, Inc. Written by Bruno Haible <bruno@clisp.org>, 2001. This file is free software. @@ -68,11 +68,10 @@ ulc_width_linebreaks_internal (const char *s, size_t n, if (offsets != NULL) { - uint8_t *t; size_t m; - - t = u8_conv_from_encoding (encoding, iconveh_question_mark, - s, n, offsets, NULL, &m); + uint8_t *t = + u8_conv_from_encoding (encoding, iconveh_question_mark, + s, n, offsets, NULL, &m); if (t != NULL) { char *memory = @@ -82,25 +81,23 @@ ulc_width_linebreaks_internal (const char *s, size_t n, { char *q = (char *) memory; char *o8 = (o != NULL ? (char *) (q + m) : NULL); - int res_column; - size_t i; /* Translate the overrides to the UTF-8 string. */ if (o != NULL) { memset (o8, UC_BREAK_UNDEFINED, m); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) if (offsets[i] != (size_t)(-1)) o8[offsets[i]] = o[i]; } /* Determine the line breaks of the UTF-8 string. */ - res_column = + int res_column = u8_width_linebreaks_internal (t, m, width, start_column, at_end_columns, o8, encoding, cr, q); /* Translate the result back to the original string. */ memset (p, UC_BREAK_PROHIBITED, n); - for (i = 0; i < n; i++) + for (size_t i = 0; i < n; i++) if (offsets[i] != (size_t)(-1)) p[i] = q[offsets[i]]; @@ -195,7 +192,6 @@ read_file (FILE *stream) char *buf = NULL; int alloc = 0; int size = 0; - int count; while (! feof (stream)) { @@ -211,7 +207,7 @@ read_file (FILE *stream) exit (1); } } - count = fread (buf + size, 1, BUFSIZE, stream); + int count = fread (buf + size, 1, BUFSIZE, stream); if (count == 0) { if (ferror (stream)) @@ -245,11 +241,10 @@ main (int argc, char * argv[]) char *input = read_file (stdin); int length = strlen (input); char *breaks = malloc (length); - int i; ulc_width_linebreaks_v2 (input, length, width, 0, 0, NULL, locale_charset (), breaks); - for (i = 0; i < length; i++) + for (int i = 0; i < length; i++) { switch (breaks[i]) { |
