* PATCH: result of warnings from Cygwin
@ 2006-08-04 13:34 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2006-08-04 13:34 UTC (permalink / raw)
To: Zsh hackers list
I wasn't going to post this, but it occurs to me people may have
comments about better ways to do some of these to avoid warnings.
One of them is actually a bug---it's wrong to test a wchar_t (rather
than a wint_t) against WEOF even if it happens to work on some systems.
zsh now compiles by default with MULTIBYTE_SUPPORT on Cygwin, but
I haven't the first clue how to get a command line window with a
sensible character set (i.e. UTF-8).
Index: Src/parse.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/parse.c,v
retrieving revision 1.58
diff -u -r1.58 parse.c
--- Src/parse.c 11 Jul 2006 15:36:37 -0000 1.58
+++ Src/parse.c 4 Aug 2006 13:13:04 -0000
@@ -2966,17 +2966,23 @@
return 0;
}
+/**/
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
#include <sys/mman.h>
+/**/
#if defined(MAP_SHARED) && defined(PROT_READ)
+/**/
#define USE_MMAP 1
+/**/
#endif
+/**/
#endif
+/**/
#ifdef USE_MMAP
/* List of dump files mapped. */
@@ -3060,6 +3066,7 @@
#define zwcstat(f, b) (!!stat(f, b))
+/**/
#endif
/* Try to load a function from one of the possible wordcode files for it.
Index: Src/utils.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/utils.c,v
retrieving revision 1.132
diff -u -r1.132 utils.c
--- Src/utils.c 4 Aug 2006 11:42:20 -0000 1.132
+++ Src/utils.c 4 Aug 2006 13:13:05 -0000
@@ -79,10 +79,15 @@
if (!mblen)
break;
/* No good unless all characters are convertible */
- if (*wcptr == WEOF)
+ if (wci == WEOF)
return;
*wcptr++ = (wchar_t)wci;
#ifdef DEBUG
+ /*
+ * This generates a warning from the compiler (and is
+ * indeed useless) if chars are unsigned. It's
+ * extreme paranoia anyway.
+ */
if (wcptr[-1] < 0)
fprintf(stderr, "BUG: Bad cast to wchar_t\n");
#endif
@@ -501,6 +506,9 @@
/*
* Can't or don't want to convert character: use UCS-2 or
* UCS-4 code in print escape format.
+ *
+ * This comparison fails and generates a compiler warning
+ * if wchar_t is 16 bits, but the code is still correct.
*/
if (c >= 0x10000) {
sprintf(buf, "\\U%.8x", (unsigned int)c);
--
Peter Stephenson <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2006-08-04 13:34 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-04 13:34 PATCH: result of warnings from Cygwin Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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 NNTP newsgroup(s).