1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-10-29 17:31:02 +01:00

22586: fix warnings spotted on Cygwin

This commit is contained in:
Peter Stephenson 2006-08-04 13:38:26 +00:00
parent 99fa8b90b2
commit 596d38fb07
3 changed files with 21 additions and 1 deletions

View file

@ -1,5 +1,10 @@
2006-08-04 Peter Stephenson <pws@csr.com> 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 * 22585: makepro.awk, Src/utils.c: zsh.exports was missing
VA_ALIST declarations and some multibyte-related stuff. VA_ALIST declarations and some multibyte-related stuff.

View file

@ -2966,17 +2966,23 @@ build_cur_dump(char *nam, char *dump, char **names, int match, int map,
return 0; return 0;
} }
/**/
#if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MMAP) && defined(HAVE_MUNMAP) #if defined(HAVE_SYS_MMAN_H) && defined(HAVE_MMAP) && defined(HAVE_MUNMAP)
#include <sys/mman.h> #include <sys/mman.h>
/**/
#if defined(MAP_SHARED) && defined(PROT_READ) #if defined(MAP_SHARED) && defined(PROT_READ)
/**/
#define USE_MMAP 1 #define USE_MMAP 1
/**/
#endif #endif
/**/
#endif #endif
/**/
#ifdef USE_MMAP #ifdef USE_MMAP
/* List of dump files mapped. */ /* 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)) #define zwcstat(f, b) (!!stat(f, b))
/**/
#endif #endif
/* Try to load a function from one of the possible wordcode files for it. /* Try to load a function from one of the possible wordcode files for it.

View file

@ -79,10 +79,15 @@ set_widearray(char *mb_array, Widechar_array wca)
if (!mblen) if (!mblen)
break; break;
/* No good unless all characters are convertible */ /* No good unless all characters are convertible */
if (*wcptr == WEOF) if (wci == WEOF)
return; return;
*wcptr++ = (wchar_t)wci; *wcptr++ = (wchar_t)wci;
#ifdef DEBUG #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) if (wcptr[-1] < 0)
fprintf(stderr, "BUG: Bad cast to wchar_t\n"); fprintf(stderr, "BUG: Bad cast to wchar_t\n");
#endif #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 * Can't or don't want to convert character: use UCS-2 or
* UCS-4 code in print escape format. * 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) { if (c >= 0x10000) {
sprintf(buf, "\\U%.8x", (unsigned int)c); sprintf(buf, "\\U%.8x", (unsigned int)c);