Changeset 55

Show
Ignore:
Timestamp:
1999-09-17 12:11:44 (9 years ago)
Author:
richard
Message:

Changed termname to be a string, so that map works correctly.

Location:
trunk/xapian-core
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/xapian-core/backends/da/da_database.cc

    r52 r55  
    9797    termname name = term_id_to_name(id); 
    9898 
    99     int len = strlen(name); 
     99    int len = name.length(); 
    100100    if(len > 126) throw OmError("Term too long for DA implementation."); 
    101101    byte * k = (byte *) malloc(len + 1); 
    102102    if(k == NULL) throw OmError(strerror(ENOMEM)); 
    103103    k[0] = len + 1; 
    104     memcpy(k + 1, name, len); 
     104    memcpy(k + 1, name.c_str(), len); 
    105105 
    106106    struct terminfo ti; 
     
    126126{ 
    127127    termid id; 
     128 
    128129    id = termidmap[name]; 
    129130    if (!id) { 
    130131        id = termidvec.size() + 1; 
     132        printf("Adding term `%s' as ID %d\n", name.c_str(), id); 
    131133        termidvec.push_back(name); 
    132134        termidmap[name] = id; 
    133135    } 
    134     printf("Looking up term `%s': ID = %d\n", name, id); 
     136    printf("Looking up term `%s': ID = %d\n", name.c_str(), id); 
    135137    return id; 
    136138} 
     
    140142{ 
    141143    if (id <= 0 || id > termidvec.size()) throw RangeError("invalid termid"); 
    142     printf("Looking up termid %d: name = `%s'\n", id, termidvec[id - 1]); 
     144    printf("Looking up termid %d: name = `%s'\n", id, termidvec[id - 1].c_str()); 
    143145    return termidvec[id - 1]; 
    144146} 
  • trunk/xapian-core/common/omtypes.h

    r26 r55  
    66typedef unsigned int termid; 
    77typedef unsigned int docid; 
    8 typedef char *termname; 
    98typedef unsigned int weight; 
    109 
     10#ifdef __cplusplus 
     11typedef string termname; 
     12#endif 
     13 
    1114#endif /* _omtypes_h_ */