Index: asterisk.c
===================================================================
RCS file: /usr/cvsroot/asterisk/asterisk.c,v
retrieving revision 1.19
diff -u -r1.19 asterisk.c
--- asterisk.c	5 Sep 2003 04:36:58 -0000	1.19
+++ asterisk.c	6 Sep 2003 22:23:17 -0000
@@ -505,7 +509,7 @@
 	quit_handler(num, 0, 1, 0);
 }
 
-static pthread_t consolethread = -1;
+static pthread_t consolethread = (pthread_t) -1;
 
 static const char *fix_header(char *outbuf, int maxout, const char *s, char *cmp)
 {
@@ -538,7 +542,7 @@
 	fflush(stdout);
 	if (complete)
 	/* Wake up a select()ing console */
-		if (consolethread > -1)
+		if (consolethread != (pthread_t) -1)
 			pthread_kill(consolethread, SIGURG);
 }
 
Index: autoservice.c
===================================================================
RCS file: /usr/cvsroot/asterisk/autoservice.c,v
retrieving revision 1.2
diff -u -r1.2 autoservice.c
--- autoservice.c	13 Aug 2003 15:25:15 -0000	1.2
+++ autoservice.c	6 Sep 2003 22:23:17 -0000
@@ -44,7 +44,7 @@
 };
 
 static struct asent *aslist = NULL;
-static pthread_t asthread = -1;
+static pthread_t asthread = (pthread_t) -1;
 
 static void *autoservice_run(void *ign)
 {
@@ -80,7 +80,7 @@
 				ast_frfree(f);
 		}
 	}
-	asthread = -1;
+	asthread = (pthread_t) -1;
 	return NULL;
 }
 
@@ -90,7 +90,7 @@
 	struct asent *as;
 	int needstart;
 	ast_mutex_lock(&autolock);
-	needstart = (asthread == -1) ? 1 : 0 /* aslist ? 0 : 1 */;
+	needstart = (asthread == (pthread_t) -1) ? 1 : 0 /* aslist ? 0 : 1 */;
 	as = aslist;
 	while(as) {
 		if (as->chan == chan)
@@ -142,7 +142,7 @@
 		if (!chan->_softhangup)
 			res = 0;
 	}
-	if (asthread != -1) 
+	if (asthread != (pthread_t) -1) 
 		pthread_kill(asthread, SIGURG);
 	ast_mutex_unlock(&autolock);
 	/* Wait for it to un-block */
Index: channel.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channel.c,v
retrieving revision 1.42
diff -u -r1.42 channel.c
--- channel.c	28 Aug 2003 20:02:10 -0000	1.42
+++ channel.c	6 Sep 2003 22:23:18 -0000
@@ -318,7 +318,7 @@
 					tmp->data = NULL;
 					tmp->fin = 0;
 					tmp->fout = 0;
-					snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", time(NULL), uniqueint++);
+					snprintf(tmp->uniqueid, sizeof(tmp->uniqueid), "%li.%d", (long)time(NULL), uniqueint++);
 					headp=&tmp->varshead;
 					ast_mutex_init(&tmp->lock);
 				        AST_LIST_HEAD_INIT(headp);
@@ -653,7 +653,7 @@
 	if (chan->blocking) {
 		ast_log(LOG_WARNING, "Hard hangup called by thread %ld on %s, while fd "
 					"is blocked by thread %ld in procedure %s!  Expect a failure\n",
-					pthread_self(), chan->name, chan->blocker, chan->blockproc);
+					(long)pthread_self(), chan->name, (long)chan->blocker, chan->blockproc);
 		CRASH;
 	}
 	if (!chan->zombie) {
Index: loader.c
===================================================================
RCS file: /usr/cvsroot/asterisk/loader.c,v
retrieving revision 1.6
diff -u -r1.6 loader.c
--- loader.c	13 Aug 2003 15:25:16 -0000	1.6
+++ loader.c	6 Sep 2003 22:23:18 -0000
@@ -170,7 +170,9 @@
 	int res;
 	struct module *m;
 	int flags=RTLD_NOW;
+#ifdef RTLD_GLOBAL
 	char *val;
+#endif
 	char *key;
 	int o;
 	struct ast_config *cfg;
Index: logger.c
===================================================================
RCS file: /usr/cvsroot/asterisk/logger.c,v
retrieving revision 1.3
diff -u -r1.3 logger.c
--- logger.c	13 Aug 2003 15:25:16 -0000	1.3
+++ logger.c	6 Sep 2003 22:23:18 -0000
@@ -250,7 +250,7 @@
 		} else
 			/** Cannot use ast_log() from locked section of ast_log()!
 			    ast_log(LOG_WARNING, "Unable to retrieve local time?\n"); **/
