[asterisk-commits] seanbright: branch group/asterisk-cpp r168427 - in /team/group/asterisk-cpp: ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Jan 10 21:29:13 CST 2009


Author: seanbright
Date: Sat Jan 10 21:29:13 2009
New Revision: 168427

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168427
Log:
translate.c was fun (assigning -1 to unsigned ints is fun)

Modified:
    team/group/asterisk-cpp/include/asterisk/strings.h
    team/group/asterisk-cpp/main/translate.c

Modified: team/group/asterisk-cpp/include/asterisk/strings.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/strings.h?view=diff&rev=168427&r1=168426&r2=168427
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/strings.h (original)
+++ team/group/asterisk-cpp/include/asterisk/strings.h Sat Jan 10 21:29:13 2009
@@ -542,7 +542,7 @@
 #define ast_str_alloca(init_len)			\
 	({						\
 		struct ast_str *__ast_str_buf;			\
-		__ast_str_buf = alloca(sizeof(*__ast_str_buf) + init_len);	\
+		__ast_str_buf = (struct ast_str *) alloca(sizeof(*__ast_str_buf) + init_len); \
 		__ast_str_buf->__AST_STR_LEN = init_len;			\
 		__ast_str_buf->__AST_STR_USED = 0;				\
 		__ast_str_buf->__AST_STR_TS = DS_ALLOCA;			\

Modified: team/group/asterisk-cpp/main/translate.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/translate.c?view=diff&rev=168427&r1=168426&r2=168427
==============================================================================
--- team/group/asterisk-cpp/main/translate.c (original)
+++ team/group/asterisk-cpp/main/translate.c Sat Jan 10 21:29:13 2009
@@ -105,7 +105,7 @@
 		len += sizeof(plc_state_t);
 	if (t->buf_size)
 		len += AST_FRIENDLY_OFFSET + t->buf_size;
-	pvt = ast_calloc(1, len);
+	pvt = (struct ast_trans_pvt *) ast_calloc(1, len);
 	if (!pvt)
 		return NULL;
 	pvt->t = t;
@@ -282,7 +282,7 @@
 			AST_RWLIST_UNLOCK(&translators);
 			return NULL;
 		}
-		if (!(cur = newpvt(t))) {
+		if (!(cur = (struct ast_trans_pvt *) newpvt(t))) {
 			ast_log(LOG_WARNING, "Failed to build translator step from %d to %d\n", source, dest);
 			if (head)
 				ast_translator_free_path(head);	
@@ -399,7 +399,7 @@
 		return;
 	}
 
-	pvt = newpvt(t);
+	pvt = (struct ast_trans_pvt *) newpvt(t);
 	if (!pvt) {
 		ast_log(LOG_WARNING, "Translator '%s' appears to be broken and will probably fail.\n", t->name);
 		t->cost = 999999;
@@ -464,7 +464,7 @@
 		if (samples)
 			calc_cost(t, samples);
 	  
-		if (!tr_matrix[x][z].step || t->cost < tr_matrix[x][z].cost) {
+		if (!tr_matrix[x][z].step || t->cost < (int) tr_matrix[x][z].cost) {
 			tr_matrix[x][z].step = t;
 			tr_matrix[x][z].cost = t->cost;
 		}
@@ -493,7 +493,7 @@
 					if (!tr_matrix[y][z].step)  /* no path from y to z */
 						continue;
 					newcost = tr_matrix[x][y].cost + tr_matrix[y][z].cost;
-					if (tr_matrix[x][z].step && newcost >= tr_matrix[x][z].cost)
+					if (tr_matrix[x][z].step && newcost >= (int) tr_matrix[x][z].cost)
 						continue;               /* x->y->z is more expensive than
 						                         * the existing path */
 					/* ok, we can get from x to z via y with a cost that
@@ -567,7 +567,7 @@
 			longest = curlen;
 	}
 	for (x = -1; x < SHOW_TRANS; x++) {
-		struct ast_str *out = ast_str_alloca(120);
+		struct ast_str *out = (struct ast_str *) ast_str_alloca(120);
 		/*Go ahead and move to next iteration if dealing with an unknown codec*/
 		if(x >= 0 && !strcmp(ast_getformatname(1 << (x)), "unknown"))
 			continue;
@@ -774,10 +774,10 @@
 				continue;
 			for (cursrc = 1, x = 0; x <= MAX_AUDIO_FORMAT; cursrc <<= 1, x++) {
 				if (!(*srcs & cursrc) || !tr_matrix[x][y].step ||
-				    tr_matrix[x][y].cost >  besttime)
+				    tr_matrix[x][y].cost > (unsigned int) besttime)
 					continue;	/* not existing or no better */
-				if (tr_matrix[x][y].cost < besttime ||
-				    tr_matrix[x][y].multistep < beststeps) {
+				if (tr_matrix[x][y].cost < (unsigned int) besttime ||
+				    tr_matrix[x][y].multistep < (unsigned int) beststeps) {
 					/* better than what we have so far */
 					best = cursrc;
 					bestdst = cur;
@@ -801,11 +801,11 @@
 	unsigned int res = -1;
 
 	/* convert bitwise format numbers into array indices */
-	src = powerof(src);
-	dest = powerof(dest);
-
-	if (src == -1 || dest == -1) {
-		ast_log(LOG_WARNING, "No translator path: (%s codec is not valid)\n", src == -1 ? "starting" : "ending");
+	int isrc = powerof(src);
+	int idest = powerof(dest);
+
+	if (isrc == -1 || idest == -1) {
+		ast_log(LOG_WARNING, "No translator path: (%s codec is not valid)\n", isrc == -1 ? "starting" : "ending");
 		return -1;
 	}
 	AST_RWLIST_RDLOCK(&translators);




More information about the asterisk-commits mailing list