From da55a0dc36da79d045ef0858aa757119ce51e94b Mon Sep 17 00:00:00 2001 From: Koji Arai Date: Wed, 10 Sep 2008 00:46:10 +0900 Subject: [PATCH] Fixed bug: uninitialized variable has been used in maketree2(). Make sure whether the maketree2() need to use the tree1 info. This is experimental changes. --- src/pm2tree.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/pm2tree.c b/src/pm2tree.c index 5d98bc4..8ce0511 100644 --- a/src/pm2tree.c +++ b/src/pm2tree.c @@ -10,7 +10,6 @@ struct tree { static unsigned char tree1left[32]; static unsigned char tree1right[32]; static struct tree tree1 = { 0, tree1left, tree1right }; -static unsigned char tree1bound; static unsigned char tree2left[8]; static unsigned char tree2right[8]; @@ -26,10 +25,10 @@ void maketree1() { int i, nbits, x; + unsigned char tree1bound; unsigned char mindepth; unsigned char table1[32]; - tree1bound = getbits(5); mindepth = getbits(3); if (mindepth == 0) { @@ -51,15 +50,8 @@ void maketree2(int tree2bound) /* in use: 5 <= tree2bound <= 8 */ { int i, count, index; - unsigned char mindepth; unsigned char table2[8]; - if (tree1bound < 10) - return; - - if (tree1bound == 29 && mindepth == 0) - return; - for (i = 0; i < 8; i++) table2[i] = 0; for (i = 0; i < tree2bound; i++) @@ -78,8 +70,7 @@ maketree2(int tree2bound) /* in use: 5 <= tree2bound <= 8 */ tree_setsingle(&tree2, index); } else if (count > 1) { - mindepth = 1; - tree_rebuild(&tree2, tree2bound, mindepth, 7, table2); + tree_rebuild(&tree2, tree2bound, 1, 7, table2); } // Note: count == 0 is possible! // Excluding that possibility was a bug in version 1. -- 2.11.0