diff options
author | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-17 22:45:57 +0000 |
---|---|---|
committer | qwell <qwell@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-12-17 22:45:57 +0000 |
commit | febe5ae851b9c53d4ffdf89b94efb6e0bb952c2c (patch) | |
tree | 13a36bcca7223526f10a9343e0780ea7ecc5f980 | |
parent | 856778de69999a4321d54f2cefef66d3e2fce4c1 (diff) |
What was I thinking when I wrote this masterpiece?
-1 + 1 = 0.. who woulda thunk it?.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@93381 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r-- | main/translate.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/main/translate.c b/main/translate.c index 5e2391a08..24f5064fe 100644 --- a/main/translate.c +++ b/main/translate.c @@ -521,7 +521,7 @@ static int show_translation_deprecated(int fd, int argc, char *argv[]) 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 @@ static int show_translation_deprecated(int fd, int argc, char *argv[]) *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 @@ static int show_translation_deprecated(int fd, int argc, char *argv[]) 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 @@ static int show_translation(int fd, int argc, char *argv[]) *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 @@ static int show_translation(int fd, int argc, char *argv[]) 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 { |