about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-08-04 13:38:26 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-08-04 13:38:26 +0000
commit596d38fb078aaa075bde47920b25c1b913056ea8 (patch)
tree25c1fed73ed959bb8d69250d0c1018cb617dbcc9
parent99fa8b90b24b17536d95285c0b64d9b336570ff1 (diff)
downloadzsh-596d38fb078aaa075bde47920b25c1b913056ea8.tar.gz
zsh-596d38fb078aaa075bde47920b25c1b913056ea8.tar.xz
zsh-596d38fb078aaa075bde47920b25c1b913056ea8.zip
22586: fix warnings spotted on Cygwin
-rw-r--r--ChangeLog5
-rw-r--r--Src/parse.c7
-rw-r--r--Src/utils.c10
3 files changed, 21 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 65fca2bfd..d8d4385ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2006-08-04  Peter Stephenson  <pws@csr.com>
 
+	* 22586: Src/parse.c, Src/utils.c: minor warnings spotted
+	on Cygwin: unnecessary static declaration in parse.c, typo in
+	set_widearray, also comments on other warnings that are harder
+	to avoid.
+
 	* 22585: makepro.awk, Src/utils.c: zsh.exports was missing
 	VA_ALIST declarations and some multibyte-related stuff.
 
diff --git a/Src/parse.c b/Src/parse.c
index 7063599b4..a25eb3efa 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -2966,17 +2966,23 @@ build_cur_dump(char *nam, char *dump, char **names, int match, int map,
     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 @@ load_dump_file(char *dump, struct stat *sbuf, int other, int len)
 
 #define zwcstat(f, b) (!!stat(f, b))
 
+/**/
 #endif
 
 /* Try to load a function from one of the possible wordcode files for it.
diff --git a/Src/utils.c b/Src/utils.c
index 0dcf4e59b..8fdf2c0ab 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -79,10 +79,15 @@ set_widearray(char *mb_array, Widechar_array wca)
 	    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 @@ wcs_nicechar(wchar_t c, size_t *widthp, char **swidep)
 	/*
 	 * 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);