From 0f208e595dd865267c9a4af16164c9874f8e334e Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Wed, 23 Jun 2004 05:19:53 +0000 Subject: [PATCH] cosas y mas cosas de prueba --- src/blocksorting/bs.c | 23 +++++++++++++++++++---- src/jacu.c | 3 +-- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/src/blocksorting/bs.c b/src/blocksorting/bs.c index 6231d05..d8bd093 100644 --- a/src/blocksorting/bs.c +++ b/src/blocksorting/bs.c @@ -6,7 +6,7 @@ typedef struct _bs_decode_t_ { char c; - Uint32 pos; + Uint32 sig; } t_BlockSortDecode; char es_menor(char *data, t_BlockSort *bs, int i, int j); @@ -17,16 +17,28 @@ int _compare(const void *d1, const void *d2) { s1 = (t_BlockSortDecode *)d1; s2 = (t_BlockSortDecode *)d2; + /* Hack si es el mismo caracter, dejo como mejor la de menor sig */ + if (s1->c == s2->c) { + return (s1->sig - s2->sig); + } + return (s1->c - s2->c); } int __compare(const void *d1, const void *d2) { t_BlockSortData *s1, *s2; + char i; s1 = (t_BlockSortData *)d1; s2 = (t_BlockSortData *)d2; - return es_menor(s1->bs->data, s1->bs, s1->pos_inicial, s2->pos_inicial); + i = es_menor(s1->bs->data, s1->bs, s1->pos_inicial, s2->pos_inicial); + +/* if (i == 0) {*/ + /* si ambos strings son iguales, fuerzo a que d1 quede primero */ + /*return -1; + }*/ + return i; } char es_menor(char *data, t_BlockSort *bs, int i, int j) @@ -42,6 +54,7 @@ char es_menor(char *data, t_BlockSort *bs, int i, int j) } /* Son iguales! */ + /* Hack */ return 0; } @@ -114,7 +127,7 @@ void bs_restore(char *dst, char *c, Uint32 k, Uint32 len) for(i=0; i 0) { - printf("PageSize = %ld\n", block_size); fread(&z_len, sizeof(int), 1, fp_in); z = malloc(sizeof(char)*z_len); fread(z, z_len, sizeof(char), fp_in); @@ -249,6 +247,7 @@ int main(int argc, char* argv[]) free(block); free(orig); free(mtf); + free(z); } } fclose(fp_in); -- 2.43.0