diff --git a/timidity/output.c b/timidity/output.c index 2fec1982c8ce1d305e5b0e737fcd7787022283c4..87f2005757a953335e320ace2338aba8265665db 100644 --- a/timidity/output.c +++ b/timidity/output.c @@ -641,7 +641,7 @@ char *create_auto_output_name(const char *input_filename, char *ext_str, char *o *p = '_'; if(mode==2){ - char *p1,*p2; + char *p1,*p2,*p3; #ifndef __W32__ p = strrchr(output_filename+dir_len,PATH_SEP); #else @@ -652,7 +652,6 @@ char *create_auto_output_name(const char *input_filename, char *ext_str, char *o #endif p1 = STRRCHR(output_filename+dir_len,'/'); p2 = STRRCHR(output_filename+dir_len,'\\'); - char *p3; p3 = STRRCHR(output_filename+dir_len,':'); #undef STRRCHR p1>p2 ? (p1>p3 ? (p = p1) : (p = p3)) : (p2>p3 ? (p = p2) : (p = p3)); diff --git a/timidity/timidity.c b/timidity/timidity.c index 4a4d601bc2437d15572f2bf032f22dc73b5e043c..8e27d72b561d4f5ebc3e494eb7984ac6ef548170 100644 --- a/timidity/timidity.c +++ b/timidity/timidity.c @@ -1658,7 +1658,7 @@ static int read_config_file(char *name, int self, int allow_missing_file) if (*w[1] == '-') { int optind_save = optind; optind = 0; -#if defined(__MINGW32__) || defined(__CYGWIN__) +#if defined(__CYGWIN__) optreset = 1; #endif c = getopt_long(words, w, optcommands, longopts, &longind); @@ -5121,7 +5121,11 @@ static void interesting_message(void) static RETSIGTYPE sigterm_exit(int sig) { char s[4]; +#if defined(__MINGW32__) + int dummy; +#else ssize_t dummy; +#endif /* NOTE: Here, fprintf is dangerous because it is not re-enterance * function. It is possible coredump if the signal is called in printf's. @@ -5357,6 +5361,7 @@ MAIN_INTERFACE int timidity_post_load_configuration(void) { int i, cmderr = 0; +#ifdef IA_ALSASEQ /* If we're going to fork for daemon mode, we need to fork now, as certain output libraries (pulseaudio) become unhappy if initialized before forking and then being used from the child. */ @@ -5379,6 +5384,7 @@ MAIN_INTERFACE int timidity_post_load_configuration(void) exit(0); } } +#endif if(play_mode == &null_play_mode) { @@ -5836,7 +5842,7 @@ int main(int argc, char **argv) opt_sf_close_each_file = 0; #endif optind = longind = 0; -#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(__CYGWIN__) optreset = 1; #endif #ifdef __W32__ @@ -5849,7 +5855,7 @@ int main(int argc, char **argv) return err; } optind = longind = 0; -#if defined(__CYGWIN__) || defined(__MINGW32__) +#if defined(__CYGWIN__) optreset = 1; #endif while ((c = getopt_long(argc, argv, optcommands, longopts, &longind)) > 0) diff --git a/utils/getaddrinfo.c b/utils/getaddrinfo.c index aa80f354f3f81bc718c1f5974082113efe32a941..d0be3e5de386306817c4dc719ca8f0e3eb129dd5 100644 --- a/utils/getaddrinfo.c +++ b/utils/getaddrinfo.c @@ -185,6 +185,8 @@ stub_getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, int hostlen, char *serv, int servlen, int flags) #endif { + uint32_t ipv4; + if (((size_t)salen < sizeof (struct sockaddr_in)) || (sa->sa_family != AF_INET)) return EAI_FAMILY; @@ -206,7 +208,7 @@ stub_getnameinfo (const struct sockaddr *sa, socklen_t salen, } /* inet_ntoa() is not thread-safe, do not use it */ - uint32_t ipv4 = ntohl (addr->sin_addr.s_addr); + ipv4 = ntohl (addr->sin_addr.s_addr); if (snprintf (host, hostlen, "%u.%u.%u.%u", ipv4 >> 24, (ipv4 >> 16) & 0xff, (ipv4 >> 8) & 0xff, diff --git a/utils/tmdy_getopt.h b/utils/tmdy_getopt.h index b294f3f851080b6006bd92943120f134ba52cfd8..a9d4a157bbcb76709a42a03a599dfb43a2ee5714 100644 --- a/utils/tmdy_getopt.h +++ b/utils/tmdy_getopt.h @@ -25,7 +25,7 @@ #ifndef __TMDY_GETOPT_H__ #define __TMDY_GETOPT_H__ -#if defined(HAVE_UNISTD_H) && defined(HAVE_GETOPT) +#if defined(HAVE_UNISTD_H) && (!defined(__WATCOMC__) || defined(HAVE_GETOPT)) /* getopt() declaration here */ #include <unistd.h> #else