DtMmdb: replace ostring with std::string.
This commit is contained in:
@@ -80,7 +80,7 @@ size_t btree_index::handler_to_inv_idx(const handler& query)
|
||||
{
|
||||
get_key_string(query);
|
||||
|
||||
data_t k(v_static_key.get(), v_static_key.size());
|
||||
data_t k(v_static_key.c_str(), v_static_key.size());
|
||||
|
||||
if ( v_idx_agent_ptr -> member(k) == false )
|
||||
throw(stringException("first_of_invlist(): key is not in btree"));
|
||||
|
||||
@@ -81,7 +81,7 @@ if ( v_static_key.get() )
|
||||
MESSAGE(cerr, "************");
|
||||
*/
|
||||
|
||||
return new data_t(v_static_key.get(), v_static_key.size());
|
||||
return new data_t(v_static_key.c_str(), v_static_key.size());
|
||||
}
|
||||
|
||||
Boolean
|
||||
|
||||
@@ -257,7 +257,7 @@ debug(cerr, k);
|
||||
throw(stringException("hash table empty"));
|
||||
}
|
||||
|
||||
i = v_tbl0 -> atoi(k.get(), k.size(), r, v_key_set_sz); // for halmphf
|
||||
i = v_tbl0 -> atoi(k.c_str(), k.size(), r, v_key_set_sz); // for halmphf
|
||||
|
||||
|
||||
if ( i < v_p1 ) {
|
||||
@@ -275,7 +275,7 @@ debug(cerr, k);
|
||||
//i = v_tbl1 -> atoi(k, c_bit+r+1) + gv;
|
||||
//debug(cerr, c_bit+r);
|
||||
|
||||
i = v_tbl1 -> atoi(k.get(), k.size(), c_bit+r+1, v_hash_tbl_sz) + gv; // for halmphf
|
||||
i = v_tbl1 -> atoi(k.c_str(), k.size(), c_bit+r+1, v_hash_tbl_sz) + gv; // for halmphf
|
||||
|
||||
|
||||
return i % v_hash_tbl_sz;
|
||||
@@ -422,7 +422,7 @@ fast_mphf::print_mapping(const char *key_file, int option)
|
||||
//debug(cerr, option);
|
||||
MESSAGE(cerr, "print_mapping()");
|
||||
|
||||
char string[LBUFSIZ];
|
||||
char str[LBUFSIZ];
|
||||
fstream in(key_file, ios::in);
|
||||
|
||||
if ( !in ) {
|
||||
@@ -432,23 +432,23 @@ fast_mphf::print_mapping(const char *key_file, int option)
|
||||
char *hash_table = new char[v_hash_tbl_sz];
|
||||
for (unsigned int i = 0; i < v_hash_tbl_sz; hash_table[i++] = 0 );
|
||||
|
||||
ostring lbuf(LBUFSIZ);
|
||||
string lbuf; lbuf.reserve(LBUFSIZ);
|
||||
|
||||
|
||||
while ( in.getline(string, LBUFSIZ, '\n') ) {
|
||||
while ( in.getline(str, LBUFSIZ, '\n') ) {
|
||||
|
||||
// string[strlen(string)-1] = '\0';
|
||||
// str[strlen(str)-1] = '\0';
|
||||
|
||||
//debug(cerr, string);
|
||||
//debug(cerr, strlen(string));
|
||||
//debug(cerr, str);
|
||||
//debug(cerr, strlen(str));
|
||||
|
||||
lbuf.reset();
|
||||
lbuf.set(string, strlen(string));
|
||||
lbuf.clear();
|
||||
lbuf.assign(str, strlen(str));
|
||||
|
||||
int hash = hashTo(lbuf) ;
|
||||
|
||||
if ( option == 1 ) {
|
||||
cout << " string = " << string;
|
||||
cout << " string = " << str;
|
||||
cout << ", hash = " << hash << "\n";
|
||||
}
|
||||
|
||||
@@ -457,7 +457,7 @@ fast_mphf::print_mapping(const char *key_file, int option)
|
||||
else
|
||||
hash_table[hash] = 1;
|
||||
|
||||
in.getline(string, LBUFSIZ, '\n');
|
||||
in.getline(str, LBUFSIZ, '\n');
|
||||
}
|
||||
|
||||
MESSAGE(cerr, "print_mapping() done");
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
key_type* c_index::v_static_key_ptr;
|
||||
#define v_static_key (*v_static_key_ptr)
|
||||
#else
|
||||
key_type c_index::v_static_key(LBUFSIZ);
|
||||
key_type c_index::v_static_key;
|
||||
#endif
|
||||
|
||||
void c_index::init_persistent_info(persistent_info* x)
|
||||
@@ -66,6 +66,7 @@ void c_index::init_persistent_info(persistent_info* x)
|
||||
c_index::c_index(c_code_t c_cd) : composite(c_cd), v_inv_lists_hd(NULL)
|
||||
{
|
||||
v_cmp_selector = 0;
|
||||
v_static_key.reserve(LBUFSIZ);
|
||||
}
|
||||
|
||||
oid_list_handler* c_index::operator()(int ind)
|
||||
@@ -108,27 +109,21 @@ oid_t c_index::first_of_invlist(int ind)
|
||||
Boolean c_index::get_key_string(const handler& t) const
|
||||
{
|
||||
ostringstream out;
|
||||
int len;
|
||||
|
||||
((handler&)t) -> asciiOut(out);
|
||||
len = out.str().size();
|
||||
v_static_key.set_size(len);
|
||||
*((char *) memcpy(v_static_key.get(), out.str().c_str(), len) + len) = '\0';
|
||||
v_static_key = out.str();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Boolean c_index::get_key_string(const oid_t& t) const
|
||||
{
|
||||
v_static_key.reset();
|
||||
int len;
|
||||
v_static_key.clear();
|
||||
|
||||
ostringstream out(v_static_key.c_str());
|
||||
|
||||
ostringstream out(v_static_key.get());
|
||||
t.asciiOut(out);
|
||||
|
||||
len = out.str().size();
|
||||
v_static_key.set_size(len);
|
||||
*((char *) memcpy(v_static_key.get(), out.str().c_str(), len) + len) = '\0';
|
||||
v_static_key = out.str();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -150,13 +150,13 @@ debug(cerr, (void*)(v_mphf->operator->()));
|
||||
v_sz = (*v_mphf) -> keysetsize();
|
||||
(*v_inv_lists_hd) -> expand_space(v_sz);
|
||||
|
||||
key_type key(LBUFSIZ);
|
||||
|
||||
key_type key; key.reserve(LBUFSIZ);
|
||||
|
||||
#ifdef DEBUG
|
||||
int i = 0;
|
||||
#endif
|
||||
|
||||
while ( in >> key ) {
|
||||
while (std::getline(in, key)) {
|
||||
|
||||
oid_t key_id(c_code_t(0), 0);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user