summaryrefslogtreecommitdiff
path: root/lib/unilbrk/u32-width-linebreaks.c
diff options
context:
space:
mode:
authorAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
committerAndreas Rottmann <a.rottmann@gmx.at>2010-05-27 18:23:17 +0200
commitbd6adfa17d453e4c486e36fed4c5779db90a8a0e (patch)
tree9798677560d5f99061afe9f0db105a8c97f2438a /lib/unilbrk/u32-width-linebreaks.c
parent79ca645d222db2e158784642c3b464a47bea26f3 (diff)
parent3e0814cd9862b89c7a39672672937477bd87ddfb (diff)
Merge commit 'upstream/0.9.3'
Diffstat (limited to 'lib/unilbrk/u32-width-linebreaks.c')
-rw-r--r--lib/unilbrk/u32-width-linebreaks.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/lib/unilbrk/u32-width-linebreaks.c b/lib/unilbrk/u32-width-linebreaks.c
index 2d36256..c5803db 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-2008 Free Software Foundation, Inc.
+ Copyright (C) 2001-2003, 2006-2010 Free Software Foundation, Inc.
Written by Bruno Haible <bruno@clisp.org>, 2001.
This program is free software: you can redistribute it and/or modify it
@@ -24,9 +24,9 @@
int
u32_width_linebreaks (const uint32_t *s, size_t n,
- int width, int start_column, int at_end_columns,
- const char *o, const char *encoding,
- char *p)
+ int width, int start_column, int at_end_columns,
+ const char *o, const char *encoding,
+ char *p)
{
const uint32_t *s_end;
char *last_p;
@@ -45,53 +45,53 @@ u32_width_linebreaks (const uint32_t *s, size_t n,
/* Respect the override. */
if (o != NULL && *o != UC_BREAK_UNDEFINED)
- *p = *o;
+ *p = *o;
if (*p == UC_BREAK_POSSIBLE || *p == UC_BREAK_MANDATORY)
- {
- /* An atomic piece of text ends here. */
- if (last_p != NULL && last_column + piece_width > width)
- {
- /* Insert a line break. */
- *last_p = UC_BREAK_POSSIBLE;
- last_column = 0;
- }
- }
+ {
+ /* An atomic piece of text ends here. */
+ if (last_p != NULL && last_column + piece_width > width)
+ {
+ /* Insert a line break. */
+ *last_p = UC_BREAK_POSSIBLE;
+ last_column = 0;
+ }
+ }
if (*p == UC_BREAK_MANDATORY)
- {
- /* uc is a line break character. */
- /* Start a new piece at column 0. */
- last_p = NULL;
- last_column = 0;
- piece_width = 0;
- }
+ {
+ /* uc is a line break character. */
+ /* Start a new piece at column 0. */
+ last_p = NULL;
+ last_column = 0;
+ piece_width = 0;
+ }
else
- {
- /* uc is not a line break character. */
- int w;
-
- if (*p == UC_BREAK_POSSIBLE)
- {
- /* Start a new piece. */
- last_p = p;
- last_column += piece_width;
- piece_width = 0;
- /* No line break for the moment, may be turned into
- UC_BREAK_POSSIBLE later, via last_p. */
- }
-
- *p = UC_BREAK_PROHIBITED;
-
- w = uc_width (uc, encoding);
- if (w >= 0) /* ignore control characters in the string */
- piece_width += w;
- }
+ {
+ /* uc is not a line break character. */
+ int w;
+
+ if (*p == UC_BREAK_POSSIBLE)
+ {
+ /* Start a new piece. */
+ last_p = p;
+ last_column += piece_width;
+ piece_width = 0;
+ /* No line break for the moment, may be turned into
+ UC_BREAK_POSSIBLE later, via last_p. */
+ }
+
+ *p = UC_BREAK_PROHIBITED;
+
+ w = uc_width (uc, encoding);
+ if (w >= 0) /* ignore control characters in the string */
+ piece_width += w;
+ }
s++;
p++;
if (o != NULL)
- o++;
+ o++;
}
/* The last atomic piece of text ends here. */