[asterisk-commits] qwell: branch 1.4 r93381 - /branches/1.4/main/translate.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 17 16:45:57 CST 2007


Author: qwell
Date: Mon Dec 17 16:45:57 2007
New Revision: 93381

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93381
Log:
What was I thinking when I wrote this masterpiece?

-1 + 1 = 0..  who woulda thunk it?.

Modified:
    branches/1.4/main/translate.c

Modified: branches/1.4/main/translate.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/translate.c?view=diff&rev=93381&r1=93380&r2=93381
==============================================================================
--- branches/1.4/main/translate.c (original)
+++ branches/1.4/main/translate.c Mon Dec 17 16:45:57 2007
@@ -521,7 +521,7 @@
 	ast_cli(fd, "          Source Format (Rows) Destination Format (Columns)\n\n");
 	/* Get the length of the longest (usable?) codec name, so we know how wide the left side should be */
 	for (x = 0; x < SHOW_TRANS; x++) {
-		curlen = strlen(ast_getformatname(1 << (x + 1)));
+		curlen = strlen(ast_getformatname(1 << (x)));
 		if (curlen > longest)
 			longest = curlen;
 	}
@@ -533,7 +533,8 @@
 		*buf++ = ' ';
 		*buf = '\0';
 		for (y = -1; y < SHOW_TRANS; y++) {
-			curlen = strlen(ast_getformatname(1 << (y)));
+			if (y >= 0)
+				curlen = strlen(ast_getformatname(1 << (y)));
 
 			if (x >= 0 && y >= 0 && tr_matrix[x][y].step) {
 				/* XXX 999 is a little hackish
@@ -542,10 +543,10 @@
 				ast_build_string(&buf, &left, "%*d", curlen + 1, tr_matrix[x][y].cost > 999 ? 0 : tr_matrix[x][y].cost);
 			} else if (x == -1 && y >= 0) {
 				/* Top row - use a dynamic size */
-				ast_build_string(&buf, &left, "%*s", curlen + 1, ast_getformatname(1 << (x + y + 1)) );
+				ast_build_string(&buf, &left, "%*s", curlen + 1, ast_getformatname(1 << (y)) );
 			} else if (y == -1 && x >= 0) {
 				/* Left column - use a static size. */
-				ast_build_string(&buf, &left, "%*s", longest, ast_getformatname(1 << (x + y + 1)) );
+				ast_build_string(&buf, &left, "%*s", longest, ast_getformatname(1 << (x)) );
 			} else if (x >= 0 && y >= 0) {
 				ast_build_string(&buf, &left, "%*s", curlen + 1, "-");
 			} else {
@@ -601,7 +602,8 @@
 		*buf++ = ' ';
 		*buf = '\0';
 		for (y = -1; y < SHOW_TRANS; y++) {
-			curlen = strlen(ast_getformatname(1 << (y)));
+			if (y >= 0)
+				curlen = strlen(ast_getformatname(1 << (y)));
 
 			if (x >= 0 && y >= 0 && tr_matrix[x][y].step) {
 				/* XXX 999 is a little hackish
@@ -610,10 +612,10 @@
 				ast_build_string(&buf, &left, "%*d", curlen + 1, tr_matrix[x][y].cost > 999 ? 0 : tr_matrix[x][y].cost);
 			} else if (x == -1 && y >= 0) {
 				/* Top row - use a dynamic size */
-				ast_build_string(&buf, &left, "%*s", curlen + 1, ast_getformatname(1 << (x + y + 1)) );
+				ast_build_string(&buf, &left, "%*s", curlen + 1, ast_getformatname(1 << (y)) );
 			} else if (y == -1 && x >= 0) {
 				/* Left column - use a static size. */
-				ast_build_string(&buf, &left, "%*s", longest, ast_getformatname(1 << (x + y + 1)) );
+				ast_build_string(&buf, &left, "%*s", longest, ast_getformatname(1 << (x)) );
 			} else if (x >= 0 && y >= 0) {
 				ast_build_string(&buf, &left, "%*s", curlen + 1, "-");
 			} else {




More information about the asterisk-commits mailing list