From 714fc16a13c620527ebc11d254ba4e7b299a25f0 Mon Sep 17 00:00:00 2001 From: Heikki Levanto Date: Wed, 4 Aug 2004 09:59:03 +0000 Subject: [PATCH] Changed the pos code to 64-bit clean. Still lots of stuff missing... --- include/isamb.h | 4 ++-- include/rset.h | 7 +++---- isamb/isamb.c | 20 +++++++++----------- rset/rsbetween.c | 4 ++-- rset/rsbool.c | 4 ++-- rset/rset.c | 4 ++-- rset/rsisamb.c | 6 +++--- rset/rsisams.c | 4 ++-- rset/rsnull.c | 8 ++++---- rset/rsprox.c | 4 ++-- 10 files changed, 31 insertions(+), 34 deletions(-) diff --git a/include/isamb.h b/include/isamb.h index 181b7c2..358dc84 100644 --- a/include/isamb.h +++ b/include/isamb.h @@ -1,4 +1,4 @@ -/* $Id: isamb.h,v 1.11 2004-08-04 08:35:23 adam Exp $ +/* $Id: isamb.h,v 1.12 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -44,7 +44,7 @@ int isamb_pp_read (ISAMB_PP pp, void *buf); int isamb_pp_forward (ISAMB_PP pp, void *buf, const void *untilbuf); -void isamb_pp_pos (ISAMB_PP pp, int *current, int *total); +void isamb_pp_pos (ISAMB_PP pp, zint *current, zint *total); void isamb_pp_close (ISAMB_PP pp); diff --git a/include/rset.h b/include/rset.h index e6bd856..09dcf6d 100644 --- a/include/rset.h +++ b/include/rset.h @@ -1,4 +1,4 @@ -/* $Id: rset.h,v 1.23 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rset.h,v 1.24 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -46,8 +46,7 @@ struct rset_control int (*f_forward)(RSET ct, RSFD rfd, void *buf, int *term_index, int (*cmpfunc)(const void *p1, const void *p2), const void *untilbuf); - void (*f_pos)(RSFD rfd, int *current, int *total); - /* FIXME - Should be 64-bit ints !*/ + void (*f_pos)(RSFD rfd, zint *current, zint *total); /* returns -1,-1 if pos function not implemented for this type */ int (*f_read)(RSFD rfd, void *buf, int *term_index); int (*f_write)(RSFD rfd, const void *buf); @@ -56,7 +55,7 @@ struct rset_control int rset_default_forward(RSET ct, RSFD rfd, void *buf, int *term_index, int (*cmpfunc)(const void *p1, const void *p2), const void *untilbuf); -void rset_default_pos(RSFD rfd, int *current, int *total); +void rset_default_pos(RSFD rfd, zint *current, zint *total); struct rset_term { char *name; diff --git a/isamb/isamb.c b/isamb/isamb.c index ebf0bd2..5bcc0c9 100644 --- a/isamb/isamb.c +++ b/isamb/isamb.c @@ -1,4 +1,4 @@ -/* $Id: isamb.c,v 1.48 2004-08-04 08:35:24 adam Exp $ +/* $Id: isamb.c,v 1.49 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -1804,7 +1804,7 @@ int isamb_pp_num (ISAMB_PP pp) } static void isamb_pp_leaf_pos( ISAMB_PP pp, - int *current, int *total, void *dummybuf ) + zint *current, zint *total, void *dummybuf ) { struct ISAMB_block *p = pp->block[pp->level]; const char *src=p->bytes; @@ -1825,13 +1825,14 @@ static void isamb_pp_leaf_pos( ISAMB_PP pp, if (src<=cur) (*current)++; } - logf(LOG_DEBUG, "isamb_pp_leaf_pos: cur=%d tot=%d ofs=%d sz=%d lev=%d", + logf(LOG_DEBUG, "isamb_pp_leaf_pos: cur="ZINT_FORMAT" tot="ZINT_FORMAT + " ofs=%d sz=%d lev=%d", *current, *total, p->offset, p->size, pp->level); assert(src==end); } -static void isamb_pp_upper_pos( ISAMB_PP pp, int *current, int *total, - int size, int level ) +static void isamb_pp_upper_pos( ISAMB_PP pp, zint *current, zint *total, + zint size, int level ) { /* estimates total/current occurrences from here up, excl leaf */ struct ISAMB_block *p = pp->block[level]; const char *src=p->bytes; @@ -1842,7 +1843,8 @@ static void isamb_pp_upper_pos( ISAMB_PP pp, int *current, int *total, assert(level>=0); assert(!p->leaf); logf(LOG_DEBUG,"isamb_pp_upper_pos at beginning l=%d " - "cur=%d tot=%d ofs=%d sz=%d pos=" ZINT_FORMAT, + "cur="ZINT_FORMAT" tot="ZINT_FORMAT + " ofs=%d sz=%d pos=" ZINT_FORMAT, level, *current, *total, p->offset, p->size, p->pos); assert (p->offset <= p->size); decode_ptr (&src, &child ); /* first child */ @@ -1861,7 +1863,7 @@ static void isamb_pp_upper_pos( ISAMB_PP pp, int *current, int *total, isamb_pp_upper_pos(pp, current, total, *total, level-1); } /* upper_pos */ -void isamb_pp_pos( ISAMB_PP pp, int *current, int *total ) +void isamb_pp_pos( ISAMB_PP pp, zint *current, zint *total ) { /* return an estimate of the current position and of the total number of */ /* occureences in the isam tree, based on the current leaf */ struct ISAMB_block *p = pp->block[pp->level]; @@ -1872,8 +1874,4 @@ void isamb_pp_pos( ISAMB_PP pp, int *current, int *total ) isamb_pp_leaf_pos(pp,current, total, dummy); if (pp->level>0) isamb_pp_upper_pos(pp, current, total, *total, pp->level-1); - /* - logf(LOG_DEBUG,"isamb_pp_pos: C=%d T=%d =%6.2f%%", - *current, *total, 100.0*(*current)/(*total)); - */ } diff --git a/rset/rsbetween.c b/rset/rsbetween.c index e04c746..774535c 100644 --- a/rset/rsbetween.c +++ b/rset/rsbetween.c @@ -1,4 +1,4 @@ -/* $Id: rsbetween.c,v 1.15 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rsbetween.c,v 1.16 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -35,8 +35,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include +#include #define RSBETWEEN_DEBUG 0 diff --git a/rset/rsbool.c b/rset/rsbool.c index 380ef6a..1a6b3c9 100644 --- a/rset/rsbool.c +++ b/rset/rsbool.c @@ -1,4 +1,4 @@ -/* $Id: rsbool.c,v 1.32 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rsbool.c,v 1.33 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -25,8 +25,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include +#include #ifndef RSET_DEBUG #define RSET_DEBUG 0 diff --git a/rset/rset.c b/rset/rset.c index 2f4896e..4421587 100644 --- a/rset/rset.c +++ b/rset/rset.c @@ -1,4 +1,4 @@ -/* $Id: rset.c,v 1.21 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rset.c,v 1.22 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -65,7 +65,7 @@ RSET rset_dup (RSET rs) return rs; } -void rset_default_pos (RSFD rfd, int *current, int *total) +void rset_default_pos (RSFD rfd, zint *current, zint *total) { /* FIXME - This function should not be needed, only while */ /* coding the pos functions. */ assert(rfd); diff --git a/rset/rsisamb.c b/rset/rsisamb.c index bac75e9..0bc7107 100644 --- a/rset/rsisamb.c +++ b/rset/rsisamb.c @@ -1,4 +1,4 @@ -/* $Id: rsisamb.c,v 1.10 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rsisamb.c,v 1.11 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -39,7 +39,7 @@ static void r_rewind (RSFD rfd); static int r_forward(RSET ct, RSFD rfd, void *buf, int *term_index, int (*cmpfunc)(const void *p1, const void *p2), const void *untilbuf); -static void r_pos (RSFD rfd, int *current, int *total); +static void r_pos (RSFD rfd, zint *current, zint *total); static int r_read (RSFD rfd, void *buf, int *term_index); static int r_write (RSFD rfd, const void *buf); @@ -172,7 +172,7 @@ static int r_forward(RSET ct, RSFD rfd, void *buf, int *term_index, return i; } -static void r_pos (RSFD rfd, int *current, int *total) +static void r_pos (RSFD rfd, zint *current, zint *total) { struct rset_pp_info *pinfo = (struct rset_pp_info *) rfd; assert(rfd); diff --git a/rset/rsisams.c b/rset/rsisams.c index 30f3cd7..7ebdc4b 100644 --- a/rset/rsisams.c +++ b/rset/rsisams.c @@ -1,4 +1,4 @@ -/* $Id: rsisams.c,v 1.6 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rsisams.c,v 1.7 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,8 +24,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include +#include static void *r_create(RSET ct, const struct rset_control *sel, void *parms); static RSFD r_open (RSET ct, int flag); diff --git a/rset/rsnull.c b/rset/rsnull.c index e2bf398..c02ff4f 100644 --- a/rset/rsnull.c +++ b/rset/rsnull.c @@ -1,4 +1,4 @@ -/* $Id: rsnull.c,v 1.18 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rsnull.c,v 1.19 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 Index Data Aps @@ -24,15 +24,15 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include +#include static void *r_create(RSET ct, const struct rset_control *sel, void *parms); static RSFD r_open (RSET ct, int flag); static void r_close (RSFD rfd); static void r_delete (RSET ct); static void r_rewind (RSFD rfd); -static void r_pos (RSFD rfd, int *current, int *total); +static void r_pos (RSFD rfd, zint *current, zint *total); static int r_read (RSFD rfd, void *buf, int *term_index); static int r_write (RSFD rfd, const void *buf); @@ -93,7 +93,7 @@ static void r_rewind (RSFD rfd) logf (LOG_DEBUG, "rsnull_rewind"); } -static void r_pos (RSFD rfd, int *current, int *total) +static void r_pos (RSFD rfd, zint *current, zint *total) { assert(rfd); assert(current); diff --git a/rset/rsprox.c b/rset/rsprox.c index 9090495..60f80ab 100644 --- a/rset/rsprox.c +++ b/rset/rsprox.c @@ -1,4 +1,4 @@ -/* $Id: rsprox.c,v 1.5 2004-08-03 14:54:41 heikki Exp $ +/* $Id: rsprox.c,v 1.6 2004-08-04 09:59:03 heikki Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003,2004 Index Data Aps @@ -25,8 +25,8 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #include #include -#include #include +#include #ifndef RSET_DEBUG #define RSET_DEBUG 0 -- 1.7.10.4