X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=dict%2Fdcompact.c;h=e2f8a8cfb9d9c06eba76fd85866076a5ef6eb2e9;hb=33ca955198b19dbf989edfeda20922628d183943;hp=800b6545aecd108ee19ce845dc0dc21336e6a112;hpb=4ed5fbcd29d2a98b048d1d94510b262d352b4f7c;p=idzebra-moved-to-github.git diff --git a/dict/dcompact.c b/dict/dcompact.c index 800b654..e2f8a8c 100644 --- a/dict/dcompact.c +++ b/dict/dcompact.c @@ -1,29 +1,33 @@ -/* - * Copyright (C) 1994-1999, Index Data - * All rights reserved. - * Sebastian Hammer, Adam Dickmeiss - * - * $Log: dcompact.c,v $ - * Revision 1.4 1999-05-15 14:36:37 adam - * Updated dictionary. Implemented "compression" of dictionary. - * - * Revision 1.3 1999/05/12 13:08:06 adam - * First version of ISAMS. - * - * Revision 1.2 1999/03/09 16:27:49 adam - * More work on SDRKit integration. - * - * Revision 1.1 1999/03/09 13:07:06 adam - * Work on dict_compact routine. - * - */ +/* $Id: dcompact.c,v 1.8 2002-08-02 19:26:55 adam Exp $ + Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002 + Index Data Aps + +This file is part of the Zebra server. + +Zebra is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. + +Zebra is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with Zebra; see the file LICENSE.zebra. If not, write to the +Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. +*/ + + #include #include #include #include -#include +#include #include static void dict_copy_page(Dict dict, char *to_p, char *from_p, int *map) @@ -92,7 +96,7 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) dict_from = dict_open (bfs, from_name, 0, 0, 0); if (!dict_from) return -1; - map = xmalloc ((dict_from->head.last+1) * sizeof(*map)); + map = (int *) xmalloc ((dict_from->head.last+1) * sizeof(*map)); for (i = 0; i <= (int) (dict_from->head.last); i++) map[i] = -1; dict_to = dict_open (bfs, to_name, 0, 1, 1); @@ -114,8 +118,10 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) map[i+1] = map[i] + size; no_dir += DICT_nodir(buf); } +#if 0 logf (LOG_LOG, "map[%d] = %d", i, map[i]); logf (LOG_LOG, "nodir = %d", no_dir); +#endif dict_to->head.root = map[1]; dict_to->head.last = map[i]; for (i = 1; i< (int) (dict_from->head.last); i++) @@ -131,7 +137,7 @@ int dict_copy_compact (BFiles bfs, const char *from_name, const char *to_name) DICT_backptr(new_p) = map[i-1]; DICT_bsize(new_p) = map[i+1] - map[i]; - dict_copy_page(dict_from, new_p, old_p, map); + dict_copy_page(dict_from, (char*) new_p, (char*) old_p, map); } dict_close (dict_from); dict_close (dict_to);