dtinfo subdirectory DtMmdb

This commit is contained in:
Ulrich Wilkens
2013-08-28 19:16:37 +02:00
committed by Jon Trulson
parent 0be684281d
commit fbd81ef151
159 changed files with 735 additions and 588 deletions

View File

@@ -60,12 +60,13 @@ bucket::bucket(char* key, int orig_position, Boolean copy) :
{
char* x = 0;
int len;
switch (copy) {
case true:
x = new char[strlen(key)+1];
strcpy(x, key);
x[strlen(key)] = 0;
len = strlen(key);
x = new char[len + 1];
*((char *) memcpy(x, key, len) + len) = '\0';
break;
case false:
x = key;
@@ -90,12 +91,13 @@ bucket::~bucket()
int bucket::add_key(char* key, Boolean copy)
{
char *x = 0;
int len;
switch (copy) {
case true:
x = new char[strlen(key)+1];
strcpy(x, key);
x[strlen(key)] = 0;
len = strlen(key);
x = new char[len + 1];
*((char *) memcpy(x, key, len) + len) = '\0';
break;
case false:
x = key;
@@ -140,8 +142,8 @@ h_convertor(pms.v_n, 128, rnd)
{
v_bucket_array = new bucketPtr[v_no_buckets];
int i;
for ( i=0; i<v_no_buckets; v_bucket_array[i++] = 0);
unsigned int i;
for ( i=0; i < (unsigned int) v_no_buckets; v_bucket_array[i++] = 0);
//debug(cerr, pms);
@@ -188,7 +190,7 @@ int buckets::bucket_num(char* k, params& pms)
//debug(cerr, sum);
if ( sum < pms.v_p1 ) {
if ( sum < (int) pms.v_p1 ) {
sum %= pms.v_p2;
} else {
sum %= (pms.v_b - pms.v_p2);

View File

@@ -79,10 +79,10 @@ public:
protected:
short v_no_keys;
int v_orig_pos;
int v_count;
int v_control_bit;
int v_g_value;
int v_count;
int v_orig_pos;
slist_void_ptr_cell* key_ptr;
friend class buckets;

View File

@@ -277,7 +277,8 @@ 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;
unsigned unsigned_g, high_part_bits, lower_part_bits;
unsigned unsigned_g, high_part_bits;
unsigned lower_part_bits = 0;
remaining_bits = BITS_IN(unsigned);
k = target = 0;
@@ -331,7 +332,7 @@ debug(cerr, "=====");
branch = 0;
} else {
high_part_bits = getbits(unsigned_g,t,remaining_bits);
lower_part_bits = unsigned_g & ~(~0 << t-remaining_bits);
lower_part_bits = unsigned_g & ~(~0 << (t-remaining_bits));
lower_part_bits <<= (BITS_IN(unsigned)- (t-remaining_bits));
s[k++] = target | high_part_bits;

View File

@@ -62,9 +62,9 @@ struct partition_t {
void params::select_value(float bts)
{
int i;
unsigned int i;
for ( i=0; ; i++ ) {
if ( v_n <= partition_tbl[i].upper_bound )
if ( (int)v_n <= partition_tbl[i].upper_bound )
break;
}