kcpolydb.h | kcpolydb.h | |||
---|---|---|---|---|
skipping to change at line 1309 | skipping to change at line 1309 | |||
size_t ksiz; | size_t ksiz; | |||
char* kbuf = cur->get_key(&ksiz, true); | char* kbuf = cur->get_key(&ksiz, true); | |||
if (kbuf) { | if (kbuf) { | |||
size_t kdist; | size_t kdist; | |||
if (oary) { | if (oary) { | |||
uint32_t kstack[128]; | uint32_t kstack[128]; | |||
uint32_t* kary = ksiz > sizeof(kstack) / sizeof(*kstack) ? | uint32_t* kary = ksiz > sizeof(kstack) / sizeof(*kstack) ? | |||
new uint32_t[ksiz] : kstack; | new uint32_t[ksiz] : kstack; | |||
size_t knum; | size_t knum; | |||
strutftoucs(kbuf, ksiz, kary, &knum); | strutftoucs(kbuf, ksiz, kary, &knum); | |||
kdist = std::labs((long)onum - (long)knum) > range ? | kdist = std::labs((long)onum - (long)knum) > (long)range ? | |||
UINT32MAX : strucsdist(oary, onum, kary, knum); | UINT32MAX : strucsdist(oary, onum, kary, knum); | |||
if (kary != kstack) delete[] kary; | if (kary != kstack) delete[] kary; | |||
} else { | } else { | |||
kdist = std::labs((long)origin.size() - (long)ksiz) > range ? | kdist = std::labs((long)origin.size() - (long)ksiz) > (long)r ange ? | |||
UINT32MAX : memdist(origin.data(), origin.size(), kbuf, k siz); | UINT32MAX : memdist(origin.data(), origin.size(), kbuf, k siz); | |||
} | } | |||
if (kdist <= range) { | if (kdist <= range) { | |||
std::string key(kbuf, ksiz); | std::string key(kbuf, ksiz); | |||
if ((int64_t)queue.size() < max) { | if ((int64_t)queue.size() < max) { | |||
SimilarKey skey = { kdist, key, curcnt }; | SimilarKey skey = { kdist, key, curcnt }; | |||
queue.push(skey); | queue.push(skey); | |||
} else { | } else { | |||
const SimilarKey& top = queue.top(); | const SimilarKey& top = queue.top(); | |||
if (!top.less(kdist, key, curcnt)) { | if (!top.less(kdist, key, curcnt)) { | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||