diff options
author | David Herrmann <dh.herrmann@gmail.com> | 2014-10-02 16:36:09 +0200 |
---|---|---|
committer | David Herrmann <dh.herrmann@gmail.com> | 2014-10-03 15:57:00 +0200 |
commit | f1f5b2a3bdc3178d57c4088a7cd7758afaeba9cb (patch) | |
tree | e173b2fadb2df9c814fe9a3185e9fb90be30f64f /src/libsystemd-terminal/term-screen.c | |
parent | db1a606610e5a528903a4380f30c9934a0c5a134 (diff) |
terminal: make utf8 decoder return length
Lets return the parsed length in term_utf8_decode() instead of a buffer
pointer. Store the pointer in the passed argument.
This makes it adhere to the systemd coding-style, were we always avoid
returning pointers, but store them in output arguments. In this case, the
storage is not allocated, so it doesn't fit 100% to this idiom, but still
looks much nicer.
Diffstat (limited to 'src/libsystemd-terminal/term-screen.c')
-rw-r--r-- | src/libsystemd-terminal/term-screen.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsystemd-terminal/term-screen.c b/src/libsystemd-terminal/term-screen.c index 14c32aceb9..2f3f6f91cb 100644 --- a/src/libsystemd-terminal/term-screen.c +++ b/src/libsystemd-terminal/term-screen.c @@ -3756,7 +3756,7 @@ unsigned int term_screen_get_height(term_screen *screen) { } int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size) { - const uint32_t *ucs4_str; + uint32_t *ucs4_str; size_t i, j, ucs4_len; const term_seq *seq; int r; @@ -3768,7 +3768,7 @@ int term_screen_feed_text(term_screen *screen, const uint8_t *in, size_t size) { * 8bit mode if the stream is not valid UTF-8. This should be more than * enough to support old 7bit/8bit modes. */ for (i = 0; i < size; ++i) { - ucs4_str = term_utf8_decode(&screen->utf8, &ucs4_len, in[i]); + ucs4_len = term_utf8_decode(&screen->utf8, &ucs4_str, in[i]); for (j = 0; j < ucs4_len; ++j) { r = term_parser_feed(screen->parser, &seq, ucs4_str[j]); if (r < 0) { |