From: Karsten Blees <karsten.blees@gmail.com>
To: Peter Krefting <peter@softwolves.pp.se>, Stepan Kasal <kasal@ucw.cz>
Cc: GIT Mailing-list <git@vger.kernel.org>,
msysGit <msysgit@googlegroups.com>,
Karsten Blees <blees@dcon.de>
Subject: Re: [PATCH 5/5] Win32: Thread-safe windows console output
Date: Sat, 07 Jun 2014 00:03:52 +0200 [thread overview]
Message-ID: <53923AC8.2030309@gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1406062224530.17391@ds9.cixit.se>
Am 06.06.2014 23:29, schrieb Peter Krefting:
> 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.
next prev parent reply other threads:[~2014-06-06 22:03 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 13:42 [PATCH 0/5] First part of Unicode console support for msysgit Stepan Kasal
2014-06-06 13:42 ` [PATCH 1/5] Support Unicode console output on Windows Stepan Kasal
2014-06-06 13:42 ` [PATCH 2/5] Detect console streams more reliably " Stepan Kasal
2014-06-06 13:42 ` [PATCH 3/5] Warn if the Windows console font doesn't support Unicode Stepan Kasal
2014-06-06 21:18 ` Peter Krefting
2014-06-07 7:02 ` Stepan Kasal
2014-06-06 13:42 ` [PATCH 4/5] Win32: move main macro to a function Stepan Kasal
2014-06-06 13:42 ` [PATCH 5/5] Win32: Thread-safe windows console output Stepan Kasal
2014-06-06 21:29 ` Peter Krefting
2014-06-06 22:03 ` Karsten Blees [this message]
2014-06-06 17:44 ` [PATCH 0/5] First part of Unicode console support for msysgit Karsten Blees
2014-06-06 18:39 ` Stepan Kasal
2014-06-07 7:57 ` [PATCH v2 0/6] " Stepan Kasal
2014-06-07 7:57 ` [PATCH v2 1/6] Support Unicode console output on Windows Stepan Kasal
2014-06-07 7:57 ` [PATCH v2 2/6] Detect console streams more reliably " Stepan Kasal
2014-06-07 7:57 ` [PATCH v2 3/6] Warn if the Windows console font doesn't support Unicode Stepan Kasal
2014-06-07 7:57 ` [PATCH v2 4/6] Win32: add Unicode conversion functions Stepan Kasal
2014-06-07 7:57 ` [PATCH v2 5/6] Win32: Thread-safe windows console output Stepan Kasal
2014-06-13 6:10 ` Johannes Sixt
2014-06-13 22:09 ` [PATCH 7/6] Win32: reliably detect console pipe handles Karsten Blees
2014-06-07 7:57 ` [PATCH v2 6/6] Win32: fix broken pipe detection Stepan Kasal
2014-06-06 20:48 ` Re: [PATCH 0/5] First part of Unicode console support for msysgit Stepan Kasal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53923AC8.2030309@gmail.com \
--to=karsten.blees@gmail.com \
--cc=blees@dcon.de \
--cc=git@vger.kernel.org \
--cc=kasal@ucw.cz \
--cc=msysgit@googlegroups.com \
--cc=peter@softwolves.pp.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.