[svn-commits] branch oej/test-this-branch r17664 - in /team/oej/test-this-branch: ./ apps/ ...

svn-commits at lists.digium.com svn-commits at lists.digium.com
Wed Apr 5 11:50:59 MST 2006


Author: oej
Date: Wed Apr  5 13:50:45 2006
New Revision: 17664

URL: http://svn.digium.com/view/asterisk?rev=17664&view=rev
Log:
reset, resolve, go

Modified:
    team/oej/test-this-branch/   (props changed)
    team/oej/test-this-branch/app.c
    team/oej/test-this-branch/apps/app_channelredirect.c
    team/oej/test-this-branch/apps/app_page.c
    team/oej/test-this-branch/apps/app_queue.c
    team/oej/test-this-branch/apps/app_voicemail.c
    team/oej/test-this-branch/channels/chan_agent.c
    team/oej/test-this-branch/channels/chan_iax2.c
    team/oej/test-this-branch/channels/chan_local.c
    team/oej/test-this-branch/channels/chan_mgcp.c
    team/oej/test-this-branch/channels/chan_sip.c
    team/oej/test-this-branch/channels/chan_zap.c
    team/oej/test-this-branch/formats/format_ogg_vorbis.c
    team/oej/test-this-branch/manager.c
    team/oej/test-this-branch/pbx/pbx_dundi.c
    team/oej/test-this-branch/res/Makefile
    team/oej/test-this-branch/res/res_musiconhold.c
    team/oej/test-this-branch/rtp.c
    team/oej/test-this-branch/udptl.c

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/test-this-branch/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr  5 13:50:45 2006
@@ -1,1 +1,1 @@
-/trunk:1-17620
+/trunk:1-17663

Modified: team/oej/test-this-branch/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/app.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/app.c (original)
+++ team/oej/test-this-branch/app.c Wed Apr  5 13:50:45 2006
@@ -1157,7 +1157,7 @@
 		return AST_LOCK_FAILURE;
 	}
 
-	snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
+	snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
 	fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
 	if (fd < 0) {
 		fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));

Modified: team/oej/test-this-branch/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_channelredirect.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_channelredirect.c (original)
+++ team/oej/test-this-branch/apps/app_channelredirect.c Wed Apr  5 13:50:45 2006
@@ -99,15 +99,16 @@
 		context = NULL;
 	}
 
-	if (!(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten),
-					     priority, chan2->cid.cid_num))) {
+	/* ast_findlabel_extension does not convert numeric priorities; it only does a lookup */
+	if (!(prio = atoi(priority)) && !(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context),
+									S_OR(exten, chan2->exten), priority, chan2->cid.cid_num))) {
 		ast_log(LOG_WARNING, "'%s' is not a known priority or label\n", priority);
 		goto chanquit;
 	}
 
-	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s\n", args.channel, args.label);
+	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
 
-	if (ast_async_goto_if_exists(chan2, context ? context : chan2->context, exten ? exten : chan2->exten, prio))
+	if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
 		ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);
 	else
 		res = 0;

Modified: team/oej/test-this-branch/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_page.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_page.c (original)
+++ team/oej/test-this-branch/apps/app_page.c Wed Apr  5 13:50:45 2006
@@ -143,7 +143,7 @@
 	char *tech, *resource;
 	char meetmeopts[80];
 	struct ast_flags flags = { 0 };
-	unsigned int confid = rand();
+	unsigned int confid = ast_random();
 	struct ast_app *app;
 	char *tmp;
 	int res=0;

Modified: team/oej/test-this-branch/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_queue.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_queue.c (original)
+++ team/oej/test-this-branch/apps/app_queue.c Wed Apr  5 13:50:45 2006
@@ -1992,7 +1992,7 @@
 		tmp->metric += mem->penalty * 1000000;
 		break;
 	case QUEUE_STRATEGY_RANDOM:
-		tmp->metric = rand() % 1000;
+		tmp->metric = ast_random() % 1000;
 		tmp->metric += mem->penalty * 1000000;
 		break;
 	case QUEUE_STRATEGY_FEWESTCALLS:
@@ -2241,7 +2241,7 @@
 			else {
 				/* Last ditch effort -- no CDR, make up something */
 				char tmpid[256];
-				snprintf(tmpid, sizeof(tmpid), "chan-%x", rand());
+				snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
 				ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
 			}
 			if (qe->parent->monjoin)

