got rid of pathhash in rcldb, not used since 11.0
This commit is contained in:
parent
835f4a701d
commit
b6f3c99c1a
@ -6,8 +6,8 @@ LIBS = librcl.a
|
||||
|
||||
all: $(LIBS)
|
||||
|
||||
OBJS = rclaspell.o rclconfig.o rclinit.o textsplit.o unacpp.o csguess.o indexer.o mimetype.o htmlparse.o myhtmlparse.o mimehandler.o internfile.o mh_exec.o mh_html.o mh_mail.o mh_mbox.o mh_text.o docseq.o docseqdb.o docseqhist.o filtseq.o history.o plaintorich.o recollq.o reslistpager.o sortseq.o wasastringtoquery.o wasatorcl.o pathhash.o rcldb.o rcldoc.o rclquery.o searchdata.o stemdb.o stoplist.o base64.o conftree.o copyfile.o debuglog.o execmd.o fstreewalk.o idfile.o fileudi.o md5.o mimeparse.o pathut.o readfile.o smallut.o transcode.o wipedir.o x11mon.o mime-getpart.o mime-parsefull.o mime-parseonlyheader.o mime-printbody.o mime-printdoc.o mime-printheader.o mime.o convert.o iodevice.o iofactory.o
|
||||
DEPS = rclaspell.dep.stamp rclconfig.dep.stamp rclinit.dep.stamp textsplit.dep.stamp unacpp.dep.stamp csguess.dep.stamp indexer.dep.stamp mimetype.dep.stamp htmlparse.dep.stamp myhtmlparse.dep.stamp mimehandler.dep.stamp internfile.dep.stamp mh_exec.dep.stamp mh_html.dep.stamp mh_mail.dep.stamp mh_mbox.dep.stamp mh_text.dep.stamp docseq.dep.stamp docseqdb.dep.stamp docseqhist.dep.stamp filtseq.dep.stamp history.dep.stamp plaintorich.dep.stamp recollq.dep.stamp reslistpager.dep.stamp sortseq.dep.stamp wasastringtoquery.dep.stamp wasatorcl.dep.stamp pathhash.dep.stamp rcldb.dep.stamp rcldoc.dep.stamp rclquery.dep.stamp searchdata.dep.stamp stemdb.dep.stamp stoplist.dep.stamp base64.dep.stamp conftree.dep.stamp copyfile.dep.stamp debuglog.dep.stamp execmd.dep.stamp fstreewalk.dep.stamp idfile.dep.stamp fileudi.dep.stamp md5.dep.stamp mimeparse.dep.stamp pathut.dep.stamp readfile.dep.stamp smallut.dep.stamp transcode.dep.stamp wipedir.dep.stamp x11mon.dep.stamp mime-getpart.dep.stamp mime-parsefull.dep.stamp mime-parseonlyheader.dep.stamp mime-printbody.dep.stamp mime-printdoc.dep.stamp mime-printheader.dep.stamp mime.dep.stamp convert.dep.stamp iodevice.dep.stamp iofactory.dep.stamp
|
||||
OBJS = rclaspell.o rclconfig.o rclinit.o textsplit.o unacpp.o csguess.o indexer.o mimetype.o htmlparse.o myhtmlparse.o mimehandler.o internfile.o mh_exec.o mh_html.o mh_mail.o mh_mbox.o mh_text.o docseq.o docseqdb.o docseqhist.o filtseq.o history.o plaintorich.o recollq.o reslistpager.o sortseq.o wasastringtoquery.o wasatorcl.o rcldb.o rcldoc.o rclquery.o searchdata.o stemdb.o stoplist.o base64.o conftree.o copyfile.o debuglog.o execmd.o fstreewalk.o idfile.o fileudi.o md5.o mimeparse.o pathut.o readfile.o smallut.o transcode.o wipedir.o x11mon.o mime-getpart.o mime-parsefull.o mime-parseonlyheader.o mime-printbody.o mime-printdoc.o mime-printheader.o mime.o convert.o iodevice.o iofactory.o
|
||||
DEPS = rclaspell.dep.stamp rclconfig.dep.stamp rclinit.dep.stamp textsplit.dep.stamp unacpp.dep.stamp csguess.dep.stamp indexer.dep.stamp mimetype.dep.stamp htmlparse.dep.stamp myhtmlparse.dep.stamp mimehandler.dep.stamp internfile.dep.stamp mh_exec.dep.stamp mh_html.dep.stamp mh_mail.dep.stamp mh_mbox.dep.stamp mh_text.dep.stamp docseq.dep.stamp docseqdb.dep.stamp docseqhist.dep.stamp filtseq.dep.stamp history.dep.stamp plaintorich.dep.stamp recollq.dep.stamp reslistpager.dep.stamp sortseq.dep.stamp wasastringtoquery.dep.stamp wasatorcl.dep.stamp rcldb.dep.stamp rcldoc.dep.stamp rclquery.dep.stamp searchdata.dep.stamp stemdb.dep.stamp stoplist.dep.stamp base64.dep.stamp conftree.dep.stamp copyfile.dep.stamp debuglog.dep.stamp execmd.dep.stamp fstreewalk.dep.stamp idfile.dep.stamp fileudi.dep.stamp md5.dep.stamp mimeparse.dep.stamp pathut.dep.stamp readfile.dep.stamp smallut.dep.stamp transcode.dep.stamp wipedir.dep.stamp x11mon.dep.stamp mime-getpart.dep.stamp mime-parsefull.dep.stamp mime-parseonlyheader.dep.stamp mime-printbody.dep.stamp mime-printdoc.dep.stamp mime-printheader.dep.stamp mime.dep.stamp convert.dep.stamp iodevice.dep.stamp iofactory.dep.stamp
|
||||
|
||||
librcl.a : $(DEPS) $(OBJS) unac.o
|
||||
ar ru librcl.a $(OBJS) unac.o
|
||||
@ -71,8 +71,6 @@ wasastringtoquery.o : ../query/wasastringtoquery.cpp
|
||||
$(CXX) $(ALL_CXXFLAGS) -c ../query/wasastringtoquery.cpp
|
||||
wasatorcl.o : ../query/wasatorcl.cpp
|
||||
$(CXX) $(ALL_CXXFLAGS) -c ../query/wasatorcl.cpp
|
||||
pathhash.o : ../rcldb/pathhash.cpp
|
||||
$(CXX) $(ALL_CXXFLAGS) -c ../rcldb/pathhash.cpp
|
||||
rcldb.o : ../rcldb/rcldb.cpp
|
||||
$(CXX) $(ALL_CXXFLAGS) -c ../rcldb/rcldb.cpp
|
||||
rcldoc.o : ../rcldb/rcldoc.cpp
|
||||
@ -227,9 +225,6 @@ wasastringtoquery.dep.stamp : ../query/wasastringtoquery.cpp
|
||||
wasatorcl.dep.stamp : ../query/wasatorcl.cpp
|
||||
$(CXX) -M $(ALL_CXXFLAGS) ../query/wasatorcl.cpp > wasatorcl.dep
|
||||
touch wasatorcl.dep.stamp
|
||||
pathhash.dep.stamp : ../rcldb/pathhash.cpp
|
||||
$(CXX) -M $(ALL_CXXFLAGS) ../rcldb/pathhash.cpp > pathhash.dep
|
||||
touch pathhash.dep.stamp
|
||||
rcldb.dep.stamp : ../rcldb/rcldb.cpp
|
||||
$(CXX) -M $(ALL_CXXFLAGS) ../rcldb/rcldb.cpp > rcldb.dep
|
||||
touch rcldb.dep.stamp
|
||||
@ -324,7 +319,6 @@ include reslistpager.dep
|
||||
include sortseq.dep
|
||||
include wasastringtoquery.dep
|
||||
include wasatorcl.dep
|
||||
include pathhash.dep
|
||||
include rcldb.dep
|
||||
include rcldoc.dep
|
||||
include rclquery.dep
|
||||
|
||||
@ -32,7 +32,6 @@ ${depth}/query/reslistpager.cpp \
|
||||
${depth}/query/sortseq.cpp \
|
||||
${depth}/query/wasastringtoquery.cpp \
|
||||
${depth}/query/wasatorcl.cpp \
|
||||
${depth}/rcldb/pathhash.cpp \
|
||||
${depth}/rcldb/rcldb.cpp \
|
||||
${depth}/rcldb/rcldoc.cpp \
|
||||
${depth}/rcldb/rclquery.cpp \
|
||||
|
||||
@ -1,104 +0,0 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: pathhash.cpp,v 1.6 2008-07-28 12:24:15 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "pathhash.h"
|
||||
#include "md5.h"
|
||||
#include "base64.h"
|
||||
|
||||
#ifndef NO_NAMESPACES
|
||||
using std::string;
|
||||
namespace Rcl {
|
||||
#endif /* NO_NAMESPACES */
|
||||
|
||||
// Debug only
|
||||
#ifdef PATHHASH_HEX
|
||||
static void md5hexprint(const unsigned char hash[16], string &out)
|
||||
{
|
||||
out.erase();
|
||||
out.reserve(33);
|
||||
static const char hex[]="0123456789abcdef";
|
||||
for (int i = 0; i < 16; i++) {
|
||||
out.append(1, hex[hash[i] >> 4]);
|
||||
out.append(1, hex[hash[i] & 0x0f]);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Size of the hashed result (base64 of 16 bytes of md5, minus 2 pad chars)
|
||||
#define HASHLEN 22
|
||||
|
||||
// Convert longish paths by truncating and appending hash of path
|
||||
// The full length of the base64-encoded (minus pad) of the md5 is 22 chars
|
||||
// We append this to the truncated path
|
||||
void pathHash(const std::string &path, std::string &phash, unsigned int maxlen)
|
||||
{
|
||||
if (maxlen < HASHLEN) {
|
||||
fprintf(stderr, "pathHash: internal error: requested len too small\n");
|
||||
abort();
|
||||
}
|
||||
|
||||
if (path.length() <= maxlen) {
|
||||
phash = path;
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute the md5
|
||||
unsigned char chash[16];
|
||||
MD5_CTX ctx;
|
||||
MD5Init(&ctx);
|
||||
MD5Update(&ctx, (const unsigned char *)(path.c_str()+maxlen-HASHLEN),
|
||||
path.length() - (maxlen - HASHLEN));
|
||||
MD5Final(chash, &ctx);
|
||||
|
||||
#ifdef PATHHASH_HEX
|
||||
string hex;
|
||||
md5hexprint(chash, hex);
|
||||
printf("hex [%s]\n", hex.c_str());
|
||||
#endif
|
||||
|
||||
// Encode it to ascii. This shouldn't be strictly necessary as
|
||||
// xapian terms can be binary
|
||||
string hash;
|
||||
base64_encode(string((char *)chash, 16), hash);
|
||||
// We happen to know there will be 2 pad chars in there, that we
|
||||
// don't need as this won't ever be decoded. Resulting length is 22
|
||||
hash.resize(hash.length() - 2);
|
||||
|
||||
// Truncate path and append hash
|
||||
phash = path.substr(0, maxlen - HASHLEN) + hash;
|
||||
}
|
||||
#ifndef NO_NAMESPACES
|
||||
}
|
||||
#endif // NO_NAMESPACES
|
||||
|
||||
#ifdef TEST_PATHHASH
|
||||
#include <stdio.h>
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
string path="/usr/lib/toto.cpp";
|
||||
string hash;
|
||||
pathHash(path, hash);
|
||||
printf("hash [%s]\n", hash.c_str());
|
||||
|
||||
}
|
||||
#endif // TEST_PATHHASH
|
||||
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* This program 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 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#ifndef _PATHHASH_H_INCLUDED_
|
||||
#define _PATHHASH_H_INCLUDED_
|
||||
/* @(#$Id: pathhash.h,v 1.3 2006-11-15 14:57:53 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
|
||||
#ifndef NO_NAMESPACES
|
||||
using std::string;
|
||||
namespace Rcl {
|
||||
#endif
|
||||
|
||||
extern void pathHash(const string &path, string &hash,
|
||||
unsigned int len);
|
||||
|
||||
|
||||
#ifndef NO_NAMESPACES
|
||||
}
|
||||
#endif
|
||||
#endif /* _PATHHASH_H_INCLUDED_ */
|
||||
@ -44,7 +44,6 @@ using namespace std;
|
||||
#include "debuglog.h"
|
||||
#include "pathut.h"
|
||||
#include "smallut.h"
|
||||
#include "pathhash.h"
|
||||
#include "utf8iter.h"
|
||||
#include "searchdata.h"
|
||||
#include "rclquery.h"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user