public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: =?gb18030?B?1dTOsA==?= <qdzhaov@qq.com>
To: =?gb18030?B?Y3lnd2luQGN5Z3dpbi5jb20=?= <cygwin@cygwin.com>
Subject: When displaying Chinese help information, the program does not respond. The code enters a dead loop.
Date: Thu, 28 Mar 2024 23:26:20 +0800	[thread overview]
Message-ID: <tencent_1D4A1965D169D6E2B9F6CA21B7160E3A8C09@qq.com> (raw)

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 1159 bytes --]

When displaying Chinese help information, the program does not respond. 
The code enters a dead loop in file "libgetopt++/include/getopt++/DefaultFormatter.h"£¬Because some Chinese help information does not contain spaces.
diff --git a/libgetopt++/include/getopt++/DefaultFormatter.h b/libgetopt++/include/getopt++/DefaultFormatter.h
index ee2397f5..19ac67e1 100644
--- a/libgetopt++/include/getopt++/DefaultFormatter.h
+++ b/libgetopt++/include/getopt++/DefaultFormatter.h
@@ -64,6 +64,7 @@ class DefaultFormatter {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; // TODO: consider using a line breaking strategy here.
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; int pos = helpmsg.substr(0,h_len).find_last_of(" ");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; if(pos&lt;=0)break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; theStream &lt;&lt; helpmsg.substr(0,pos)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &lt;&lt; std::endl &lt;&lt; std::string (o_len, ' ');
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; helpmsg.erase (0,pos+1);

             reply	other threads:[~2024-03-28 15:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28 15:26 =?gb18030?B?1dTOsA==?= [this message]
2024-03-29  4:01 ` When displaying Chinese help information in Cygwin setup, " Brian Inglis
  -- strict thread matches above, loose matches on Subject: below --
2024-03-28 15:23 When displaying Chinese help information, " =?gb18030?B?1dTOsA==?=

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=tencent_1D4A1965D169D6E2B9F6CA21B7160E3A8C09@qq.com \
    --to=qdzhaov@qq.com \
    --cc=cygwin@cygwin.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).