git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 5/5] Win32: Thread-safe windows console output

From
Karsten Blees <karsten.blees@gmail.com>
Date
Jun 6, 2014, 22:03 UTC
Message-ID
<53923AC8.2030309@gmail.com>
In-Reply-To
<alpine.DEB.2.00.1406062224530.17391@ds9.cixit.se>
Am 06.06.2014 23:29, schrieb Peter Krefting:
Show 7 quoted lines
> Stepan Kasal:
> 
>> +    /* only called from console_thread, so a static buffer will do */
>> +    static wchar_t wbuf[2 * BUFFER_SIZE + 1];
> 
> Wouldn't BUFFER_SIZE + 1 (or even BUFFER_SIZE) do here? If you convert from up to BUFFER_SIZE octets of UTF-8 input, you should never get back more than BUFFER_SIZE code units of UTF-16 output. Worst case would be ASCII, which is one UTF-16 code unit per UTF-8 octet, everything else is less (non-BMP is four UTF-8 octets mapping to two UTF-16 code units).
> 
You're right for MultiByteToWideChar. However, the next patch series will introduce another conversion function that converts invalid UTF-8 to hex code, i.e. two wide chars per invalid UTF-8 char, +1 for L'\0' (see [1] mingw.h:365ff for space requirement rationale). And yet another patch will replace this patch's MultiByteToWideChar for consistentcy [2].

[1] https://github.com/msysgit/git/commit/018c94a8 [2] https://github.com/msysgit/git/commit/45e28a4d

-- 
-- 
*** Please reply-to-all at all times ***
*** (do not pretend to know who is subscribed and who is not) ***
*** Please avoid top-posting. ***
The msysGit Wiki is here: https://github.com/msysgit/msysgit/wiki - Github accounts are free.

You received this message because you are subscribed to the Google
Groups "msysGit" group.
To post to this group, send email to msysgit@googlegroups.com
To unsubscribe from this group, send email to
msysgit+unsubscribe@googlegroups.com
For more options, and view previous threads, visit this group at
http://groups.google.com/group/msysgit?hl=en_US?hl=en

--- 
You received this message because you are subscribed to the Google Groups "msysGit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to msysgit+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Previous: Peter KreftingNext: Karsten Blees
Message 10 of 22 in “First part of Unicode console support for msysgit”
  1. 0/5 First part of Unicode console support for msysgitStepan Kasal, Jun 6, 2014
  2. 1/5 Support Unicode console output on WindowsStepan Kasal, Jun 6, 2014
  3. 2/5 Detect console streams more reliably on WindowsStepan Kasal, Jun 6, 2014
  4. 3/5 Warn if the Windows console font doesn't support UnicodeStepan Kasal, Jun 6, 2014
  5. Peter KreftingJun 6, 2014
  6. Stepan KasalJun 7, 2014
  7. 4/5 Win32: move main macro to a functionStepan Kasal, Jun 6, 2014
  8. 5/5 Win32: Thread-safe windows console outputStepan Kasal, Jun 6, 2014
  9. Peter KreftingJun 6, 2014
  10. Karsten BleesJun 6, 2014
  11. Karsten BleesJun 6, 2014
  12. Stepan KasalJun 6, 2014
  13. 0/6 First part of Unicode console support for msysgitStepan Kasal, Jun 7, 2014
  14. 1/6 Support Unicode console output on WindowsStepan Kasal, Jun 7, 2014
  15. 2/6 Detect console streams more reliably on WindowsStepan Kasal, Jun 7, 2014
  16. 3/6 Warn if the Windows console font doesn't support UnicodeStepan Kasal, Jun 7, 2014
  17. 4/6 Win32: add Unicode conversion functionsStepan Kasal, Jun 7, 2014
  18. 5/6 Win32: Thread-safe windows console outputStepan Kasal, Jun 7, 2014
  19. Johannes SixtJun 13, 2014
  20. 7/6 Win32: reliably detect console pipe handlesKarsten Blees, Jun 13, 2014
  21. 6/6 Win32: fix broken pipe detectionStepan Kasal, Jun 7, 2014
  22. Stepan KasalJun 6, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.