Fix dtinfo search engine

This commit is contained in:
Ulrich Wilkens
2014-04-01 04:45:33 +02:00
committed by Jon Trulson
parent 0254ebc0b4
commit 38dfc9e235
68 changed files with 252 additions and 135 deletions

View File

@@ -164,7 +164,7 @@ BitVector& BitVector::shiftLeftOneBit()
unsigned int lsb = 0;
for ( unsigned int i=f_words-1; i>=0; i++ ) {
for ( int i=f_words-1; i>=0; i++ ) {
msb = (BIT_TEST((int)f_array[i], wordWithMSBSet)) ? wordWithMSBSet : 0x0;
f_array[i] = f_array[i] << 1;
f_array[i] |= lsb;

View File

@@ -55,7 +55,7 @@ public:
enum TagType { StartTag, EndTag, AttributeSection, OliasAttribute, NoTag };
DocParser(Resolver &);
~DocParser();
virtual ~DocParser();
// returns a boolean
unsigned int parse(istream &);

View File

@@ -183,7 +183,7 @@ ostream& TypeValues::print(ostream& out, int tabs) const
return out;
}
unsigned hash(const FeatureDef& key)
unsigned fhash(const FeatureDef& key)
{
return key.name() -> hash();
}

View File

@@ -57,7 +57,7 @@ class Resolver : public Destructable
{
public:
Resolver(PathTable& pTable, Renderer& r);
~Resolver();
virtual ~Resolver();
// beginElement returns a non-zero value if element is to be ignored
unsigned int beginElement(Element*);

View File

@@ -25,13 +25,13 @@
#include "Types.h"
#include "VariableTable.h"
static unsigned hash(const Symbol& key)
static unsigned shash(const Symbol& key)
{
return key.hash();
}
VariableTable::VariableTable()
: hashTable<Symbol,Expression>(hash)
: hashTable<Symbol,Expression>(shash)
{
}

View File

@@ -67,7 +67,7 @@ class info_lib : public primitive
public:
info_lib(char** set_name_array, char** list_name_array,
char* info_lib_dir = 0, char* selected_base_name = 0,
char* info_lib_name = "", int descriptor = -1);
char* info_lib_name = (char*)"", int descriptor = -1);
virtual ~info_lib();

View File

@@ -71,7 +71,7 @@ static char sccsid[] = "@(#)mktemp.c 8.1 (Berkeley) 6/4/93";
extern int errno;
#endif
static int _gettemp();
static int _gettemp(char*, int*);
int mkstemp(path)
char *path;
@@ -142,7 +142,7 @@ _gettemp(path, doopen)
if (*trv == 'z')
*trv++ = 'a';
else {
if (isdigit(*trv))
if (isdigit((unsigned char) *trv))
*trv = 'a';
else
++*trv;

View File

@@ -63,7 +63,7 @@ void value_vector<T>::_grow(size_t t)
template <class T>
T value_vector<T>::operator[](size_t i) const
{
if ( i<0 || i>= f_size )
if ( (long)i < 0 || i >= f_size )
throw(ccBoundaryException(0, f_size-1, i));
else
return f_array[i];
@@ -72,7 +72,7 @@ T value_vector<T>::operator[](size_t i) const
template <class T>
T& value_vector<T>::operator[](size_t i)
{
if ( i<0 || i>= f_size )
if ( (long)i < 0 || i >= f_size )
throw(ccBoundaryException(0, f_size-1, i));
else
return f_array[i];

View File

@@ -218,7 +218,7 @@ Exception::relocate (Exception **exception, int length)
// Slide the specified exception down to fill the hole below it.
if (g_next_avail >= (char *) *exception)
abort();
memcpy (g_next_avail, *exception, length);
memcpy (g_next_avail, (void*)*exception, length);
*exception = (Exception *) g_next_avail;
g_next_avail = ((char *) *exception) + length;
}
@@ -233,13 +233,15 @@ Exception::is (const char *type, const char *this_class)
{
PRINTF (("Type specified is <%s>\n", type));
while (isalnum (*type) && isalnum (*this_class) &&
while (isalnum ((unsigned char) *type) &&
isalnum ((unsigned char) *this_class) &&
*type++ == *this_class++);
if (isalnum (*type) || isalnum (*this_class))
if (isalnum ((unsigned char) *type) ||
isalnum ((unsigned char) *this_class))
return (0);
// Check for pointer types
while (isspace (*type))
while (isspace ((unsigned char) *type))
{
type++;
}

View File

@@ -276,7 +276,7 @@ int write_spec(buckets& bs, params& pms, buffer& mphf_buffer)
int compact(buckets& bs, unsigned s[], int t, Boolean swap)
{
int target, k, i, remaining_bits, branch;
int target, k, i, remaining_bits, branch = 0;
unsigned unsigned_g, high_part_bits;
unsigned lower_part_bits = 0;

View File

@@ -135,7 +135,7 @@ void fast_mphf::init_persistent_info(persistent_info* x)
r = 0;
v_seed = 0;
t = 0;
hash::init_data_member();
ihash::init_data_member();
}
}
@@ -495,14 +495,14 @@ int fast_mphf::print_bits(unsigned x, ostream& out)
int fast_mphf::cdr_sizeof()
{
return long_pstring::cdr_sizeof() + hash::cdr_sizeof() +
return long_pstring::cdr_sizeof() + ihash::cdr_sizeof() +
6*sizeof(unsigned int);
}
io_status fast_mphf::cdrOut(buffer& buf)
{
long_pstring::cdrOut(buf);
hash::cdrOut(buf);
ihash::cdrOut(buf);
buf.put(v_no_ps);
buf.put(v_p1);
@@ -517,7 +517,7 @@ io_status fast_mphf::cdrOut(buffer& buf)
io_status fast_mphf::cdrIn(buffer& buf)
{
long_pstring::cdrIn(buf);
hash::cdrIn(buf);
ihash::cdrIn(buf);
buf.get(v_no_ps);
buf.get(v_p1);

View File

@@ -102,7 +102,7 @@ public:
friend class fast_mphf;
};
class fast_mphf : public long_pstring, public hash
class fast_mphf : public long_pstring, public ihash
{
public:

View File

@@ -51,16 +51,16 @@
#include <stdio.h>
#include "index/hash.h"
hash::hash() : v_key_set_sz(0), v_hash_func_sz(0), v_hash_tbl_sz(0)
ihash::ihash() : v_key_set_sz(0), v_hash_func_sz(0), v_hash_tbl_sz(0)
{
}
hash::~hash()
ihash::~ihash()
{
}
void
hash::init_data_member(unsigned int a, unsigned int b, unsigned int c)
ihash::init_data_member(unsigned int a, unsigned int b, unsigned int c)
{
v_key_set_sz = a;
v_hash_func_sz = b;
@@ -68,15 +68,15 @@ hash::init_data_member(unsigned int a, unsigned int b, unsigned int c)
}
int hash::cdr_sizeof()
int ihash::cdr_sizeof()
{
return sizeof(v_key_set_sz) + sizeof(v_hash_func_sz) + sizeof(v_hash_tbl_sz);
}
io_status hash::cdrOut(buffer& buf)
io_status ihash::cdrOut(buffer& buf)
{
/*
MESSAGE(cerr, "hash::cdrOut");
MESSAGE(cerr, "ihash::cdrOut");
debug(cerr, v_hash_tbl_sz);
debug(cerr, v_key_set_sz);
*/
@@ -86,9 +86,9 @@ debug(cerr, v_key_set_sz);
return done;
}
io_status hash::cdrIn(buffer& buf)
io_status ihash::cdrIn(buffer& buf)
{
//MESSAGE(cerr, "hash::cdrIn");
//MESSAGE(cerr, "ihash::cdrIn");
buf.get(v_key_set_sz);
buf.get(v_hash_func_sz);

View File

@@ -55,12 +55,12 @@
#include "utility/buffer.h"
#include "utility/key.h"
class hash
class ihash
{
public:
hash();
virtual ~hash() ;
ihash();
virtual ~ihash() ;
virtual void init_data_member(unsigned int v_key_set_sz = 0,
unsigned int v_hash_func_sz = 0,

View File

@@ -92,7 +92,7 @@ void delete_name_oid_rec_f(const void* name_oid_ptr);
class mark_t : private ostring
{
public:
mark_t(char* marks = "\t\n ");
mark_t(char* marks = (char*)"\t\n ");
virtual ~mark_t() {};
friend istream& operator >>(istream&, mark_t&);
friend ostream& operator <<(ostream&, mark_t&);

View File

@@ -198,7 +198,7 @@ unique_id (void)
buf[i] = mapping[(int)buf[i]];
}
} while (!isalnum (buf[0]));
} while (!isalnum ((unsigned char) buf[0]));
return (buf);
}

View File

@@ -136,14 +136,14 @@ void DtMmdbQuit()
}
void* operator new( size_t sz )
void* operator new( size_t sz ) throw(std::bad_alloc)
{
void* p = (void*)malloc(sz);
//printf("a::operator new called(). sz= %d, allo=%x\n", sz, p);
return p;
}
void operator delete( void* p )
void operator delete( void* p ) throw()
{
//printf("a::operator free called(). alloc= %x\n", p);
if ( p )

View File

@@ -35,7 +35,7 @@ class collectionIterator
{
public:
collectionIterator(info_base*, int set_position);
~collectionIterator();
virtual ~collectionIterator();
// advance the iterator to the next position.
// A newly constructed iterator's position is

View File

@@ -145,22 +145,25 @@ int gethostname(char* name, int namelen)
int compare_stream(ostringstream& x, ostringstream& y)
{
if ( x.str().size() != y.str().size() ) {
cerr << x.str().size() << "---" << y.str().size() << endl;
//debug(cerr, x.str().c_str());
//debug(cerr, y.str().c_str());
string xstr = x.str();
string ystr = y.str();
if ( xstr.size() != ystr.size() ) {
cerr << xstr.size() << "---" << ystr.size() << endl;
//debug(cerr, xstr.c_str());
//debug(cerr, ystr.c_str());
return 1;
} else {
char* u = (char *)x.str().c_str();
char* v = (char *)y.str().c_str();
char* u = (char *)xstr.c_str();
char* v = (char *)ystr.c_str();
//debug(cerr, u);
//debug(cerr, v);
//fprintf(stderr, "u=%s, pcount() = %d\n", u, x.pcount());
//fprintf(stderr, "v=%s, pcount() = %d\n", v, y.pcount());
if ( memcmp(u, v, x.str().size()) != 0 ) {
if ( memcmp(u, v, xstr.size()) != 0 ) {
STDERR_MESSAGE("two streams do not match.");
debug(cerr, u);
debug(cerr, v);