mirror of
https://github.com/netfun2000/ip2region.git
synced 2026-02-27 09:44:31 +08:00
content buffer directly as vectorIndex
This commit is contained in:
@@ -133,7 +133,7 @@ class XdbSearcher
|
||||
// read the segment index
|
||||
$buff = $this->read($p, self::SegmentIndexSize);
|
||||
if ($buff == null) {
|
||||
throw new Exception("failed to read segment index at ${$p}");
|
||||
throw new Exception("failed to read segment index at ${p}");
|
||||
}
|
||||
|
||||
$sip = self::getLong($buff, 0);
|
||||
@@ -296,16 +296,6 @@ class XdbSearcher
|
||||
return self::loadVectorIndex($handle);
|
||||
}
|
||||
|
||||
// load vector index from the specified buffer
|
||||
public static function loadVectorIndexFromBuff($cBuff) {
|
||||
$len = self::VectorIndexRows * self::VectorIndexCols * self::SegmentIndexSize;
|
||||
if (strlen($cBuff) < (self::HeaderInfoLength + $len)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return substr($cBuff, self::HeaderInfoLength, $len);
|
||||
}
|
||||
|
||||
// load the xdb content from a file handle
|
||||
public static function loadContent($handle) {
|
||||
if (fseek($handle, 0, SEEK_END) == -1) {
|
||||
|
||||
Reference in New Issue
Block a user