Modified: team/oej/test-this-branch/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/apps/app_voicemail.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/apps/app_voicemail.c (original)
+++ team/oej/test-this-branch/apps/app_voicemail.c Wed Apr  5 13:50:45 2006
@@ -1756,11 +1756,11 @@
 			fprintf(p, "Subject: New message %d in mailbox %s\n", msgnum + 1, mailbox);
 		else
 			fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox);
-		fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)rand(), mailbox, getpid(), host);
+		fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host);
 		fprintf(p, "MIME-Version: 1.0\n");
 		if (attach_user_voicemail) {
 			/* Something unique. */
-			snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)rand());
+			snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)ast_random());
 
 			fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 

Modified: team/oej/test-this-branch/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_agent.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_agent.c (original)
+++ team/oej/test-this-branch/channels/chan_agent.c Wed Apr  5 13:50:45 2006
@@ -924,7 +924,7 @@
 			tmp->rawreadformat = AST_FORMAT_SLINEAR;
 		}
 		if (p->pending)
-			ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, rand() & 0xffff);
+			ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
 		else
 			ast_string_field_build(tmp, name, "Agent/%s", p->agent);
 		/* Safe, agentlock already held */

Modified: team/oej/test-this-branch/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_iax2.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_iax2.c (original)
+++ team/oej/test-this-branch/channels/chan_iax2.c Wed Apr  5 13:50:45 2006
@@ -1300,7 +1300,7 @@
 		last++;
 	else
 		last = s;
-	snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)rand());
+	snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random());
 	res = stat(s, &stbuf);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno));
@@ -3261,7 +3261,7 @@
 	int res;
 	struct iax_ie_data ied0;
 	struct iax_ie_data ied1;
-	unsigned int transferid = rand();
+	unsigned int transferid = (unsigned int)ast_random();
 	memset(&ied0, 0, sizeof(ied0));
 	iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &iaxs[callno1]->addr);
 	iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[callno1]->peercallno);
@@ -3804,9 +3804,9 @@
 	ms = ast_tvdiff_ms(ast_tvnow(), p->rxcore);
 #ifdef IAXTESTS
 	if (test_jit) {
-		if (!test_jitpct || ((100.0 * rand() / (RAND_MAX + 1.0)) < test_jitpct)) {
-			jit = (int)((float)test_jit * rand() / (RAND_MAX + 1.0));
-			if ((int)(2.0 * rand() / (RAND_MAX + 1.0)))
+		if (!test_jitpct || ((100.0 * ast_random() / (RAND_MAX + 1.0)) < test_jitpct)) {
+			jit = (int)((float)test_jit * ast_random() / (RAND_MAX + 1.0));
+			if ((int)(2.0 * ast_random() / (RAND_MAX + 1.0)))
 				jit = -jit;
 			ms += jit;
 		}
@@ -5160,7 +5160,7 @@
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
 	if (p->authmethods & (IAX_AUTH_MD5 | IAX_AUTH_RSA)) {
-		snprintf(p->challenge, sizeof(p->challenge), "%d", rand());
+		snprintf(p->challenge, sizeof(p->challenge), "%d", (int)ast_random());
 		iax_ie_append_str(&ied, IAX_IE_CHALLENGE, p->challenge);
 	}
 	if (p->encmethods)
@@ -5983,7 +5983,7 @@
 		iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
 		if (p->authmethods & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
 			/* Build the challenge */
-			snprintf(iaxs[callno]->challenge, sizeof(iaxs[callno]->challenge), "%d", rand());
+			snprintf(iaxs[callno]->challenge, sizeof(iaxs[callno]->challenge), "%d", (int)ast_random());
 			iax_ie_append_str(&ied, IAX_IE_CHALLENGE, iaxs[callno]->challenge);
 		}
 		iax_ie_append_str(&ied, IAX_IE_USERNAME, name);
@@ -6531,7 +6531,7 @@
 			ASTOBJ_CONTAINER_LINK_END(&idlelist, thread);
 			return 1;
 		}
-		if (test_losspct && ((100.0*rand()/(RAND_MAX+1.0)) < test_losspct)) { /* simulate random loss condition */
+		if (test_losspct && ((100.0 * ast_random() / (RAND_MAX + 1.0)) < test_losspct)) { /* simulate random loss condition */
 			ASTOBJ_CONTAINER_LINK_END(&idlelist, thread); 
 			return 1;
 		}

Modified: team/oej/test-this-branch/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_local.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_local.c (original)
+++ team/oej/test-this-branch/channels/chan_local.c Wed Apr  5 13:50:45 2006
@@ -515,7 +515,7 @@
 static struct ast_channel *local_new(struct local_pvt *p, int state)
 {
 	struct ast_channel *tmp, *tmp2;
-	int randnum = rand() & 0xffff;
+	int randnum = ast_random() & 0xffff;
 
 	tmp = ast_channel_alloc(1);
 	tmp2 = ast_channel_alloc(1);

Modified: team/oej/test-this-branch/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_mgcp.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_mgcp.c (original)
+++ team/oej/test-this-branch/channels/chan_mgcp.c Wed Apr  5 13:50:45 2006
@@ -2616,7 +2616,7 @@
 	ast_rtp_set_data(p->rtp, p);
 #endif		
 	/* Make a call*ID */
-        snprintf(sub->callid, sizeof(sub->callid), "%08x%s", rand(), sub->txident);
+        snprintf(sub->callid, sizeof(sub->callid), "%08lx%s", ast_random(), sub->txident);
 	/* Transmit the connection create */
 	transmit_connect_with_sdp(sub, NULL);
 	ast_mutex_unlock(&sub->lock);
@@ -3785,7 +3785,7 @@
 					strncpy(e->language, language, sizeof(e->language) - 1);
 					strncpy(e->musicclass, musicclass, sizeof(e->musicclass) - 1);
 					strncpy(e->mailbox, mailbox, sizeof(e->mailbox) - 1);
-					snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08x", rand());
+					snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
 					e->msgstate = -1;
 					e->amaflags = amaflags;
 					e->capability = capability;
@@ -3811,7 +3811,7 @@
 					/* ASSUME we're onhook */
 					e->hookstate = MGCP_ONHOOK;
 					if (!ep_reload) {
-						/*snprintf(txident, sizeof(txident), "%08x", rand());*/
+						/*snprintf(txident, sizeof(txident), "%08lx", ast_random());*/
 						for (i = 0; i < MAX_SUBS; i++) {
 							sub = malloc(sizeof(struct mgcp_subchannel));
 							if (sub) {
@@ -3821,7 +3821,7 @@
 								ast_mutex_init(&sub->cx_queue_lock);
 								sub->parent = e;
 								sub->id = i;
-								snprintf(sub->txident, sizeof(sub->txident), "%08x", rand());
+								snprintf(sub->txident, sizeof(sub->txident), "%08lx", ast_random());
 								/*stnrcpy(sub->txident, txident, sizeof(sub->txident) - 1);*/
 								sub->cxmode = MGCP_CX_INACTIVE;
 								sub->nat = nat;
@@ -3916,7 +3916,7 @@
 						e->onhooktime = time(NULL);
 						/* ASSUME we're onhook */
 						e->hookstate = MGCP_ONHOOK;
-						snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08x", rand());
+						snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
 					}
 
 					for (i = 0, sub = NULL; i < MAX_SUBS; i++) {
@@ -3938,7 +3938,7 @@
 								strncpy(sub->magic, MGCP_SUBCHANNEL_MAGIC, sizeof(sub->magic) - 1);
 								sub->parent = e;
 								sub->id = i;
-								snprintf(sub->txident, sizeof(sub->txident), "%08x", rand());
+								snprintf(sub->txident, sizeof(sub->txident), "%08lx", ast_random());
 								sub->cxmode = MGCP_CX_INACTIVE;
 								sub->next = e->sub;
 								e->sub = sub;

Modified: team/oej/test-this-branch/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_sip.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_sip.c (original)
+++ team/oej/test-this-branch/channels/chan_sip.c Wed Apr  5 13:50:45 2006
@@ -480,8 +480,6 @@
 static struct ast_flags global_flags[2] = {{0}};	/*!< global SIP_ flags */
 
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
-
-AST_MUTEX_DEFINE_STATIC(rand_lock);			/*!< Lock for thread-safe random generator */
 
 /*! \brief Protect the SIP dialog list (of sip_pvt's) */
 AST_MUTEX_DEFINE_STATIC(iflock);
@@ -788,7 +786,7 @@
 	int callingpres;			/*!< Calling presentation */
 	int authtries;				/*!< Times we've tried to authenticate */
 	int expiry;				/*!< How long we take to expire */
-	int branch;				/*!< One random number */
+	long branch;				/*!< One random number */
 	char tag[11];				/*!< Another random number */
 	int sessionid;				/*!< SDP Session ID */
 	int sessionversion;			/*!< SDP Session Version */
@@ -1126,25 +1124,6 @@
 	get_udptl_info: sip_get_udptl_peer,
 	set_udptl_peer: sip_set_udptl_peer,
 };
-
-
-/*!
-  \brief Thread-safe random number generator
-  \return a random number
-
-  This function uses a mutex lock to guarantee that no
-  two threads will receive the same random number.
- */
-static force_inline int thread_safe_rand(void)
-{
-	int val;
-
-	ast_mutex_lock(&rand_lock);
-	val = rand();
-	ast_mutex_unlock(&rand_lock);
-	
-	return val;
-}
 
 /*! \brief Find SIP method from header
  * Strictly speaking, SIP methods are case SENSITIVE, but we don't check 
@@ -3094,7 +3073,7 @@
 	fmt = ast_best_codec(tmp->nativeformats);
 
 	if (title)
-		ast_string_field_build(tmp, name, "SIP/%s-%04x", title, thread_safe_rand() & 0xffff);
+		ast_string_field_build(tmp, name, "SIP/%s-%04lx", title, ast_random() & 0xffff);
 	else if (strchr(i->fromdomain,':'))
 		ast_string_field_build(tmp, name, "SIP/%s-%08x", strchr(i->fromdomain,':')+1, (int)(long)(i));
 	else
@@ -3397,12 +3376,12 @@
 /*! \brief Generate 32 byte random string for callid's etc */
 static char *generate_random_string(char *buf, size_t size)
 {
-	int val[4];
+	long val[4];
 	int x;
 
 	for (x=0; x<4; x++)
-		val[x] = thread_safe_rand();
-	snprintf(buf, size, "%08x%08x%08x%08x", val[0], val[1], val[2], val[3]);
+		val[x] = ast_random();
+	snprintf(buf, size, "%08lx%08lx%08lx%08lx", val[0], val[1], val[2], val[3]);
 
 	return buf;
 }
@@ -3433,7 +3412,7 @@
 /*! \brief Make our SIP dialog tag */
 static void make_our_tag(char *tagbuf, size_t len)
 {
-	snprintf(tagbuf, len, "as%08x", thread_safe_rand());
+	snprintf(tagbuf, len, "as%08lx", ast_random());
 }
 
 /*! \brief Allocate SIP_PVT structure and set defaults */
@@ -3476,7 +3455,7 @@
 	ast_copy_flags(&p->flags[0], &global_flags[0], SIP_FLAGS_TO_COPY);
 	ast_copy_flags(&p->flags[1], &global_flags[1], SIP_PAGE2_FLAGS_TO_COPY);
 
-	p->branch = thread_safe_rand();	
+	p->branch = ast_random();	
 	make_our_tag(p->tag, sizeof(p->tag));
 	/* Start with 101 instead of 1 */
 	p->ocseq = 101;
@@ -4681,7 +4660,7 @@
 	}
 	
 	if (newbranch) {
-		p->branch ^= thread_safe_rand();
+		p->branch ^= ast_random();
 		build_via(p);
 	}
 
@@ -5713,7 +5692,7 @@
 	req.method = sipmethod;
 	if (init) {
 		/* Bump branch even on initial requests */
-		p->branch ^= thread_safe_rand();
+		p->branch ^= ast_random();
 		build_via(p);
 		if (init > 1)
 			initreqprep(&req, p, sipmethod);
@@ -6292,7 +6271,7 @@
 		snprintf(addr, sizeof(addr), "sip:%s", r->hostname);
 	ast_string_field_set(p, uri, addr);
 
-	p->branch ^= thread_safe_rand();
+	p->branch ^= ast_random();
 
 	memset(&req, 0, sizeof(req));
 	init_req(&req, sipmethod, addr);
@@ -6564,7 +6543,7 @@
 		/* SIP isn't up yet, so schedule a poke only, pretty soon */
 		if (peer->pokeexpire > -1)
 			ast_sched_del(sched, peer->pokeexpire);
-		peer->pokeexpire = ast_sched_add(sched, thread_safe_rand() % 5000 + 1, sip_poke_peer_s, peer);
+		peer->pokeexpire = ast_sched_add(sched, ast_random() % 5000 + 1, sip_poke_peer_s, peer);
 	} else
 		sip_poke_peer(peer);
 	if (peer->expire > -1)
@@ -7022,7 +7001,7 @@
 		return 1;	/* Auth sent */
 	} else if (ast_strlen_zero(p->randdata) || ast_strlen_zero(authtoken)) {
 		/* We have no auth, so issue challenge and request authentication */
-		ast_string_field_build(p, randdata, "%08x", thread_safe_rand());	/* Create nonce for challenge */
+		ast_string_field_build(p, randdata, "%08lx", ast_random());	/* Create nonce for challenge */
 		transmit_response_with_auth(p, response, req, p->randdata, reliable, respheader, 0);
 		/* Schedule auto destroy in 32 seconds */
 		sip_scheddestroy(p, 32000);
@@ -7112,7 +7091,7 @@
 		good_response = keys[K_RESP].s &&
 				!strncasecmp(keys[K_RESP].s, resp_hash, strlen(resp_hash));
 		if (wrongnonce) {
-			ast_string_field_build(p, randdata, "%08x", thread_safe_rand());
+			ast_string_field_build(p, randdata, "%08lx", ast_random());
 			if (good_response) {
 				if (sipdebug)
 					ast_log(LOG_NOTICE, "stale nonce received from '%s'\n", get_header(req, "To"));
@@ -9987,7 +9966,7 @@
 	else
 		snprintf(uri, sizeof(uri), "sip:%s@%s",p->username, ast_inet_ntoa(iabuf, sizeof(iabuf), p->sa.sin_addr));
 
-	snprintf(cnonce, sizeof(cnonce), "%08x", thread_safe_rand());
+	snprintf(cnonce, sizeof(cnonce), "%08lx", ast_random());
 
  	/* Check if we have separate auth credentials */
  	if ((auth = find_realm_authentication(authl, p->realm))) {

Modified: team/oej/test-this-branch/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/channels/chan_zap.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/channels/chan_zap.c (original)
+++ team/oej/test-this-branch/channels/chan_zap.c Wed Apr  5 13:50:45 2006
@@ -5242,7 +5242,7 @@
 			else
 #endif
 			if (i->channel == CHAN_PSEUDO)
-				ast_string_field_build(tmp, name, "Zap/pseudo-%d", rand());
+				ast_string_field_build(tmp, name, "Zap/pseudo-%d", ast_random());
 			else	
 				ast_string_field_build(tmp, name, "Zap/%d-%d", i->channel, y);
 			for (x=0;x<3;x++) {

Modified: team/oej/test-this-branch/formats/format_ogg_vorbis.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/formats/format_ogg_vorbis.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/formats/format_ogg_vorbis.c (original)
+++ team/oej/test-this-branch/formats/format_ogg_vorbis.c Wed Apr  5 13:50:45 2006
@@ -219,7 +219,7 @@
 	vorbis_analysis_init(&tmp->vd, &tmp->vi);
 	vorbis_block_init(&tmp->vd, &tmp->vb);
 
-	ogg_stream_init(&tmp->os, rand());
+	ogg_stream_init(&tmp->os, ast_random());
 
 	vorbis_analysis_headerout(&tmp->vd, &tmp->vc, &header, &header_comm,
 				  &header_code);

Modified: team/oej/test-this-branch/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/manager.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/manager.c (original)
+++ team/oej/test-this-branch/manager.c Wed Apr  5 13:50:45 2006
@@ -1802,7 +1802,7 @@
 			authtype = astman_get_header(m, "AuthType");
 			if (!strcasecmp(authtype, "MD5")) {
 				if (ast_strlen_zero(s->challenge))
-					snprintf(s->challenge, sizeof(s->challenge), "%d", rand());
+					snprintf(s->challenge, sizeof(s->challenge), "%ld", ast_random());
 				ast_mutex_lock(&s->__lock);
 				astman_append(s, "Response: Success\r\n"
 						"%s"

Modified: team/oej/test-this-branch/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/pbx/pbx_dundi.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/pbx/pbx_dundi.c (original)
+++ team/oej/test-this-branch/pbx/pbx_dundi.c Wed Apr  5 13:50:45 2006
@@ -440,7 +440,7 @@
 static int get_trans_id(void)
 {
 	struct dundi_transaction *t;
-	int stid = (rand() % 32766) + 1;
+	int stid = (ast_random() % 32766) + 1;
 	int tid = stid;
 	do {
 		t = alltrans;
@@ -493,7 +493,7 @@
 	int x;
 	fluffy = (unsigned int *)(iv);
 	for (x=0;x<4;x++)
-		fluffy[x] = rand();
+		fluffy[x] = ast_random();
 }
 
 struct dundi_query_state {

Modified: team/oej/test-this-branch/res/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/Makefile?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/res/Makefile (original)
+++ team/oej/test-this-branch/res/Makefile Wed Apr  5 13:50:45 2006
@@ -43,7 +43,6 @@
   endif
 endif
 
-
 ifeq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include $(CROSS_COMPILE_TARGET)/usr/include/pgsql $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql $(CROSS_COMPILE_TARGET)/opt/pgsql/include $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
   MODS:=$(filter-out res_config_pgsql.so,$(MODS))
 endif
@@ -102,6 +101,8 @@
   MLFLAGS+=-L$(CROSS_COMPILE_TARGET)/usr/lib
 endif
 
+
+MLFLAGS=
 
 ifeq (${OSARCH},CYGWIN)
   CYGSOLINK=-Wl,--out-implib=lib$@.a -Wl,--export-all-symbols
@@ -187,7 +188,6 @@
 	$(CC) $(SOLINK) -o $@ ${CYGSOLINK} $< ${CYGSOLIB} -lpq -lz $(MLFLAGS)
 
 
-
 ifneq ($(wildcard .depend),)
   include .depend
 endif

Modified: team/oej/test-this-branch/res/res_musiconhold.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/res/res_musiconhold.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/res/res_musiconhold.c (original)
+++ team/oej/test-this-branch/res/res_musiconhold.c Wed Apr  5 13:50:45 2006
@@ -208,7 +208,7 @@
 			}
 
 			if (ast_test_flag(state->class, MOH_RANDOMIZE))
-				state->pos = rand();
+				state->pos = ast_random();
 
 			/* check to see if this file's format can be opened */
 			if (ast_fileexists(state->class->filearray[state->pos], NULL, NULL) != -1)

Modified: team/oej/test-this-branch/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/rtp.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/rtp.c (original)
+++ team/oej/test-this-branch/rtp.c Wed Apr  5 13:50:45 2006
@@ -1294,8 +1294,8 @@
 	rtp->them.sin_family = AF_INET;
 	rtp->us.sin_family = AF_INET;
 	rtp->s = rtp_socket();
-	rtp->ssrc = rand();
-	rtp->seqno = rand() & 0xffff;
+	rtp->ssrc = ast_random();
+	rtp->seqno = ast_random() & 0xffff;
 	if (rtp->s < 0) {
 		free(rtp);
 		ast_log(LOG_ERROR, "Unable to allocate socket: %s\n", strerror(errno));
@@ -1307,7 +1307,7 @@
 	}
 	
 	/* Select a random port number in the range of possible RTP */
-	x = (rand() % (rtpend-rtpstart)) + rtpstart;
+	x = (ast_random() % (rtpend-rtpstart)) + rtpstart;
 	x = x & ~1;
 	/* Save it for future references. */
 	startplace = x;

Modified: team/oej/test-this-branch/udptl.c
URL: http://svn.digium.com/view/asterisk/team/oej/test-this-branch/udptl.c?rev=17664&r1=17663&r2=17664&view=diff
==============================================================================
--- team/oej/test-this-branch/udptl.c (original)
+++ team/oej/test-this-branch/udptl.c Wed Apr  5 13:50:45 2006
@@ -794,7 +794,7 @@
 		udptl->tx[i].buf_len = -1;
 	}
 
-	udptl->seqno = rand() & 0xffff;
+	udptl->seqno = ast_random() & 0xffff;
 	udptl->them.sin_family = AF_INET;
 	udptl->us.sin_family = AF_INET;
 
@@ -810,7 +810,7 @@
 		setsockopt(udptl->fd, SOL_SOCKET, SO_NO_CHECK, &nochecksums, sizeof(nochecksums));
 #endif
 	/* Find us a place */
-	x = (rand()%(udptlend - udptlstart)) + udptlstart;
+	x = (ast_random() % (udptlend - udptlstart)) + udptlstart;
 	startplace = x;
 	for (;;) {
 		udptl->us.sin_port = htons(x);



More information about the svn-commits mailing list