-			fprintf(stderr, "ast_log: Unable to retrieve local time for %ld?\n", t);
+			fprintf(stderr, "ast_log: Unable to retrieve local time for %ld?\n", (long)t);
 	} else {
 		if (logfiles) {
 			f = logfiles;
@@ -260,12 +260,12 @@
 						time(&t);
 						localtime_r(&t,&tm);
 						strftime(date, sizeof(date), "%b %e %T", &tm);
-						fprintf(f->f, "%s %s[%ld]: File %s, Line %d (%s): ", date, levels[level], pthread_self(), file, line, function);
+						fprintf(f->f, "%s %s[%ld]: File %s, Line %d (%s): ", date, levels[level], (long)pthread_self(), file, line, function);
 					} else {
 						sprintf(linestr, "%d", line);
 						fprintf(f->f, "%s[%ld]: File %s, Line %s (%s): ",
 																term_color(tmp, levels[level], colors[level], 0, sizeof(tmp)),
-																pthread_self(),
+																(long)pthread_self(),
 																term_color(tmp2, file, COLOR_BRWHITE, 0, sizeof(tmp2)),
 																term_color(tmp3, linestr, COLOR_BRWHITE, 0, sizeof(tmp3)),
 																term_color(tmp4, function, COLOR_BRWHITE, 0, sizeof(tmp4)));
@@ -278,7 +278,7 @@
 				f = f->next;
 			}
 		} else {
-			fprintf(stdout, "%s[%ld]: File %s, Line %d (%s): ", levels[level], pthread_self(), file, line, function);
+			fprintf(stdout, "%s[%ld]: File %s, Line %d (%s): ", levels[level], (long)pthread_self(), file, line, function);
 			va_start(ap, fmt);
 			vfprintf(stdout, fmt, ap);
 			va_end(ap);
Index: manager.c
===================================================================
RCS file: /usr/cvsroot/asterisk/manager.c,v
retrieving revision 1.19
diff -u -r1.19 manager.c
--- manager.c	25 Aug 2003 22:40:14 -0000	1.19
+++ manager.c	6 Sep 2003 22:23:18 -0000
@@ -687,7 +687,7 @@
 
 	for (;;) {
 		sinlen = sizeof(sin);
-		as = accept(asock, &sin, &sinlen);
+		as = accept(asock, (struct sockaddr *)&sin, &sinlen);
 		if (as < 0) {
 			ast_log(LOG_NOTICE, "Accept returned -1: %s\n", strerror(errno));
 			continue;
@@ -882,7 +882,7 @@
 			return -1;
 		}
 		setsockopt(asock, SOL_SOCKET, SO_REUSEADDR, &x, sizeof(x));
-		if (bind(asock, &ba, sizeof(ba))) {
+		if (bind(asock, (struct sockaddr *)&ba, sizeof(ba))) {
 			ast_log(LOG_WARNING, "Unable to bind socket: %s\n", strerror(errno));
 			close(asock);
 			asock = -1;
Index: rtp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/rtp.c,v
retrieving revision 1.26
diff -u -r1.26 rtp.c
--- rtp.c	18 Aug 2003 05:31:25 -0000	1.26
+++ rtp.c	6 Sep 2003 22:23:18 -0000
@@ -723,8 +723,8 @@
 		rtp->us.sin_port = htons(x);
 		if (rtp->rtcp)
 			rtp->rtcp->us.sin_port = htons(x + 1);
-		if (!bind(rtp->s, &rtp->us, sizeof(rtp->us)) &&
-			(!rtp->rtcp || !bind(rtp->rtcp->s, &rtp->rtcp->us, sizeof(rtp->rtcp->us))))
+		if (!bind(rtp->s, (struct sockaddr *)&rtp->us, sizeof(rtp->us)) &&
+			(!rtp->rtcp || !bind(rtp->rtcp->s, (struct sockaddr *)&rtp->rtcp->us, sizeof(rtp->rtcp->us))))
 			break;
 		if (errno != EADDRINUSE) {
 			ast_log(LOG_WARNING, "Unexpected bind error: %s\n", strerror(errno));
@@ -873,7 +873,7 @@
 	rtpheader[3] = htonl((digit << 24) | (0xa << 16) | (0));
 	for (x=0;x<4;x++) {
 		if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {
-			res = sendto(rtp->s, (void *)rtpheader, hdrlen + 4, 0, &rtp->them, sizeof(rtp->them));
+			res = sendto(rtp->s, (void *)rtpheader, hdrlen + 4, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
 			if (res <0) 
 				ast_log(LOG_NOTICE, "RTP Transmission error to %s:%d: %s\n", inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port), strerror(errno));
 	#if 0
@@ -960,7 +960,7 @@
 	rtpheader[1] = htonl(rtp->lastts);
 	rtpheader[2] = htonl(rtp->ssrc); 
 	if (rtp->them.sin_port && rtp->them.sin_addr.s_addr) {
-		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, &rtp->them, sizeof(rtp->them));
+		res = sendto(rtp->s, (void *)rtpheader, f->datalen + hdrlen, 0, (struct sockaddr *)&rtp->them, sizeof(rtp->them));
 		if (res <0) 
 			ast_log(LOG_NOTICE, "RTP Transmission error to %s:%d: %s\n", inet_ntoa(rtp->them.sin_addr), ntohs(rtp->them.sin_port), strerror(errno));
 #if 0
Index: sched.c
===================================================================
RCS file: /usr/cvsroot/asterisk/sched.c,v
retrieving revision 1.2
diff -u -r1.2 sched.c
--- sched.c	27 Jul 2003 03:53:19 -0000	1.2
+++ sched.c	6 Sep 2003 22:23:18 -0000
@@ -309,8 +309,8 @@
 				q->id,
 				q->callback,
 				q->data,
-				s,
-				ms);
+				(long)s,
+				(long)ms);
 		q=q->next;
 	}
 	ast_log(LOG_DEBUG, "=================================================\n");
Index: agi/eagi-sphinx-test.c
===================================================================
RCS file: /usr/cvsroot/asterisk/agi/eagi-sphinx-test.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 eagi-sphinx-test.c
--- agi/eagi-sphinx-test.c	26 Feb 2003 19:41:09 -0000	1.1.1.2
+++ agi/eagi-sphinx-test.c	6 Sep 2003 22:23:18 -0000
@@ -13,9 +13,9 @@
 #include <string.h>
 #include <sys/select.h>
 #include <fcntl.h>
-#include <arpa/inet.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <arpa/inet.h>
 #include <netdb.h>
 
 #define AUDIO_FILENO (STDERR_FILENO + 1)
@@ -44,7 +44,7 @@
 	sin.sin_family = AF_INET;
 	sin.sin_port = htons(SPHINX_PORT);
 	memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
-	if (connect(sphinx_sock, &sin, sizeof(sin))) {
+	if (connect(sphinx_sock, (struct sockaddr *)&sin, sizeof(sin))) {
 		fprintf(stderr, "Unable to connect on socket: %s\n", strerror(errno));
 		close(sphinx_sock);
 		sphinx_sock = -1;
Index: apps/app_agi.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_agi.c,v
retrieving revision 1.11
diff -u -r1.11 app_agi.c
--- apps/app_agi.c	21 Aug 2003 23:35:56 -0000	1.11
+++ apps/app_agi.c	6 Sep 2003 22:23:19 -0000
@@ -23,7 +23,7 @@
 #include <unistd.h>
 #include <string.h>
 #include <stdlib.h>
-#include <sys/signal.h>
+#include <signal.h>
 #include <sys/time.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -152,7 +152,7 @@
 		for (x=STDERR_FILENO + 2;x<1024;x++) 
 			close(x);
 		/* Execute script */
-		execl(script, script, args, NULL);
+		execl(script, script, args, (char *)NULL);
 		/* Can't use ast_log since FD's are closed */
 		fprintf(stderr, "Failed to execute '%s': %s\n", script, strerror(errno));
 		exit(1);
Index: apps/app_mp3.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_mp3.c,v
retrieving revision 1.4
diff -u -r1.4 app_mp3.c
--- apps/app_mp3.c	27 Apr 2003 18:13:11 -0000	1.4
+++ apps/app_mp3.c	6 Sep 2003 22:23:19 -0000
@@ -61,9 +61,9 @@
 	}
 	/* Execute mpg123, but buffer if it's a net connection */
 	if (strncmp(filename, "http://", 7)) 
-	    execl(MPG_123, MPG_123, "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, NULL);
+	    execl(MPG_123, MPG_123, "-q", "-s", "-b", "1024", "--mono", "-r", "8000", filename, (char *)NULL);
 	else
-	    execl(MPG_123, MPG_123, "-q", "-s", "--mono", "-r", "8000", filename, NULL);
+	    execl(MPG_123, MPG_123, "-q", "-s", "--mono", "-r", "8000", filename, (char *)NULL);
 	ast_log(LOG_WARNING, "Execute of mpg123 failed\n");
 	return -1;
 }
Index: apps/app_queue.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_queue.c,v
retrieving revision 1.32
diff -u -r1.32 app_queue.c
--- apps/app_queue.c	23 Aug 2003 02:11:44 -0000	1.32
+++ apps/app_queue.c	6 Sep 2003 22:23:20 -0000
@@ -1372,7 +1372,7 @@
 					strcat(max, " (dynamic)");
 				if (mem->calls) {
 					snprintf(calls, sizeof(calls), " has taken %d calls (last was %ld secs ago)",
-							mem->calls, time(NULL) - mem->lastcall);
+							mem->calls, (long)(time(NULL) - mem->lastcall));
 				} else
 					strcpy(calls, " has taken no calls yet");
 				ast_cli(fd, "      %s/%s%s%s\n", mem->tech, mem->loc, max, calls);
Index: apps/app_voicemail.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail.c,v
retrieving revision 1.13
diff -u -r1.13 app_voicemail.c
--- apps/app_voicemail.c	3 May 2003 20:46:19 -0000	1.13
+++ apps/app_voicemail.c	6 Sep 2003 22:23:21 -0000
@@ -643,7 +643,7 @@
 	chan->priority,
 	chan->name,
 	chan->callerid ? chan->callerid : "Unknown",
-	date, time(NULL));
+	date, (long) time(NULL));
 							fclose(txt);
 						} else
 							ast_log(LOG_WARNING, "Error opening text file for output\n");
@@ -809,7 +809,7 @@
 							txt = fopen(txtfile, "a");
 							if (txt) {
 								time(&end);
-								fprintf(txt, "duration=%ld\n", end-start);
+								fprintf(txt, "duration=%ld\n", (long)(end-start));
 								fclose(txt);
 							}
 							/* Send e-mail if applicable */
Index: apps/app_voicemail2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_voicemail2.c,v
retrieving revision 1.46
diff -u -r1.46 app_voicemail2.c
--- apps/app_voicemail2.c	4 Sep 2003 04:20:43 -0000	1.46
+++ apps/app_voicemail2.c	6 Sep 2003 22:23:23 -0000
@@ -1095,7 +1095,7 @@
 	chan->priority,
 	chan->name,
 	chan->callerid ? chan->callerid : "Unknown",
-	date, time(NULL));
+	date, (long)time(NULL));
 					fclose(txt);
 				} else
 					ast_log(LOG_WARNING, "Error opening text file for output\n");
