From 7185ab04a9cdb833fe38e57fce74f5e56ab7da1f Mon Sep 17 00:00:00 2001 From: April White Date: Sat, 4 Jul 2009 23:53:03 +0000 Subject: [PATCH] 2009-07-04 19:16 UTC+0600 April White (april users.sourceforge.net) * contrib/hbbtree/ctest.c * remove ( BYTE * ) casts --- harbour/ChangeLog | 4 + harbour/contrib/hbbtree/tests/ctest.c | 170 +++++++++++++------------- 2 files changed, 89 insertions(+), 85 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9c84fcfeec..f5d0228daf 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,6 +17,10 @@ past entries belonging to author(s): Viktor Szakats. */ +2009-07-04 19:16 UTC+0600 April White (april users.sourceforge.net) + * contrib/hbbtree/ctest.c + * remove ( BYTE * ) casts + 2009-07-04 19:16 UTC+0600 April White (april users.sourceforge.net) * contrib/hbbtree/hb_btree.c * fixed one warning: cast from pointer to integer of different size diff --git a/harbour/contrib/hbbtree/tests/ctest.c b/harbour/contrib/hbbtree/tests/ctest.c index 0448b772a9..7f9a3523a1 100644 --- a/harbour/contrib/hbbtree/tests/ctest.c +++ b/harbour/contrib/hbbtree/tests/ctest.c @@ -59,86 +59,86 @@ static void insertdata( struct hb_BTree * pBTree ) { PHB_ITEM data = hb_itemNew( NULL ); - hb_BTreeInsert( pBTree, ( BYTE * ) "fuweqgsz", hb_itemPutNL( data, 1 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "sjruexrd", hb_itemPutNL( data, 2 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "fvveitnz", hb_itemPutNL( data, 3 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "aqgksjxe", hb_itemPutNL( data, 4 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "oonrehvj", hb_itemPutNL( data, 5 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "gvowjwtr", hb_itemPutNL( data, 6 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "xxidwtvn", hb_itemPutNL( data, 7 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "rwjbxesd", hb_itemPutNL( data, 8 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "yaznsaek", hb_itemPutNL( data, 9 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "wbdhfkfy", hb_itemPutNL( data, 10 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "lryaezia", hb_itemPutNL( data, 11 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "tspmnrvk", hb_itemPutNL( data, 12 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "hpxryhdj", hb_itemPutNL( data, 13 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "sztcqaby", hb_itemPutNL( data, 14 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "fcyzsqja", hb_itemPutNL( data, 15 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "uccxumvg", hb_itemPutNL( data, 16 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "amwuoout", hb_itemPutNL( data, 17 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "yaytseln", hb_itemPutNL( data, 18 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "sfiiozej", hb_itemPutNL( data, 19 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "xuvsoljy", hb_itemPutNL( data, 20 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "qmqjbedm", hb_itemPutNL( data, 21 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "cctzzrkz", hb_itemPutNL( data, 22 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ikytgdon", hb_itemPutNL( data, 23 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "pksobcwu", hb_itemPutNL( data, 24 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "vmurindj", hb_itemPutNL( data, 25 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "elvybqwg", hb_itemPutNL( data, 26 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ixchaztx", hb_itemPutNL( data, 27 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "nzpztlhd", hb_itemPutNL( data, 28 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "aucrchiw", hb_itemPutNL( data, 29 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "munrytse", hb_itemPutNL( data, 30 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "kqkhcmls", hb_itemPutNL( data, 31 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "abqhurbi", hb_itemPutNL( data, 32 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ymrldckr", hb_itemPutNL( data, 33 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "rhsmfflc", hb_itemPutNL( data, 34 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "apyfkvee", hb_itemPutNL( data, 35 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "cdntyzrf", hb_itemPutNL( data, 36 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "iacblqrh", hb_itemPutNL( data, 37 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "xvewqana", hb_itemPutNL( data, 38 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "xmybqytj", hb_itemPutNL( data, 39 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "dnowympf", hb_itemPutNL( data, 40 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "smloihft", hb_itemPutNL( data, 41 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "zumppmis", hb_itemPutNL( data, 42 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "jirucnxu", hb_itemPutNL( data, 43 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ecdzikcv", hb_itemPutNL( data, 44 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "slbwvnpg", hb_itemPutNL( data, 45 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "yaftlkmz", hb_itemPutNL( data, 46 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "blcepksd", hb_itemPutNL( data, 47 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "xufowlpl", hb_itemPutNL( data, 48 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "xegtjtqc", hb_itemPutNL( data, 49 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "yplcqumq", hb_itemPutNL( data, 50 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "vdoycauz", hb_itemPutNL( data, 51 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "uhqkjuph", hb_itemPutNL( data, 52 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "prllaeyi", hb_itemPutNL( data, 53 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ybzgmwzm", hb_itemPutNL( data, 54 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "kkvyllnp", hb_itemPutNL( data, 55 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "nberwsrb", hb_itemPutNL( data, 56 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "wgetahua", hb_itemPutNL( data, 57 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "yxcyehcv", hb_itemPutNL( data, 58 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "oacormks", hb_itemPutNL( data, 59 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "mcadkdxo", hb_itemPutNL( data, 60 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ycsalwqw", hb_itemPutNL( data, 61 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "qmpysvjl", hb_itemPutNL( data, 62 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "iqikamew", hb_itemPutNL( data, 63 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "iaparrva", hb_itemPutNL( data, 64 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "casbvtay", hb_itemPutNL( data, 65 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "blaksexr", hb_itemPutNL( data, 66 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "tbosrbql", hb_itemPutNL( data, 67 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ifkywsyt", hb_itemPutNL( data, 68 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "gvklwevy", hb_itemPutNL( data, 69 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "krpmpbud", hb_itemPutNL( data, 70 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "rdvlwbwm", hb_itemPutNL( data, 71 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "apnvdkww", hb_itemPutNL( data, 72 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "euqdocvm", hb_itemPutNL( data, 73 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ksmkjcwp", hb_itemPutNL( data, 74 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "bztgclzc", hb_itemPutNL( data, 75 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "awkdnuxa", hb_itemPutNL( data, 76 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "abavnpod", hb_itemPutNL( data, 77 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "dvwvhjmh", hb_itemPutNL( data, 78 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "dmfmivqb", hb_itemPutNL( data, 79 ) ); - hb_BTreeInsert( pBTree, ( BYTE * ) "ewsxanon", hb_itemPutNL( data, 80 ) ); + hb_BTreeInsert( pBTree, "fuweqgsz", hb_itemPutNL( data, 1 ) ); + hb_BTreeInsert( pBTree, "sjruexrd", hb_itemPutNL( data, 2 ) ); + hb_BTreeInsert( pBTree, "fvveitnz", hb_itemPutNL( data, 3 ) ); + hb_BTreeInsert( pBTree, "aqgksjxe", hb_itemPutNL( data, 4 ) ); + hb_BTreeInsert( pBTree, "oonrehvj", hb_itemPutNL( data, 5 ) ); + hb_BTreeInsert( pBTree, "gvowjwtr", hb_itemPutNL( data, 6 ) ); + hb_BTreeInsert( pBTree, "xxidwtvn", hb_itemPutNL( data, 7 ) ); + hb_BTreeInsert( pBTree, "rwjbxesd", hb_itemPutNL( data, 8 ) ); + hb_BTreeInsert( pBTree, "yaznsaek", hb_itemPutNL( data, 9 ) ); + hb_BTreeInsert( pBTree, "wbdhfkfy", hb_itemPutNL( data, 10 ) ); + hb_BTreeInsert( pBTree, "lryaezia", hb_itemPutNL( data, 11 ) ); + hb_BTreeInsert( pBTree, "tspmnrvk", hb_itemPutNL( data, 12 ) ); + hb_BTreeInsert( pBTree, "hpxryhdj", hb_itemPutNL( data, 13 ) ); + hb_BTreeInsert( pBTree, "sztcqaby", hb_itemPutNL( data, 14 ) ); + hb_BTreeInsert( pBTree, "fcyzsqja", hb_itemPutNL( data, 15 ) ); + hb_BTreeInsert( pBTree, "uccxumvg", hb_itemPutNL( data, 16 ) ); + hb_BTreeInsert( pBTree, "amwuoout", hb_itemPutNL( data, 17 ) ); + hb_BTreeInsert( pBTree, "yaytseln", hb_itemPutNL( data, 18 ) ); + hb_BTreeInsert( pBTree, "sfiiozej", hb_itemPutNL( data, 19 ) ); + hb_BTreeInsert( pBTree, "xuvsoljy", hb_itemPutNL( data, 20 ) ); + hb_BTreeInsert( pBTree, "qmqjbedm", hb_itemPutNL( data, 21 ) ); + hb_BTreeInsert( pBTree, "cctzzrkz", hb_itemPutNL( data, 22 ) ); + hb_BTreeInsert( pBTree, "ikytgdon", hb_itemPutNL( data, 23 ) ); + hb_BTreeInsert( pBTree, "pksobcwu", hb_itemPutNL( data, 24 ) ); + hb_BTreeInsert( pBTree, "vmurindj", hb_itemPutNL( data, 25 ) ); + hb_BTreeInsert( pBTree, "elvybqwg", hb_itemPutNL( data, 26 ) ); + hb_BTreeInsert( pBTree, "ixchaztx", hb_itemPutNL( data, 27 ) ); + hb_BTreeInsert( pBTree, "nzpztlhd", hb_itemPutNL( data, 28 ) ); + hb_BTreeInsert( pBTree, "aucrchiw", hb_itemPutNL( data, 29 ) ); + hb_BTreeInsert( pBTree, "munrytse", hb_itemPutNL( data, 30 ) ); + hb_BTreeInsert( pBTree, "kqkhcmls", hb_itemPutNL( data, 31 ) ); + hb_BTreeInsert( pBTree, "abqhurbi", hb_itemPutNL( data, 32 ) ); + hb_BTreeInsert( pBTree, "ymrldckr", hb_itemPutNL( data, 33 ) ); + hb_BTreeInsert( pBTree, "rhsmfflc", hb_itemPutNL( data, 34 ) ); + hb_BTreeInsert( pBTree, "apyfkvee", hb_itemPutNL( data, 35 ) ); + hb_BTreeInsert( pBTree, "cdntyzrf", hb_itemPutNL( data, 36 ) ); + hb_BTreeInsert( pBTree, "iacblqrh", hb_itemPutNL( data, 37 ) ); + hb_BTreeInsert( pBTree, "xvewqana", hb_itemPutNL( data, 38 ) ); + hb_BTreeInsert( pBTree, "xmybqytj", hb_itemPutNL( data, 39 ) ); + hb_BTreeInsert( pBTree, "dnowympf", hb_itemPutNL( data, 40 ) ); + hb_BTreeInsert( pBTree, "smloihft", hb_itemPutNL( data, 41 ) ); + hb_BTreeInsert( pBTree, "zumppmis", hb_itemPutNL( data, 42 ) ); + hb_BTreeInsert( pBTree, "jirucnxu", hb_itemPutNL( data, 43 ) ); + hb_BTreeInsert( pBTree, "ecdzikcv", hb_itemPutNL( data, 44 ) ); + hb_BTreeInsert( pBTree, "slbwvnpg", hb_itemPutNL( data, 45 ) ); + hb_BTreeInsert( pBTree, "yaftlkmz", hb_itemPutNL( data, 46 ) ); + hb_BTreeInsert( pBTree, "blcepksd", hb_itemPutNL( data, 47 ) ); + hb_BTreeInsert( pBTree, "xufowlpl", hb_itemPutNL( data, 48 ) ); + hb_BTreeInsert( pBTree, "xegtjtqc", hb_itemPutNL( data, 49 ) ); + hb_BTreeInsert( pBTree, "yplcqumq", hb_itemPutNL( data, 50 ) ); + hb_BTreeInsert( pBTree, "vdoycauz", hb_itemPutNL( data, 51 ) ); + hb_BTreeInsert( pBTree, "uhqkjuph", hb_itemPutNL( data, 52 ) ); + hb_BTreeInsert( pBTree, "prllaeyi", hb_itemPutNL( data, 53 ) ); + hb_BTreeInsert( pBTree, "ybzgmwzm", hb_itemPutNL( data, 54 ) ); + hb_BTreeInsert( pBTree, "kkvyllnp", hb_itemPutNL( data, 55 ) ); + hb_BTreeInsert( pBTree, "nberwsrb", hb_itemPutNL( data, 56 ) ); + hb_BTreeInsert( pBTree, "wgetahua", hb_itemPutNL( data, 57 ) ); + hb_BTreeInsert( pBTree, "yxcyehcv", hb_itemPutNL( data, 58 ) ); + hb_BTreeInsert( pBTree, "oacormks", hb_itemPutNL( data, 59 ) ); + hb_BTreeInsert( pBTree, "mcadkdxo", hb_itemPutNL( data, 60 ) ); + hb_BTreeInsert( pBTree, "ycsalwqw", hb_itemPutNL( data, 61 ) ); + hb_BTreeInsert( pBTree, "qmpysvjl", hb_itemPutNL( data, 62 ) ); + hb_BTreeInsert( pBTree, "iqikamew", hb_itemPutNL( data, 63 ) ); + hb_BTreeInsert( pBTree, "iaparrva", hb_itemPutNL( data, 64 ) ); + hb_BTreeInsert( pBTree, "casbvtay", hb_itemPutNL( data, 65 ) ); + hb_BTreeInsert( pBTree, "blaksexr", hb_itemPutNL( data, 66 ) ); + hb_BTreeInsert( pBTree, "tbosrbql", hb_itemPutNL( data, 67 ) ); + hb_BTreeInsert( pBTree, "ifkywsyt", hb_itemPutNL( data, 68 ) ); + hb_BTreeInsert( pBTree, "gvklwevy", hb_itemPutNL( data, 69 ) ); + hb_BTreeInsert( pBTree, "krpmpbud", hb_itemPutNL( data, 70 ) ); + hb_BTreeInsert( pBTree, "rdvlwbwm", hb_itemPutNL( data, 71 ) ); + hb_BTreeInsert( pBTree, "apnvdkww", hb_itemPutNL( data, 72 ) ); + hb_BTreeInsert( pBTree, "euqdocvm", hb_itemPutNL( data, 73 ) ); + hb_BTreeInsert( pBTree, "ksmkjcwp", hb_itemPutNL( data, 74 ) ); + hb_BTreeInsert( pBTree, "bztgclzc", hb_itemPutNL( data, 75 ) ); + hb_BTreeInsert( pBTree, "awkdnuxa", hb_itemPutNL( data, 76 ) ); + hb_BTreeInsert( pBTree, "abavnpod", hb_itemPutNL( data, 77 ) ); + hb_BTreeInsert( pBTree, "dvwvhjmh", hb_itemPutNL( data, 78 ) ); + hb_BTreeInsert( pBTree, "dmfmivqb", hb_itemPutNL( data, 79 ) ); + hb_BTreeInsert( pBTree, "ewsxanon", hb_itemPutNL( data, 80 ) ); hb_itemRelease( data ); } @@ -147,7 +147,7 @@ HB_FUNC( CTEST ) struct hb_BTree * pBTree; display( "Harbour API test", 0, TRUE ); - pBTree = hb_BTreeNew( ( BYTE * ) "test_3.out", 2048, 90, HB_BTREE_UNIQUE, 0 ); + pBTree = hb_BTreeNew( "test_3.out", 2048, 90, HB_BTREE_UNIQUE, 0 ); if ( pBTree != NULL ) { /* @@ -187,14 +187,14 @@ HB_FUNC( CTEST ) hb_conOutStd( hb_conNewLine(), strlen( hb_conNewLine() ) ); display( "Test SEEK", 0, TRUE ); - display( hb_BTreeSeek( pBTree, ( BYTE * ) "cdntyzrf", 36, FALSE ) == 1 ? ".T." : ".F.", 0, TRUE ); + display( hb_BTreeSeek( pBTree, "cdntyzrf", 36, FALSE ) == 1 ? ".T." : ".F.", 0, TRUE ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), TRUE ); hb_BTreeSkip( pBTree, 1 ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), FALSE ); display( " dmfmivqb ?", 0, TRUE ); hb_conOutStd( hb_conNewLine(), strlen( hb_conNewLine() ) ); display( "Test soft SEEK of a short key", 0, TRUE ); - display( hb_BTreeSeek( pBTree, ( BYTE * ) "cd", 0, TRUE ) == 1 ? ".T." : ".F.", 0, TRUE ); + display( hb_BTreeSeek( pBTree, "cd", 0, TRUE ) == 1 ? ".T." : ".F.", 0, TRUE ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), TRUE ); hb_BTreeSkip( pBTree, 1 ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), FALSE ); @@ -202,7 +202,7 @@ HB_FUNC( CTEST ) hb_conOutStd( hb_conNewLine(), strlen( hb_conNewLine() ) ); display( "Test soft SEEK of an existing key", 0, TRUE ); - display( hb_BTreeSeek( pBTree, ( BYTE * ) "cdntyzrf", 0, TRUE ) == 1 ? ".T." : ".F.", 0, TRUE ); + display( hb_BTreeSeek( pBTree, "cdntyzrf", 0, TRUE ) == 1 ? ".T." : ".F.", 0, TRUE ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), TRUE ); hb_BTreeSkip( pBTree, 1 ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), FALSE ); @@ -210,7 +210,7 @@ HB_FUNC( CTEST ) hb_conOutStd( hb_conNewLine(), strlen( hb_conNewLine() ) ); display( "Test soft SEEK of a missing key, that should force EOF", 0, TRUE ); - display( hb_BTreeSeek( pBTree, ( BYTE * ) "zzzzzz", 0, FALSE ) == 1 ? ".T." : ".F.", 0, TRUE ); + display( hb_BTreeSeek( pBTree, "zzzzzz", 0, FALSE ) == 1 ? ".T." : ".F.", 0, TRUE ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), TRUE ); hb_BTreeSkip( pBTree, 1 ); display( ( char * ) hb_BTreeKey( pBTree ), hb_BTreeData( pBTree ), FALSE );