Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit a30b79a2 authored by Spencer Low's avatar Spencer Low
Browse files

adb: win32: handle incomplete UTF-8 in console output, other fixes



Previously, the various adb_printf, adb_fwrite, etc. functions did not
correctly handle the case of the passed buffer ending with an incomplete
UTF-8 sequence. This is fixed by buffering up incomplete UTF-8 sequences
in g_console_output_buffer (protected by the mutex
g_console_output_buffer) and outputting it later once the full sequence
is available.

A unittest for the main worker function, ParseCompleteUTF8(), was added
to adb_test.

Other fixes:

- Fix the return value of number-of-chars written to be number of UTF-8
  bytes instead of number of UTF-16 characters.

- Don't overwrite errno in success cases of various adb_printf, etc.
  functions. This might be excessive, but might be useful in the case
  when these functions are used for debugging/tracing.

- Add missing UTF-8 stdio functions that aren't currently used by adb,
  but might be in the future: vprintf, putc, putchar, puts.

- stdin_raw_init: If we can't get the console handle, don't call
  SetConsoleMode(). Not a big deal, but this will prevent erroneous
  trace output.

Change-Id: I8730e8af92882c42b884ad921b39a17b54465085
Signed-off-by: default avatarSpencer Low <CompareAndSwap@gmail.com>
parent 53529eca
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment