[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step3 r303903 - in /team/dvossel/f...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jan 25 14:08:27 CST 2011


Author: dvossel
Date: Tue Jan 25 14:08:21 2011
New Revision: 303903

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=303903
Log:
Changes ast_format_cap_copy to dup, and copy2 to copy

Modified:
    team/dvossel/fixtheworld_phase1_step3/addons/chan_ooh323.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_gtalk.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_h323.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_iax2.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_jingle.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_local.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_mgcp.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_phone.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_skinny.c
    team/dvossel/fixtheworld_phase1_step3/channels/chan_unistim.c
    team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h
    team/dvossel/fixtheworld_phase1_step3/main/channel.c
    team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
    team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c
    team/dvossel/fixtheworld_phase1_step3/main/translate.c
    team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c

Modified: team/dvossel/fixtheworld_phase1_step3/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/addons/chan_ooh323.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/addons/chan_ooh323.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/addons/chan_ooh323.c Tue Jan 25 14:08:21 2011
@@ -535,7 +535,7 @@
 	ast_copy_string(pvt->accountcode, gAccountcode, sizeof(pvt->accountcode));
 
 	pvt->amaflags = gAMAFLAGS;
-	ast_format_cap_copy2(pvt->cap, gCap);
+	ast_format_cap_copy(pvt->cap, gCap);
 	memcpy(&pvt->prefs, &gPrefs, sizeof(pvt->prefs));
 
 	ast_mutex_unlock(&pvt->lock); 
@@ -636,7 +636,7 @@
 		if (ext)
 			ast_copy_string(p->exten, ext, sizeof(p->exten));
 
-		ast_format_cap_copy2(p->cap, peer->cap);
+		ast_format_cap_copy(p->cap, peer->cap);
 		memcpy(&p->prefs, &peer->prefs, sizeof(struct ast_codec_pref));
 		p->dtmfmode |= peer->dtmfmode;
 		p->dtmfcodec  = peer->dtmfcodec;
@@ -670,7 +670,7 @@
 		p->dtmfcodec = gDTMFCodec;
 		p->t38support = gT38Support;
 		p->rtptimeout = gRTPTimeout;
-		ast_format_cap_copy2(p->cap, gCap);
+		ast_format_cap_copy(p->cap, gCap);
 		p->rtdrinterval = gRTDRInterval;
 		p->rtdrcount = gRTDRCount;
 		p->faststart = gFastStart;
@@ -1763,7 +1763,7 @@
 		ast_copy_string(p->context, user->context, sizeof(p->context));
 		ast_copy_string(p->accountcode, user->accountcode, sizeof(p->accountcode));
 		p->amaflags = user->amaflags;
-		ast_format_cap_copy2(p->cap, user->cap);
+		ast_format_cap_copy(p->cap, user->cap);
 		memcpy(&p->prefs, &user->prefs, sizeof(struct ast_codec_pref));
 		p->dtmfmode |= user->dtmfmode;
 		p->dtmfcodec = user->dtmfcodec;
@@ -2187,7 +2187,7 @@
 		memset(user, 0, sizeof(struct ooh323_user));
 		ast_mutex_init(&user->lock);
 		ast_copy_string(user->name, name, sizeof(user->name));
-		ast_format_cap_copy2(user->cap, gCap);
+		ast_format_cap_copy(user->cap, gCap);
 		memcpy(&user->prefs, &gPrefs, sizeof(user->prefs));
 		user->rtptimeout = gRTPTimeout;
 		user->dtmfmode = gDTMFMode;
@@ -2300,7 +2300,7 @@
 		memset(peer, 0, sizeof(struct ooh323_peer));
 		ast_mutex_init(&peer->lock);
 		ast_copy_string(peer->name, name, sizeof(peer->name));
-		ast_format_cap_copy2(peer->cap, gCap);
+		ast_format_cap_copy(peer->cap, gCap);
       		memcpy(&peer->prefs, &gPrefs, sizeof(peer->prefs));
 		peer->rtptimeout = gRTPTimeout;
 		ast_copy_string(peer->accountcode, gAccountcode, sizeof(peer->accountcode));

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_agent.c Tue Jan 25 14:08:21 2011
@@ -301,7 +301,7 @@
 			char tmp1[256], tmp2[256]; \
 			ast_debug(1, "Native formats changing from '%s' to '%s'\n", ast_getformatname_multiple(tmp1, sizeof(tmp1), ast->nativeformats), ast_getformatname_multiple(tmp2, sizeof(tmp2), p->chan->nativeformats)); \
 			/* Native formats changed, reset things */ \
-			ast_format_cap_copy2(ast->nativeformats, p->chan->nativeformats); \
+			ast_format_cap_copy(ast->nativeformats, p->chan->nativeformats); \
 			ast_debug(1, "Resetting read to '%s' and write to '%s'\n", ast_getformatname(&ast->readformat), ast_getformatname(&ast->writeformat));\
 			ast_set_read_format(ast, &ast->readformat); \
 			ast_set_write_format(ast, &ast->writeformat); \
@@ -1056,7 +1056,7 @@
 
 	tmp->tech = &agent_tech;
 	if (p->chan) {
-		ast_format_cap_copy2(tmp->nativeformats, p->chan->nativeformats);
+		ast_format_cap_copy(tmp->nativeformats, p->chan->nativeformats);
 		ast_format_copy(&tmp->writeformat, &p->chan->writeformat);
 		ast_format_copy(&tmp->rawwriteformat, &p->chan->writeformat);
 		ast_format_copy(&tmp->readformat, &p->chan->readformat);

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_gtalk.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_gtalk.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_gtalk.c Tue Jan 25 14:08:21 2011
@@ -555,7 +555,7 @@
 {
 	struct gtalk_pvt *p = chan->tech_pvt;
 	ast_mutex_lock(&p->lock);
-	ast_format_cap_copy2(result, p->peercap);
+	ast_format_cap_copy(result, p->peercap);
 	ast_mutex_unlock(&p->lock);
 }
 
@@ -1066,9 +1066,9 @@
 
 	/* add user configured codec capabilites */
 	if (!(ast_format_cap_is_empty(client->cap))) {
-		ast_format_cap_copy2(tmp->cap, client->cap);
+		ast_format_cap_copy(tmp->cap, client->cap);
 	} else if (!(ast_format_cap_is_empty(global_capability))) {
-		ast_format_cap_copy2(tmp->cap, global_capability);
+		ast_format_cap_copy(tmp->cap, global_capability);
 	}
 
 	tmp->parent = client;

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_h323.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_h323.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_h323.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_h323.c Tue Jan 25 14:08:21 2011
@@ -2072,7 +2072,7 @@
 					char tmp[256], tmp2[256];
 					ast_debug(1, "Native format changed to '%s' from '%s', read format is %s, write format is %s\n", ast_getformatname_multiple(tmp, sizeof(tmp), pvt_native), ast_getformatname_multiple(tmp2, sizeof(tmp2), pvt->owner->nativeformats), ast_getformatname(&pvt->owner->readformat), ast_getformatname(&pvt->owner->writeformat));
 				}
-				ast_format_cap_copy2(pvt->owner->nativeformats, pvt_native);
+				ast_format_cap_copy(pvt->owner->nativeformats, pvt_native);
 				ast_set_read_format(pvt->owner, &pvt->owner->readformat);
 				ast_set_write_format(pvt->owner, &pvt->owner->writeformat);
 			}

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_iax2.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_iax2.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_iax2.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_iax2.c Tue Jan 25 14:08:21 2011
@@ -10368,7 +10368,7 @@
 						iax2_lock_owner(fr->callno);
 						if (iaxs[fr->callno]) {
 							if (iaxs[fr->callno]->owner) {
-								struct ast_format_cap *orignative = ast_format_cap_copy(iaxs[fr->callno]->owner->nativeformats);
+								struct ast_format_cap *orignative = ast_format_cap_dup(iaxs[fr->callno]->owner->nativeformats);
 								struct ast_format_cap *native = iaxs[fr->callno]->owner->nativeformats;
 								if (orignative) {
 									ast_format_cap_remove_all(native);
@@ -10376,7 +10376,7 @@
 									if (iaxs[fr->callno]->owner->readformat.id) {
 										ast_set_read_format(iaxs[fr->callno]->owner, &iaxs[fr->callno]->owner->readformat);
 									}
-									ast_format_cap_copy2(native, orignative);
+									ast_format_cap_copy(native, orignative);
 									ast_channel_unlock(iaxs[fr->callno]->owner);
 									orignative = ast_format_cap_destroy(orignative);
 								}
@@ -12164,7 +12164,7 @@
 
 		/* Choose a format we can live with */
 		if ((joint = ast_format_cap_joint(c->nativeformats, cap))) {
-			ast_format_cap_copy2(c->nativeformats, joint);
+			ast_format_cap_copy(c->nativeformats, joint);
 			joint = ast_format_cap_destroy(joint);
 		} else {
 			struct ast_format best_fmt_cap;

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_jingle.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_jingle.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_jingle.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_jingle.c Tue Jan 25 14:08:21 2011
@@ -410,7 +410,7 @@
 {
 	struct jingle_pvt *p = chan->tech_pvt;
 	ast_mutex_lock(&p->lock);
-	ast_format_cap_copy2(result, p->peercap);
+	ast_format_cap_copy(result, p->peercap);
 	ast_mutex_unlock(&p->lock);
 }
 
@@ -1492,7 +1492,7 @@
 	}
 
 	ast_setstate(ast, AST_STATE_RING);
-	ast_format_cap_copy2(p->jointcap, p->cap);
+	ast_format_cap_copy(p->jointcap, p->cap);
 	if (!p->ringrule) {
 		ast_copy_string(p->ring, p->parent->connection->mid, sizeof(p->ring));
 		p->ringrule = iks_filter_add_rule(p->parent->connection->f, jingle_ringing_ack, p,

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_local.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_local.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_local.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_local.c Tue Jan 25 14:08:21 2011
@@ -962,7 +962,7 @@
 	if (!(tmp = ao2_alloc(sizeof(*tmp), NULL))) {
 		return NULL;
 	}
-	if (!(tmp->reqcap = ast_format_cap_copy(cap))) {
+	if (!(tmp->reqcap = ast_format_cap_dup(cap))) {
 		ao2_ref(tmp, -1);
 		return NULL;
 	}

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_mgcp.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_mgcp.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_mgcp.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_mgcp.c Tue Jan 25 14:08:21 2011
@@ -1494,9 +1494,9 @@
 	tmp = ast_channel_alloc(1, state, i->cid_num, i->cid_name, linkedid, i->accountcode, i->exten, i->context, i->amaflags, "MGCP/%s@%s-%d", i->name, i->parent->name, sub->id);
 	if (tmp) {
 		tmp->tech = &mgcp_tech;
-		ast_format_cap_copy2(tmp->nativeformats, i->cap);
+		ast_format_cap_copy(tmp->nativeformats, i->cap);
 		if (ast_format_cap_is_empty(tmp->nativeformats)) {
-			ast_format_cap_copy2(tmp->nativeformats, global_capability);
+			ast_format_cap_copy(tmp->nativeformats, global_capability);
 		}
 		if (sub->rtp) {
 			ast_channel_set_fd(tmp, 0, ast_rtp_instance_fd(sub->rtp, 0));
@@ -4184,7 +4184,7 @@
 				snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
 				e->msgstate = -1;
 				e->amaflags = amaflags;
-				ast_format_cap_copy2(e->cap, global_capability);
+				ast_format_cap_copy(e->cap, global_capability);
 				e->parent = gw;
 				e->ncs = ncs;
 				e->dtmfmode = dtmfmode;
@@ -4288,7 +4288,7 @@
 					e->parent = gw;
 				}
 				e->amaflags = amaflags;
-				ast_format_cap_copy2(e->cap, global_capability);
+				ast_format_cap_copy(e->cap, global_capability);
 				e->dtmfmode = dtmfmode;
 				e->ncs = ncs;
 				e->pktcgatealloc = pktcgatealloc;
@@ -4444,7 +4444,7 @@
 {
 	struct mgcp_subchannel *sub = chan->tech_pvt;
 	struct mgcp_endpoint *p = sub->parent;
-	ast_format_cap_copy2(result, p->cap);
+	ast_format_cap_copy(result, p->cap);
 }
 
 static struct ast_rtp_glue mgcp_rtp_glue = {

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_phone.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_phone.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_phone.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_phone.c Tue Jan 25 14:08:21 2011
@@ -866,7 +866,7 @@
 				ast_format_cap_remove(prefcap, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
 			}
 		} else {
-			ast_format_cap_copy2(tmp->nativeformats, prefcap);
+			ast_format_cap_copy(tmp->nativeformats, prefcap);
 			ast_best_codec(tmp->nativeformats, &tmpfmt);
 			ast_format_copy(&tmp->rawreadformat, &tmpfmt);
 			ast_format_copy(&tmp->rawwriteformat, &tmpfmt);
@@ -1378,7 +1378,7 @@
 	if (!(prefcap = ast_format_cap_alloc())) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
-	ast_format_cap_copy2(prefcap, phone_tech.capabilities);
+	ast_format_cap_copy(prefcap, phone_tech.capabilities);
 	if (!(phone_tech_fxs.capabilities = ast_format_cap_alloc())) {
 		return AST_MODULE_LOAD_DECLINE;
 	}
@@ -1479,7 +1479,7 @@
 	ast_mutex_unlock(&iflock);
 
 	if (mode == MODE_FXS) {
-		ast_format_cap_copy2(phone_tech_fxs.capabilities, prefcap);
+		ast_format_cap_copy(phone_tech_fxs.capabilities, prefcap);
 		cur_tech = &phone_tech_fxs;
 	} else
 		cur_tech = (struct ast_channel_tech *) &phone_tech;

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_sip.c Tue Jan 25 14:08:21 2011
@@ -6591,7 +6591,7 @@
 	}
 
 	/* Set the native formats */
-	ast_format_cap_copy2(tmp->nativeformats, what);
+	ast_format_cap_copy(tmp->nativeformats, what);
 	/* choose and use only the best audio format for our native formats */
 	ast_codec_choose(&i->prefs, tmp->nativeformats, 1, &fmt); /* get the best audio format */
 	ast_format_cap_remove_bytype(tmp->nativeformats, AST_FORMAT_TYPE_AUDIO); /* remove only the other audio formats */
@@ -8684,8 +8684,8 @@
 			}
 			/* We are now ready to change the sip session and p->rtp and p->vrtp with the offered codecs, since
 			   they are acceptable */
-			ast_format_cap_copy2(p->jointcaps, newjointcapability);                /* Our joint codec profile for this call */
-			ast_format_cap_copy2(p->peercaps, newpeercapability);                  /* The other sides capability in latest offer */
+			ast_format_cap_copy(p->jointcaps, newjointcapability);                /* Our joint codec profile for this call */
+			ast_format_cap_copy(p->peercaps, newpeercapability);                  /* The other sides capability in latest offer */
 			p->jointnoncodeccapability = newnoncodeccapability;     /* DTMF capabilities */
 
 			if (ast_test_flag(&p->flags[1], SIP_PAGE2_PREFERRED_CODEC)) { /* respond with single most preferred joint codec, limiting the other side's choice */
@@ -10793,7 +10793,7 @@
 			hold = "a=sendrecv\r\n";
 		}
 
-		ast_format_cap_copy2(tmpcap, p->jointcaps);
+		ast_format_cap_copy(tmpcap, p->jointcaps);
 
 		/* XXX note, Video and Text are negated - 'true' means 'no' */
 		ast_debug(1, "** Our capability: %s Video flag: %s Text flag: %s\n", ast_getformatname_multiple(codecbuf, sizeof(codecbuf), tmpcap),
@@ -15297,8 +15297,8 @@
 		p->amaflags = peer->amaflags;
 		p->callgroup = peer->callgroup;
 		p->pickupgroup = peer->pickupgroup;
-		ast_format_cap_copy2(p->caps, peer->caps);
-		ast_format_cap_copy2(p->jointcaps, peer->caps);
+		ast_format_cap_copy(p->caps, peer->caps);
+		ast_format_cap_copy(p->jointcaps, peer->caps);
 		p->prefs = peer->prefs;
  		if (peer->maxforwards > 0) {
 			p->maxforwards = peer->maxforwards;
@@ -21531,7 +21531,7 @@
 				}
 				ast_queue_control(p->owner, AST_CONTROL_SRCUPDATE);
 			} else {
-				ast_format_cap_copy2(p->jointcaps, p->caps);
+				ast_format_cap_copy(p->jointcaps, p->caps);
 				ast_debug(1, "Hm....  No sdp for the moment\n");
 				/* Some devices signal they want to be put off hold by sending a re-invite
 				   *without* an SDP, which is supposed to mean "Go back to your state"
@@ -21613,7 +21613,7 @@
 				goto request_invite_cleanup;
 			}
 		} else {	/* No SDP in invite, call control session */
-			ast_format_cap_copy2(p->jointcaps, p->caps);
+			ast_format_cap_copy(p->jointcaps, p->caps);
 			ast_debug(2, "No SDP in Invite, third party call control\n");
 		}
 
@@ -25958,7 +25958,7 @@
 	ast_string_field_set(peer, engine, default_engine);
 	ast_sockaddr_setnull(&peer->addr);
 	ast_sockaddr_setnull(&peer->defaddr);
-	ast_format_cap_copy2(peer->caps, sip_cfg.caps);
+	ast_format_cap_copy(peer->caps, sip_cfg.caps);
 	peer->maxcallbitrate = default_maxcallbitrate;
 	peer->rtptimeout = global_rtptimeout;
 	peer->rtpholdtimeout = global_rtpholdtimeout;
@@ -28030,7 +28030,7 @@
 		changed = 1;
 	}
 	if (cap && !(ast_format_cap_is_empty(cap) && !(ast_format_cap_identical(p->redircaps, cap)))) {
-		ast_format_cap_copy2(p->redircaps, cap);
+		ast_format_cap_copy(p->redircaps, cap);
 		changed = 1;
 	}
 	if (changed && !ast_test_flag(&p->flags[0], SIP_GOTREFER) && !ast_test_flag(&p->flags[0], SIP_DEFER_BYE_ON_TRANSFER)) {

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_skinny.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_skinny.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_skinny.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_skinny.c Tue Jan 25 14:08:21 2011
@@ -4674,10 +4674,10 @@
 		}
 		tmp->tech = &skinny_tech;
 		tmp->tech_pvt = sub;
-		ast_format_cap_copy2(tmp->nativeformats, l->cap);
+		ast_format_cap_copy(tmp->nativeformats, l->cap);
 		if (!tmp->nativeformats) {
 			// Should throw an error
-			ast_format_cap_copy2(tmp->nativeformats, default_cap);
+			ast_format_cap_copy(tmp->nativeformats, default_cap);
 		}
 		ast_best_codec(tmp->nativeformats, &tmpfmt);
 		if (skinnydebug) {
@@ -7218,7 +7218,7 @@
 	bindaddr.sin_family = AF_INET;
 
 	/* load the lines sections */
-	ast_format_cap_copy2(default_line->confcap, default_cap);
+	ast_format_cap_copy(default_line->confcap, default_cap);
 	default_line->confprefs = default_prefs;
 	config_parse_variables(TYPE_DEF_LINE, default_line, ast_variable_browse(cfg, "lines"));
 	cat = ast_category_browse(cfg, "lines");
@@ -7228,7 +7228,7 @@
 	}
 		
 	/* load the devices sections */
-	ast_format_cap_copy2(default_device->confcap, default_cap);
+	ast_format_cap_copy(default_device->confcap, default_cap);
 	default_device->confprefs = default_prefs;
 	config_parse_variables(TYPE_DEF_DEVICE, default_device, ast_variable_browse(cfg, "devices"));
 	cat = ast_category_browse(cfg, "devices");

Modified: team/dvossel/fixtheworld_phase1_step3/channels/chan_unistim.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/channels/chan_unistim.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/channels/chan_unistim.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/channels/chan_unistim.c Tue Jan 25 14:08:21 2011
@@ -4552,9 +4552,9 @@
 		return NULL;
 	}
 
-	ast_format_cap_copy2(tmp->nativeformats, l->cap);
+	ast_format_cap_copy(tmp->nativeformats, l->cap);
 	if (ast_format_cap_is_empty(tmp->nativeformats))
-		ast_format_cap_copy2(tmp->nativeformats, global_cap);
+		ast_format_cap_copy(tmp->nativeformats, global_cap);
 	ast_best_codec(tmp->nativeformats, &tmpfmt);
 	if (unistimdebug) {
 		char tmp1[256], tmp2[256], tmp3[256];
@@ -4769,7 +4769,7 @@
 		*cause = AST_CAUSE_BUSY;
 		return NULL;
 	}
-	ast_format_cap_copy2(sub->parent->cap, cap);
+	ast_format_cap_copy(sub->parent->cap, cap);
 	tmpc = unistim_new(sub, AST_STATE_DOWN, requestor ? requestor->linkedid : NULL);
 	if (!tmpc)
 		ast_log(LOG_WARNING, "Unable to make channel for '%s'\n", tmp);
@@ -5305,7 +5305,7 @@
 					ast_verb(3, "Setting mailbox '%s' on %s@%s\n", l->mailbox, d->name, l->name);
 			}
 
-			ast_format_cap_copy2(l->cap, global_cap);
+			ast_format_cap_copy(l->cap, global_cap);
 			l->parent = d;
 
 			if (create) {
@@ -5673,7 +5673,7 @@
 
 	ast_format_cap_add(global_cap, ast_format_set(&tmpfmt, AST_FORMAT_ULAW, 0));
 	ast_format_cap_add(global_cap, ast_format_set(&tmpfmt, AST_FORMAT_ALAW, 0));
-	ast_format_cap_copy2(unistim_tech.capabilities, global_cap);
+	ast_format_cap_copy(unistim_tech.capabilities, global_cap);
 	if (!(buff = ast_malloc(SIZE_PAGE)))
 		goto buff_failed;
 

Modified: team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h (original)
+++ team/dvossel/fixtheworld_phase1_step3/include/asterisk/format_cap.h Tue Jan 25 14:08:21 2011
@@ -98,15 +98,15 @@
  * \brief Copy all items in src to dst.
  * \note any items in dst will be removed before copying
  */
-void ast_format_cap_copy2(struct ast_format_cap *dst, const struct ast_format_cap *src);
+void ast_format_cap_copy(struct ast_format_cap *dst, const struct ast_format_cap *src);
 
 /*!
  * \brief create a deep copy of an ast_format_cap structure
  *
- * \retval cap on success, New capabilities structure is allocated with _NO_ locking enabled.
+ * \retval cap on success
  * \retval NULL on failure
  */
-struct ast_format_cap *ast_format_cap_copy(const struct ast_format_cap *src);
+struct ast_format_cap *ast_format_cap_dup(const struct ast_format_cap *src);
 
 /*!
  * \brief determine if a capabilities structure is empty or not

Modified: team/dvossel/fixtheworld_phase1_step3/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/channel.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/channel.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/channel.c Tue Jan 25 14:08:21 2011
@@ -5545,7 +5545,7 @@
 		 * purposes is used for the request. This needs to be re-evaluated.  It may be
 		 * a better choice to send all the audio formats capable of being translated
 		 * during the request and allow the channel drivers to pick the best one. */
-		if (!(joint_cap = ast_format_cap_copy(request_cap))) {
+		if (!(joint_cap = ast_format_cap_dup(request_cap))) {
 			return NULL;
 		}
 		ast_format_cap_remove_bytype(joint_cap, AST_FORMAT_TYPE_AUDIO);
@@ -6620,7 +6620,7 @@
 	ast_channel_set_fd(original, AST_TIMING_FD, original->timingfd);
 
 	/* Our native formats are different now */
-	ast_format_cap_copy2(original->nativeformats, clonechan->nativeformats);
+	ast_format_cap_copy(original->nativeformats, clonechan->nativeformats);
 
 	/* Context, extension, priority, app data, jump table,  remain the same */
 	/* pvt switches.  pbx stays the same, as does next */
@@ -6897,8 +6897,8 @@
 	int jb_in_use;
 	int to;
 
-	o0nativeformats = ast_format_cap_copy(c0->nativeformats);
-	o1nativeformats = ast_format_cap_copy(c1->nativeformats);
+	o0nativeformats = ast_format_cap_dup(c0->nativeformats);
+	o1nativeformats = ast_format_cap_dup(c1->nativeformats);
 
 	if (!o0nativeformats || !o1nativeformats) {
 		ast_format_cap_destroy(o0nativeformats); /* NULL safe */
@@ -7216,8 +7216,8 @@
 	    ast_test_flag(c1, AST_FLAG_ZOMBIE) || ast_check_hangup_locked(c1))
 		return -1;
 
-	o0nativeformats = ast_format_cap_copy(c0->nativeformats);
-	o1nativeformats = ast_format_cap_copy(c1->nativeformats);
+	o0nativeformats = ast_format_cap_dup(c0->nativeformats);
+	o1nativeformats = ast_format_cap_dup(c1->nativeformats);
 	if (!o0nativeformats || !o1nativeformats) {
 		ast_format_cap_destroy(o0nativeformats);
 		ast_format_cap_destroy(o1nativeformats);
@@ -7430,8 +7430,8 @@
 				return AST_BRIDGE_FAILED;
 			}
 
-			ast_format_cap_copy2(o0nativeformats, c0->nativeformats);
-			ast_format_cap_copy2(o1nativeformats, c1->nativeformats);
+			ast_format_cap_copy(o0nativeformats, c0->nativeformats);
+			ast_format_cap_copy(o1nativeformats, c1->nativeformats);
 		}
 
 		update_bridge_vars(c0, c1);

Modified: team/dvossel/fixtheworld_phase1_step3/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/format_cap.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/format_cap.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/format_cap.c Tue Jan 25 14:08:21 2011
@@ -170,15 +170,20 @@
 	return 0;
 }
 
-void ast_format_cap_copy2(struct ast_format_cap *dst, const struct ast_format_cap *src)
+void ast_format_cap_copy(struct ast_format_cap *dst, const struct ast_format_cap *src)
 {
 	ast_format_cap_remove_all(dst);
 	ao2_callback(src->formats, OBJ_NODATA | src->nolock, copy_cb, dst);
 }
 
-struct ast_format_cap *ast_format_cap_copy(const struct ast_format_cap *cap)
-{
-	struct ast_format_cap *dst = ast_format_cap_alloc_nolock();
+struct ast_format_cap *ast_format_cap_dup(const struct ast_format_cap *cap)
+{
+	struct ast_format_cap *dst;
+	if (cap->nolock) {
+		dst = ast_format_cap_alloc_nolock();
+	} else {
+		dst = ast_format_cap_alloc();
+	}
 	if (!dst) {
 		return NULL;
 	}

Modified: team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/rtp_engine.c Tue Jan 25 14:08:21 2011
@@ -1026,8 +1026,8 @@
 {
 	enum ast_bridge_result res = AST_BRIDGE_FAILED;
 	struct ast_channel *who = NULL, *other = NULL, *cs[3] = { NULL, };
-	struct ast_format_cap *oldcap0 = ast_format_cap_copy(cap0);
-	struct ast_format_cap *oldcap1 = ast_format_cap_copy(cap1);
+	struct ast_format_cap *oldcap0 = ast_format_cap_dup(cap0);
+	struct ast_format_cap *oldcap1 = ast_format_cap_dup(cap1);
 	struct ast_sockaddr ac1 = {{0,}}, vac1 = {{0,}}, tac1 = {{0,}}, ac0 = {{0,}}, vac0 = {{0,}}, tac0 = {{0,}};
 	struct ast_sockaddr t1 = {{0,}}, vt1 = {{0,}}, tt1 = {{0,}}, t0 = {{0,}}, vt0 = {{0,}}, tt0 = {{0,}};
 	struct ast_frame *fr = NULL;
@@ -1144,7 +1144,7 @@
 			ast_sockaddr_copy(&ac1, &t1);
 			ast_sockaddr_copy(&vac1, &vt1);
 			ast_sockaddr_copy(&tac1, &tt1);
-			ast_format_cap_copy2(oldcap1, cap1);
+			ast_format_cap_copy(oldcap1, cap1);
 		}
 		if ((ast_sockaddr_cmp(&t0, &ac0)) ||
 		    (vinstance0 && ast_sockaddr_cmp(&vt0, &vac0)) ||
@@ -1166,7 +1166,7 @@
 			ast_sockaddr_copy(&ac0, &t0);
 			ast_sockaddr_copy(&vac0, &vt0);
 			ast_sockaddr_copy(&tac0, &tt0);
-			ast_format_cap_copy2(oldcap0, cap0);
+			ast_format_cap_copy(oldcap0, cap0);
 		}
 
 		/* Wait for frame to come in on the channels */

Modified: team/dvossel/fixtheworld_phase1_step3/main/translate.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/main/translate.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/main/translate.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/main/translate.c Tue Jan 25 14:08:21 2011
@@ -257,7 +257,7 @@
  *
  * \note This function must be protected by the translators list lock
  */
-static struct translator_path *matrix_get(int x, int y)
+static struct translator_path *matrix_get(unsigned int x, unsigned int y)
 {
 	if (!(x >= 0 && y >= 0)) {
 		return NULL;
@@ -1259,7 +1259,7 @@
 	int src_video = 0;
 	int index;
 
-	ast_format_cap_copy2(result, dest);
+	ast_format_cap_copy(result, dest);
 
 	/* if we don't have a source format, we just have to try all
 	   possible destination formats */

Modified: team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c?view=diff&rev=303903&r1=303902&r2=303903
==============================================================================
--- team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c (original)
+++ team/dvossel/fixtheworld_phase1_step3/tests/test_format_api.c Tue Jan 25 14:08:21 2011
@@ -518,7 +518,7 @@
 
 	/* test copy */
 	cap1 = ast_format_cap_destroy(cap1);
-	cap1 = ast_format_cap_copy(cap_joint);
+	cap1 = ast_format_cap_dup(cap_joint);
 	if (!ast_format_cap_identical(cap_joint, cap1)) {
 			ast_test_status_update(test, "failed to copy capabilities\n");
 			res = AST_TEST_FAIL;
@@ -580,9 +580,9 @@
 	}
 
 	/* test copy2 */
-	ast_format_cap_copy2(cap2, cap_joint);
+	ast_format_cap_copy(cap2, cap_joint);
 	if (!ast_format_cap_identical(cap2, cap_joint)) {
-		ast_test_status_update(test, "ast_format_cap_copy2 failed\n");
+		ast_test_status_update(test, "ast_format_cap_copy failed\n");
 		res = AST_TEST_FAIL;
 		goto test3_cleanup;
 	}




More information about the asterisk-commits mailing list