diff --git a/agi/eagi-sphinx-test.c b/agi/eagi-sphinx-test.c index ed0239435bfce769b641cf10475c5f80f8105d5e..3015b730b98f47ef4086d78ff3e376cf9f5c6c3e 100755 --- a/agi/eagi-sphinx-test.c +++ b/agi/eagi-sphinx-test.c @@ -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 @@ static int connect_sphinx(void) 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; diff --git a/apps/app_agi.c b/apps/app_agi.c index 6399c0249a84745c2c22a6b6663d117f16d0c561..294b56bd3093d2282db7b8c34eab9e4074cb9674 100755 --- a/apps/app_agi.c +++ b/apps/app_agi.c @@ -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 @@ static int launch_script(char *script, char *args, int *fds, int *efd, int *opid 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); diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 52f1225c65df163a85b545d4b49dc8a47d3710f3..c8196a75ffe8183d9e92a4412932b371e10fb6c5 100755 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -61,9 +61,9 @@ static int mp3play(char *filename, int fd) } /* 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; } diff --git a/apps/app_queue.c b/apps/app_queue.c index af349a0d72780d6c60b2ed644d6a5b03bb3f0f5c..68d883c1026368c6c48f04809b8403eb2bc3e9ef 100755 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -1372,7 +1372,7 @@ static int queues_show(int fd, int argc, char **argv) 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); diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 8ee076acdb541b4705888b78753dfbf7e310226c..8c2a23f9da65e2453efe61d4ef606366adfebaf3 100755 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -643,7 +643,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int 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 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int 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 */ diff --git a/apps/app_voicemail2.c b/apps/app_voicemail2.c index 7fb3b4388f5e0b743a43bc546cc8473cb1955e00..e5f1db75508114ee98b6ee0d33f249a484bb28ee 100755 --- a/apps/app_voicemail2.c +++ b/apps/app_voicemail2.c @@ -1095,7 +1095,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int 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 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, int silent, int 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 @@ static int play_datetime_format(struct ast_channel *chan, time_t time, struct vm { 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 @@ static int play_datetime_format(struct ast_channel *chan, time_t time, struct vm { 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 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v 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 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v 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 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v /* 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) diff --git a/asterisk.c b/asterisk.c index 498a0562df811c4a90bf62caf196416474e4eb7c..88c5f01ceec10d21eeb288253b0f81c8b36f13db 100755 --- a/asterisk.c +++ b/asterisk.c @@ -505,7 +505,7 @@ static void __quit_handler(int num) 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 +538,7 @@ static void console_verboser(const char *s, int pos, int replace, int complete) fflush(stdout); if (complete) /* Wake up a select()ing console */ - if (consolethread > -1) + if (consolethread != (pthread_t) -1) pthread_kill(consolethread, SIGURG); } diff --git a/autoservice.c b/autoservice.c index fc81c483b5e9439f955927c0517e7316cfecbf15..7e5699b97fc3445059e1675f1b284a1568254266 100755 --- a/autoservice.c +++ b/autoservice.c @@ -44,7 +44,7 @@ struct asent { }; 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 @@ static void *autoservice_run(void *ign) ast_frfree(f); } } - asthread = -1; + asthread = (pthread_t) -1; return NULL; } @@ -90,7 +90,7 @@ int ast_autoservice_start(struct ast_channel *chan) 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 @@ int ast_autoservice_stop(struct ast_channel *chan) 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 */ diff --git a/cdr/cdr_mysql.c b/cdr/cdr_mysql.c index b5cc8e51a725b73645d4574515dad36362cb64b5..adf03e2618507fda8307c39b5570a36224b8452c 100755 --- a/cdr/cdr_mysql.c +++ b/cdr/cdr_mysql.c @@ -86,23 +86,26 @@ static int mysql_log(struct ast_cdr *cdr) } 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 @@ char *description(void) return desc; } -int my_unload_module(void) +static int my_unload_module(void) { if (connected) { mysql_close(&mysql); @@ -177,7 +180,7 @@ int my_unload_module(void) return 0; } -int my_load_module(void) +static int my_load_module(void) { int res; struct ast_config *cfg; diff --git a/channel.c b/channel.c index 90819439248e6a18434936da68133e14b18e1f05..2ecde4feefa9afe9c6e498fff229ed3bd3df4343 100755 --- a/channel.c +++ b/channel.c @@ -318,7 +318,7 @@ struct ast_channel *ast_channel_alloc(int needqueue) 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 @@ int ast_hangup(struct ast_channel *chan) 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) { diff --git a/channels/chan_agent.c b/channels/chan_agent.c index d293f9cc13612d16ce6a8dc38707f0959a2d459b..7421f5d53fd1b31154ec21e1367a9d531d195d86 100755 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -194,7 +194,7 @@ static struct agent_pvt *add_agent(char *agent, int pending) 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; diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 71c5056bdee996771608284995e9ab9763f2f6d3..76957798d5443a8767b14ccf385994b46aadb178 100755 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -3576,7 +3576,9 @@ static int timing_read(int *id, int fd, short events, void *cbdata) 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 @@ static int set_config(char *config_file, struct sockaddr_in* sin){ 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); diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 1e40d5a73de33625aff82d6c6c32e04712ebd9ca..5871d04494dcfc8bdf6bb4dbbe984397aca1cea1 100755 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -413,7 +413,7 @@ static int mgcp_postrequest(struct mgcp_subchannel *sub, unsigned char *data, in 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 void *do_monitor(void *data) 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"); diff --git a/channels/chan_modem.c b/channels/chan_modem.c index de8237ff826bebf0dcc9ccb5d169ae22ea26941e..1da77d32143aca3fca9e392bceebec6b8a446d92 100755 --- a/channels/chan_modem.c +++ b/channels/chan_modem.c @@ -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 @@ static ast_mutex_t monlock = AST_MUTEX_INITIALIZER; /* 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 void *do_monitor(void *data) 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 @@ static int restart_monitor() 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 @@ int unload_module() 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"); diff --git a/channels/chan_sip.c b/channels/chan_sip.c index b2f22ad5e8182f54cff3e99ee022973ab7d8774a..34a4abef88ec174fc082f84c74fd308a5caf1bc0 100755 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -5287,7 +5287,7 @@ restartsearch: 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 @@ int unload_module() 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"); diff --git a/formats/format_g729.c b/formats/format_g729.c index 23a3c5a6da733c36605d070438a81f4ac0989474..f4ba3db66843ff8ea174015fbf27135e7827d59c 100755 --- a/formats/format_g729.c +++ b/formats/format_g729.c @@ -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> diff --git a/formats/format_gsm.c b/formats/format_gsm.c index ad39c0a0ff08027baf82d827345fbf5d6e4618e8..e154f64eb1ddf60f7c1ddb0d857f3574387c8f3b 100755 --- a/formats/format_gsm.c +++ b/formats/format_gsm.c @@ -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> diff --git a/formats/format_h263.c b/formats/format_h263.c index 6e0f8edad44c0babf3dbd18fa3c758afff1b8c6d..671a5f954cea7cf1b1e39d4f5eef08b452bd3daf 100755 --- a/formats/format_h263.c +++ b/formats/format_h263.c @@ -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> diff --git a/formats/format_jpeg.c b/formats/format_jpeg.c index 7e646f89489dc419623f3716a14b4bc48e24c5d9..db7c2096eb09bf2728dbb6b6d34d0d10244798e1 100755 --- a/formats/format_jpeg.c +++ b/formats/format_jpeg.c @@ -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> diff --git a/formats/format_mp3.c b/formats/format_mp3.c index 832110e6799a2564e04f10af2e212eb6721726b6..2a45245d3ca49506dc4d4c373d881b696b43b07f 100755 --- a/formats/format_mp3.c +++ b/formats/format_mp3.c @@ -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> diff --git a/formats/format_pcm.c b/formats/format_pcm.c index 038de171dc92a912ae6669e2583f3007320bedc3..a175f40aeb500e00baf05e4ac89bd80a7e6069c3 100755 --- a/formats/format_pcm.c +++ b/formats/format_pcm.c @@ -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> diff --git a/formats/format_pcm_alaw.c b/formats/format_pcm_alaw.c index 54d79bb292522f8a1e95b8d7f3f97c28c660dadf..d7d375edb75a4cda981158925049176b9542aa72 100755 --- a/formats/format_pcm_alaw.c +++ b/formats/format_pcm_alaw.c @@ -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> diff --git a/formats/format_vox.c b/formats/format_vox.c index 9ea35ffd58a9699c11a11d8388387e67c1a6ebbf..851f1fb81030b158ecc789543d6176b19ea6f48a 100755 --- a/formats/format_vox.c +++ b/formats/format_vox.c @@ -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> diff --git a/formats/format_wav.c b/formats/format_wav.c index 2a549b7109fb216b5453b0b3cbe027b17bcd6842..7cc5c6ff4fb240b2fc387514fa2c5594a5f29394 100755 --- a/formats/format_wav.c +++ b/formats/format_wav.c @@ -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> diff --git a/formats/format_wav_gsm.c b/formats/format_wav_gsm.c index 55a607d2f838dd57d7867e8a3952303328b4a6c5..fc8364cd1b23f90fab5d30796f7a795a42b38f66 100755 --- a/formats/format_wav_gsm.c +++ b/formats/format_wav_gsm.c @@ -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> diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index cb56d8a7ac2999b89a9b2d5e5879d5527d159d28..815f882f471bb96dfac6b538e47b58c30190f122 100755 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -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 @@ static inline int ast_select(int nfds, fd_set *rfds, fd_set *wfds, fd_set *efds, #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(); \ diff --git a/include/asterisk/srv.h b/include/asterisk/srv.h index df8a411c5a0911b7accf5e311c3a37457031f846..1c3711daedb0067ed4d698be6b938ac8203e760b 100755 --- a/include/asterisk/srv.h +++ b/include/asterisk/srv.h @@ -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); diff --git a/loader.c b/loader.c index de5674c12d7fc32d7557391a9ca24990c20fea38..5e7efce5f9b7c5d5138ca0c09439d490e860cc49 100755 --- a/loader.c +++ b/loader.c @@ -170,7 +170,9 @@ int ast_load_resource(char *resource_name) int res; struct module *m; int flags=RTLD_NOW; +#ifdef RTLD_GLOBAL char *val; +#endif char *key; int o; struct ast_config *cfg; diff --git a/logger.c b/logger.c index 30d37b11faf573c9fbcc4acbb0df0a4621951b3b..36c76e6c5840010a1e970189a93295fa3b22bc10 100755 --- a/logger.c +++ b/logger.c @@ -250,7 +250,7 @@ extern void ast_log(int level, const char *file, int line, const char *function, } 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 @@ extern void ast_log(int level, const char *file, int line, const char *function, 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 @@ extern void ast_log(int level, const char *file, int line, const char *function, 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); diff --git a/manager.c b/manager.c index 42b4350c7aa98fd8550d709c17994dc373f15bf9..74b73ac37ad60164389d833fa4f7f233d4df5f69 100755 --- a/manager.c +++ b/manager.c @@ -726,7 +726,7 @@ static void *accept_thread(void *ignore) 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; @@ -921,7 +921,7 @@ int init_manager(void) 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; diff --git a/pbx/pbx_gtkconsole.c b/pbx/pbx_gtkconsole.c index e6388bbbf8b76d84f7a1fdfadba6f31aca7c6f72..86755d245baed166f0ba9f74639263685a0ffe2f 100755 --- a/pbx/pbx_gtkconsole.c +++ b/pbx/pbx_gtkconsole.c @@ -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> diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c index 3c256956f54ec52b593105026993e26dee0f668d..d51c17e9c2639bb2b4897f0e2252e73402297869 100755 --- a/pbx/pbx_spool.c +++ b/pbx/pbx_spool.c @@ -243,7 +243,7 @@ static int scan_service(char *fn, time_t now, time_t atime) 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); diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 487d6a2525521e7e1b09ccaff3af5d614709df55..3dc78fba0242df06cd9fa13e3c71908f693aa187 100755 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -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 struct ast_generator mohgen = 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); diff --git a/rtp.c b/rtp.c index 0c0c1c33a6b8601414dfe6b0d84127727f712c0e..bd29e044b4615b0b14bd6aeb21d73b22ea6b045b 100755 --- a/rtp.c +++ b/rtp.c @@ -723,8 +723,8 @@ struct ast_rtp *ast_rtp_new(struct sched_context *sched, struct io_context *io, 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 @@ int ast_rtp_senddigit(struct ast_rtp *rtp, char digit) 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 @@ static int ast_rtp_raw_write(struct ast_rtp *rtp, struct ast_frame *f, int codec 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 diff --git a/sched.c b/sched.c index 6744a7f99faf18f734237f84cde8a1be2e135999..f8fdbca302d0f4cd3d98568eb31f1c1d9353acc3 100755 --- a/sched.c +++ b/sched.c @@ -309,8 +309,8 @@ void ast_sched_dump(struct sched_context *con) q->id, q->callback, q->data, - s, - ms); + (long)s, + (long)ms); q=q->next; } ast_log(LOG_DEBUG, "=================================================\n");