@@ -1105,7 +1105,7 @@
 				txt = fopen(txtfile, "a");
 				if (txt) {
 					time(&end);
-					fprintf(txt, "duration=%ld\n", end-start);
+					fprintf(txt, "duration=%ld\n", (long)(end-start));
 					fclose(txt);
 				}
 				stringp = fmt;
@@ -2100,10 +2100,11 @@
 				{
 					struct timeval now;
 					struct tm tmnow;
-					time_t beg_today;
+					time_t beg_today, tnow;
 
 					gettimeofday(&now,NULL);
-					localtime_r(&now.tv_sec,&tmnow);
+					tnow = now.tv_sec;
+					localtime_r(&tnow,&tmnow);
 					tmnow.tm_hour = 0;
 					tmnow.tm_min = 0;
 					tmnow.tm_sec = 0;
@@ -2127,10 +2128,11 @@
 				{
 					struct timeval now;
 					struct tm tmnow;
-					time_t beg_today;
+					time_t beg_today, tnow;
 
 					gettimeofday(&now,NULL);
-					localtime_r(&now.tv_sec,&tmnow);
+					tnow = now.tv_sec;
+					localtime_r(&tnow,&tmnow);
 					tmnow.tm_hour = 0;
 					tmnow.tm_min = 0;
 					tmnow.tm_sec = 0;
@@ -2184,9 +2186,10 @@
 	char filename[256], *origtime, temp[256];
 	struct vm_zone *the_zone = NULL;
 	struct ast_config *msg_cfg;
-	time_t t;
+	time_t t, tnow;
 	struct timeval tv_now;
 	struct tm time_now, time_then;
+	long tin;
 
 	make_file(vms->fn2, sizeof(vms->fn2), vms->curdir, vms->curmsg); 
 	snprintf(filename,sizeof(filename), "%s.txt", vms->fn2);
@@ -2198,10 +2201,11 @@
 
 	if (!(origtime = ast_variable_retrieve(msg_cfg, "message", "origtime")))
 		return 0;
-	if (sscanf(origtime,"%ld",&t) < 1) {
+	if (sscanf(origtime,"%ld",&tin) < 1) {
 		ast_log(LOG_WARNING, "Couldn't find origtime in %s\n", filename);
 		return 0;
 	}
+	t = tin;
 	ast_destroy(msg_cfg);
 
 	/* Does this user have a timezone specified? */
@@ -2228,7 +2232,8 @@
 	/* Set the DIFF_* variables */
 	localtime_r(&t, &time_now);
 	gettimeofday(&tv_now,NULL);
-	localtime_r(&tv_now.tv_sec,&time_then);
+	tnow = tv_now.tv_sec;
+	localtime_r(&tnow,&time_then);
 
 	/* Day difference */
 	if (time_now.tm_year == time_then.tm_year)
Index: cdr/cdr_mysql.c
===================================================================
RCS file: /usr/cvsroot/asterisk/cdr/cdr_mysql.c,v
retrieving revision 1.15
diff -u -r1.15 cdr_mysql.c
--- cdr/cdr_mysql.c	21 Aug 2003 16:01:25 -0000	1.15
+++ cdr/cdr_mysql.c	6 Sep 2003 22:23:23 -0000
@@ -86,23 +86,26 @@
 	}
 
 	if (connected) {
-		char *clid=NULL, *dcontext=NULL, *channel=NULL, *dstchannel=NULL, *lastapp=NULL, *lastdata=NULL, *uniqueid=NULL;
+		char *clid=NULL, *dcontext=NULL, *channel=NULL, *dstchannel=NULL, *lastapp=NULL, *lastdata=NULL;
+#ifdef MYSQL_LOGUNIQUEID
+		char *uniqueid=NULL;
+#endif
 
 		/* Maximum space needed would be if all characters needed to be escaped, plus a trailing NULL */
-		if (clid = alloca(strlen(cdr->clid) * 2 + 1))
+		if ((clid = alloca(strlen(cdr->clid) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, clid, cdr->clid, strlen(cdr->clid));
-		if (dcontext = alloca(strlen(cdr->dcontext) * 2 + 1))
+		if ((dcontext = alloca(strlen(cdr->dcontext) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, dcontext, cdr->dcontext, strlen(cdr->dcontext));
-		if (channel = alloca(strlen(cdr->channel) * 2 + 1))
+		if ((channel = alloca(strlen(cdr->channel) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, channel, cdr->channel, strlen(cdr->channel));
-		if (dstchannel = alloca(strlen(cdr->dstchannel) * 2 + 1))
+		if ((dstchannel = alloca(strlen(cdr->dstchannel) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, dstchannel, cdr->dstchannel, strlen(cdr->dstchannel));
-		if (lastapp = alloca(strlen(cdr->lastapp) * 2 + 1))
+		if ((lastapp = alloca(strlen(cdr->lastapp) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, lastapp, cdr->lastapp, strlen(cdr->lastapp));
-		if (lastdata = alloca(strlen(cdr->lastdata) * 2 + 1))
+		if ((lastdata = alloca(strlen(cdr->lastdata) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, lastdata, cdr->lastdata, strlen(cdr->lastdata));
 #ifdef MYSQL_LOGUNIQUEID
-		if (uniqueid = alloca(strlen(cdr->uniqueid) * 2 + 1))
+		if ((uniqueid = alloca(strlen(cdr->uniqueid) * 2 + 1)) != NULL)
 			mysql_real_escape_string(&mysql, uniqueid, cdr->uniqueid, strlen(cdr->uniqueid));
 #endif
 
@@ -141,7 +144,7 @@
 	return desc;
 }
 
-int my_unload_module(void)
+static int my_unload_module(void)
 { 
 	if (connected) {
 		mysql_close(&mysql);
@@ -177,7 +180,7 @@
 	return 0;
 }
 
-int my_load_module(void)
+static int my_load_module(void)
 {
 	int res;
 	struct ast_config *cfg;
Index: channels/chan_agent.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_agent.c,v
retrieving revision 1.54
diff -u -r1.54 chan_agent.c
--- channels/chan_agent.c	4 Sep 2003 04:03:47 -0000	1.54
+++ channels/chan_agent.c	6 Sep 2003 22:23:23 -0000
@@ -194,7 +194,7 @@
 			strncpy(p->agent, tmp, sizeof(p->agent) -1);
 			ast_mutex_init( &p->lock );
 			ast_mutex_init( &p->app_lock );
-			p->owning_app = -1;
+			p->owning_app = (pthread_t) -1;
 			p->app_sleep_cond = 1;
 			p->group = group;
 			p->pending = pending;
Index: channels/chan_iax2.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_iax2.c,v
retrieving revision 1.47
diff -u -r1.47 chan_iax2.c
--- channels/chan_iax2.c	4 Sep 2003 04:09:09 -0000	1.47
+++ channels/chan_iax2.c	6 Sep 2003 22:23:24 -0000
@@ -3576,7 +3576,9 @@
 	struct iax2_peer *peer;
 	int processed = 0;
 	int totalcalls = 0;
+#ifdef ZT_TIMERACK
 	int x = 1;
+#endif
 	if (iaxtrunkdebug)
 		ast_verbose("Beginning trunk processing\n");
 	if (events & AST_IO_PRI) {
@@ -5116,7 +5118,9 @@
 	int format;
 	struct iax2_user *user;
 	struct iax2_peer *peer;
+#if 0
 	static unsigned short int last_port=0;
+#endif
 
 	cfg = ast_load(config_file);
 	
Index: channels/chan_mgcp.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_mgcp.c,v
retrieving revision 1.18
diff -u -r1.18 chan_mgcp.c
--- channels/chan_mgcp.c	19 Aug 2003 15:13:54 -0000	1.18
+++ channels/chan_mgcp.c	6 Sep 2003 22:23:25 -0000
@@ -413,7 +413,7 @@
     time(&t);
     if (sub->messagepending && (sub->lastouttime + 20 < t)) {
         ast_log(LOG_NOTICE, "Timeout waiting for response to message:%d,  lastouttime: %ld, now: %ld.  Dumping pending queue\n",
-                sub->msgs ? sub->msgs->seqno : -1, sub->lastouttime, t);
+                sub->msgs ? sub->msgs->seqno : -1, (long) sub->lastouttime, (long) t);
         dump_queue(sub->parent);
     }
 	msg->seqno = seqno;
@@ -2546,7 +2546,7 @@
 static int restart_monitor(void)
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == (pthread_t) -2)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
Index: channels/chan_modem.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_modem.c,v
retrieving revision 1.5
diff -u -r1.5 chan_modem.c
--- channels/chan_modem.c	16 Aug 2003 05:10:35 -0000	1.5
+++ channels/chan_modem.c	6 Sep 2003 22:23:25 -0000
@@ -28,6 +28,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <stdlib.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
@@ -82,7 +83,7 @@
 
 /* This is the thread for the monitor which checks for input on the channels
    which are not currently in use.  */
-static pthread_t monitor_thread = -1;
+static pthread_t monitor_thread = (pthread_t) -1;
 
 static int restart_monitor(void);
 
@@ -644,7 +645,7 @@
 static int restart_monitor()
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == (pthread_t) -2)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -655,7 +656,7 @@
 		ast_log(LOG_WARNING, "Cannot kill myself\n");
 		return -1;
 	}
-	if (monitor_thread != -1) {
+	if (monitor_thread != (pthread_t) -1) {
 		pthread_cancel(monitor_thread);
 		/* Nudge it a little, as it's probably stuck in select */
 		pthread_kill(monitor_thread, SIGURG);
@@ -949,11 +950,11 @@
 		return -1;
 	}
 	if (!ast_mutex_lock(&monlock)) {
-		if (monitor_thread > -1) {
+		if (monitor_thread != (pthread_t) -1 && monitor_thread != (pthread_t) -2) {
 			pthread_cancel(monitor_thread);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = (pthread_t) -2;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
Index: channels/chan_sip.c
===================================================================
RCS file: /usr/cvsroot/asterisk/channels/chan_sip.c,v
retrieving revision 1.172
diff -u -r1.172 chan_sip.c
--- channels/chan_sip.c	5 Sep 2003 04:00:57 -0000	1.172
+++ channels/chan_sip.c	6 Sep 2003 22:23:27 -0000
@@ -5287,7 +5287,7 @@
 static int restart_monitor(void)
 {
 	/* If we're supposed to be stopped -- stay stopped */
-	if (monitor_thread == -2)
+	if (monitor_thread == (pthread_t) -2)
 		return 0;
 	if (ast_mutex_lock(&monlock)) {
 		ast_log(LOG_WARNING, "Unable to lock monitor\n");
@@ -6140,7 +6140,7 @@
 			pthread_kill(monitor_thread, SIGURG);
 			pthread_join(monitor_thread, NULL);
 		}
-		monitor_thread = -2;
+		monitor_thread = (pthread_t) -2;
 		ast_mutex_unlock(&monlock);
 	} else {
 		ast_log(LOG_WARNING, "Unable to lock the monitor\n");
Index: formats/format_g729.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_g729.c,v
retrieving revision 1.6
diff -u -r1.6 format_g729.c
--- formats/format_g729.c	28 Aug 2003 20:02:10 -0000	1.6
+++ formats/format_g729.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_gsm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_gsm.c,v
retrieving revision 1.6
diff -u -r1.6 format_gsm.c
--- formats/format_gsm.c	28 Aug 2003 20:02:10 -0000	1.6
+++ formats/format_gsm.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_h263.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_h263.c,v
retrieving revision 1.2
diff -u -r1.2 format_h263.c
--- formats/format_h263.c	13 Aug 2003 15:25:16 -0000	1.2
+++ formats/format_h263.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_jpeg.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_jpeg.c,v
retrieving revision 1.3
diff -u -r1.3 format_jpeg.c
--- formats/format_jpeg.c	23 Apr 2003 20:23:30 -0000	1.3
+++ formats/format_jpeg.c	6 Sep 2003 22:23:27 -0000
@@ -18,6 +18,7 @@
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
 #include <asterisk/image.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_mp3.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_mp3.c,v
retrieving revision 1.4
diff -u -r1.4 format_mp3.c
--- formats/format_mp3.c	28 Aug 2003 20:02:10 -0000	1.4
+++ formats/format_mp3.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <stdio.h>
Index: formats/format_pcm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_pcm.c,v
retrieving revision 1.6
diff -u -r1.6 format_pcm.c
--- formats/format_pcm.c	28 Aug 2003 20:02:10 -0000	1.6
+++ formats/format_pcm.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_pcm_alaw.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_pcm_alaw.c,v
retrieving revision 1.7
diff -u -r1.7 format_pcm_alaw.c
--- formats/format_pcm_alaw.c	28 Aug 2003 20:02:10 -0000	1.7
+++ formats/format_pcm_alaw.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_vox.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_vox.c,v
retrieving revision 1.5
diff -u -r1.5 format_vox.c
--- formats/format_vox.c	13 Aug 2003 15:25:16 -0000	1.5
+++ formats/format_vox.c	6 Sep 2003 22:23:27 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_wav.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_wav.c,v
retrieving revision 1.6
diff -u -r1.6 format_wav.c
--- formats/format_wav.c	28 Aug 2003 20:02:10 -0000	1.6
+++ formats/format_wav.c	6 Sep 2003 22:23:28 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: formats/format_wav_gsm.c
===================================================================
RCS file: /usr/cvsroot/asterisk/formats/format_wav_gsm.c,v
retrieving revision 1.6
diff -u -r1.6 format_wav_gsm.c
--- formats/format_wav_gsm.c	28 Aug 2003 20:02:10 -0000	1.6
+++ formats/format_wav_gsm.c	6 Sep 2003 22:23:28 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/logger.h>
 #include <asterisk/sched.h>
 #include <asterisk/module.h>
+#include <netinet/in.h>
 #include <arpa/inet.h>
 #include <stdlib.h>
 #include <sys/time.h>
Index: include/asterisk/channel.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/channel.h,v
retrieving revision 1.19
diff -u -r1.19 channel.h
--- include/asterisk/channel.h	5 Sep 2003 04:00:57 -0000	1.19
+++ include/asterisk/channel.h	6 Sep 2003 22:23:28 -0000
@@ -17,6 +17,7 @@
 #include <asterisk/frame.h>
 #include <asterisk/sched.h>
 #include <asterisk/chanvars.h>
+#include <unistd.h>
 #include <setjmp.h>
 #include <pthread.h>
 
@@ -771,7 +772,7 @@
 
 #define CHECK_BLOCKING(c) { 	 \
 							if ((c)->blocking) {\
-								ast_log(LOG_WARNING, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", pthread_self(), (c)->name, (c)->blocker, (c)->blockproc); \
+								ast_log(LOG_WARNING, "Thread %ld Blocking '%s', already blocked by thread %ld in procedure %s\n", (long) pthread_self(), (c)->name, (long) (c)->blocker, (c)->blockproc); \
 								CRASH; \
 							} else { \
 								(c)->blocker = pthread_self(); \
Index: include/asterisk/srv.h
===================================================================
RCS file: /usr/cvsroot/asterisk/include/asterisk/srv.h,v
retrieving revision 1.1
diff -u -r1.1 srv.h
--- include/asterisk/srv.h	12 Jun 2003 22:14:03 -0000	1.1
+++ include/asterisk/srv.h	6 Sep 2003 22:23:28 -0000
@@ -13,7 +13,9 @@
 
 #ifndef _ASTERISK_SRV_H
 #define _ASTERISK_SRV_H
-#include <asterisk/channel.h>
+
+struct ast_channel;
+
 /* Lookup entry in SRV records Returns 1 if found, 0 if not found, -1 on hangup */
 extern int ast_get_srv(struct ast_channel *chan, char *host, int hostlen, int *port, const char *service);
 
Index: pbx/pbx_gtkconsole.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_gtkconsole.c,v
retrieving revision 1.4
diff -u -r1.4 pbx_gtkconsole.c
--- pbx/pbx_gtkconsole.c	15 Aug 2003 04:38:39 -0000	1.4
+++ pbx/pbx_gtkconsole.c	6 Sep 2003 22:23:28 -0000
@@ -32,8 +32,8 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdarg.h>
+#include <signal.h>
 #include <sys/time.h>
-#include <sys/signal.h>
 
 #include <gtk/gtk.h>
 #include <glib.h>
Index: pbx/pbx_spool.c
===================================================================
RCS file: /usr/cvsroot/asterisk/pbx/pbx_spool.c,v
retrieving revision 1.2
diff -u -r1.2 pbx_spool.c
--- pbx/pbx_spool.c	25 Aug 2003 22:40:14 -0000	1.2
+++ pbx/pbx_spool.c	6 Sep 2003 22:23:28 -0000
@@ -243,7 +243,7 @@
 				if (o->retries <= o->maxretries + 1) {
 					/* Add a retry line at the end */
 					fseek(f, 0L, SEEK_END);
-					fprintf(f, "Retry: %d (%ld)\n", o->retries, now);
+					fprintf(f, "Retry: %d (%ld)\n", o->retries, (long) now);
 					fclose(f);
 					now += o->retrytime;
 					launch_service(o);
Index: res/res_musiconhold.c
===================================================================
RCS file: /usr/cvsroot/asterisk/res/res_musiconhold.c,v
retrieving revision 1.7
diff -u -r1.7 res_musiconhold.c
--- res/res_musiconhold.c	16 Aug 2003 05:10:35 -0000	1.7
+++ res/res_musiconhold.c	6 Sep 2003 22:23:28 -0000
@@ -27,6 +27,7 @@
 #include <errno.h>
 #include <unistd.h>
 #include <string.h>
+#include <signal.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/time.h>
@@ -477,7 +478,9 @@
 static int moh_register(char *classname, char *mode, char *param, char *miscargs)
 {
 	struct mohclass *moh;
+#ifdef ZAPATA_MOH
 	int x;
+#endif
 	ast_mutex_lock(&moh_lock);
 	moh = get_mohbyname(classname);
 	ast_mutex_unlock(&moh_lock);
