Changeset 55
- Timestamp:
- 1999-09-17 12:11:44 (9 years ago)
- Location:
- trunk/xapian-core
- Files:
-
- 2 modified
-
backends/da/da_database.cc (modified) (3 diffs)
-
common/omtypes.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/xapian-core/backends/da/da_database.cc
r52 r55 97 97 termname name = term_id_to_name(id); 98 98 99 int len = strlen(name);99 int len = name.length(); 100 100 if(len > 126) throw OmError("Term too long for DA implementation."); 101 101 byte * k = (byte *) malloc(len + 1); 102 102 if(k == NULL) throw OmError(strerror(ENOMEM)); 103 103 k[0] = len + 1; 104 memcpy(k + 1, name , len);104 memcpy(k + 1, name.c_str(), len); 105 105 106 106 struct terminfo ti; … … 126 126 { 127 127 termid id; 128 128 129 id = termidmap[name]; 129 130 if (!id) { 130 131 id = termidvec.size() + 1; 132 printf("Adding term `%s' as ID %d\n", name.c_str(), id); 131 133 termidvec.push_back(name); 132 134 termidmap[name] = id; 133 135 } 134 printf("Looking up term `%s': ID = %d\n", name , id);136 printf("Looking up term `%s': ID = %d\n", name.c_str(), id); 135 137 return id; 136 138 } … … 140 142 { 141 143 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()); 143 145 return termidvec[id - 1]; 144 146 } -
trunk/xapian-core/common/omtypes.h
r26 r55 6 6 typedef unsigned int termid; 7 7 typedef unsigned int docid; 8 typedef char *termname;9 8 typedef unsigned int weight; 10 9 10 #ifdef __cplusplus 11 typedef string termname; 12 #endif 13 11 14 #endif /* _omtypes_h_ */
