public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* When displaying Chinese help information, the program does not respond. The code enters a dead loop.
@ 2024-03-28 15:23 =?gb18030?B?1dTOsA==?=
  0 siblings, 0 replies; 2+ messages in thread
From: =?gb18030?B?1dTOsA==?= @ 2024-03-28 15:23 UTC (permalink / raw)
  To: =?gb18030?B?Y3lnd2luQGN5Z3dpbi5jb20=?=

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="gb18030", Size: 1191 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 {
        {
          // TODO: consider using a line breaking strategy here.
          int pos = helpmsg.substr(0,h_len).find_last_of(" ");
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(pos<=0)break;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; theStream << helpmsg.substr(0,pos)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; << std::endl << std::string (o_len, ' ');
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; helpmsg.erase (0,pos+1);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* When displaying Chinese help information, the program does not respond. The code enters a dead loop.
@ 2024-03-28 15:26 =?gb18030?B?1dTOsA==?=
  0 siblings, 0 replies; 2+ messages in thread
From: =?gb18030?B?1dTOsA==?= @ 2024-03-28 15:26 UTC (permalink / raw)
  To: =?gb18030?B?Y3lnd2luQGN5Z3dpbi5jb20=?=

[-- 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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-28 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28 15:23 When displaying Chinese help information, the program does not respond. The code enters a dead loop =?gb18030?B?1dTOsA==?=
2024-03-28 15:26 =?gb18030?B?1dTOsA==?=

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).