mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 19:41:01 -05:00
Make encode_utf8() output to a BinarySink.
Previously it output to an ordinary char buffer, and returned the number of bytes it had written. But three out of the four call sites immediately chucked the resulting bytes into a BinarySink anyway. The fourth, in windows/unicode.c, really is writing into successive locations of a fixed-size buffer - but we can make that into a BinarySink too, using the buffer_sink added in the previous commit. So now encode_utf8() is renamed put_utf8_char, and the call sites all look simpler than they started out.
This commit is contained in:
@ -156,6 +156,10 @@ struct BinarySink {
|
||||
#define put_c_string_literal(bs, str) \
|
||||
BinarySink_put_c_string_literal(BinarySink_UPCAST(bs), str)
|
||||
|
||||
/* More complicated function implemented in encode_utf8.c */
|
||||
#define put_utf8_char(bs, c) \
|
||||
BinarySink_put_utf8_char(BinarySink_UPCAST(bs), c)
|
||||
|
||||
/*
|
||||
* The underlying real C functions that implement most of those
|
||||
* macros. Generally you won't want to call these directly, because
|
||||
@ -185,6 +189,7 @@ void BinarySink_put_mp_ssh2(BinarySink *bs, mp_int *x);
|
||||
void BinarySink_put_fmt(BinarySink *, const char *fmt, ...) PRINTF_LIKE(2, 3);
|
||||
void BinarySink_put_fmtv(BinarySink *, const char *fmt, va_list ap);
|
||||
void BinarySink_put_c_string_literal(BinarySink *, ptrlen);
|
||||
void BinarySink_put_utf8_char(BinarySink *, unsigned);
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
|
Reference in New Issue
Block a user