mirror of
https://github.com/lionsoul2014/ip2region.git
synced 2025-12-08 19:25:22 +00:00
Bug fixed: Adjust the super header length to 8192 for all client implementation
This commit is contained in:
parent
eab6259b13
commit
5f3bddec08
@ -43,7 +43,9 @@ typedef unsigned int uint_t;
|
||||
typedef unsigned long ulong_t;
|
||||
|
||||
#define INDEX_BLOCK_LENGTH 12
|
||||
#define TOTAL_HEADER_LENGTH 4096
|
||||
|
||||
//thats 8 * 1024
|
||||
#define TOTAL_HEADER_LENGTH 8192
|
||||
|
||||
/*
|
||||
* ip2region properties struct
|
||||
|
||||
@ -44,7 +44,7 @@ typedef unsigned int uint_t;
|
||||
typedef unsigned long ulong_t;
|
||||
|
||||
#define INDEX_BLOCK_LENGTH 12
|
||||
#define TOTAL_HEADER_LENGTH 4096
|
||||
#define TOTAL_HEADER_LENGTH 8192
|
||||
|
||||
/*
|
||||
* ip2region properties struct
|
||||
|
||||
@ -9,8 +9,8 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
INDEX_BLOCK_LENGTH = 12
|
||||
TOTAL_HEADER_LENGTH = 4096
|
||||
INDEX_BLOCK_LENGTH = 12
|
||||
TOTAL_HEADER_LENGTH = 8192
|
||||
)
|
||||
|
||||
var err error
|
||||
|
||||
@ -32,12 +32,12 @@ public class DbConfig
|
||||
}
|
||||
|
||||
this.totalHeaderSize = totalHeaderSize;
|
||||
this.indexBlockSize = 4096; //4 * 1024
|
||||
this.indexBlockSize = 8192; //4 * 2048
|
||||
}
|
||||
|
||||
public DbConfig() throws DbMakerConfigException
|
||||
{
|
||||
this(8192);
|
||||
this(8 * 2048);
|
||||
}
|
||||
|
||||
public int getTotalHeaderSize()
|
||||
|
||||
@ -18,7 +18,7 @@ var lastIndexPtr = 0;
|
||||
var superBlock = new Buffer(8);
|
||||
|
||||
var indexBlockLength = 12;
|
||||
var totalHeaderLength = 4096;
|
||||
var totalHeaderLength = 8192;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
*/
|
||||
|
||||
defined('INDEX_BLOCK_LENGTH') or define('INDEX_BLOCK_LENGTH', 12);
|
||||
defined('TOTAL_HEADER_LENGTH') or define('TOTAL_HEADER_LENGTH', 4096);
|
||||
defined('TOTAL_HEADER_LENGTH') or define('TOTAL_HEADER_LENGTH', 8192);
|
||||
|
||||
class Ip2Region
|
||||
{
|
||||
|
||||
@ -110,7 +110,7 @@ class Ip2Region(object):
|
||||
#pass the super block
|
||||
self.__f.seek(8)
|
||||
#read the header block
|
||||
b = self.__f.read(4086)
|
||||
b = self.__f.read(8192)
|
||||
#parse the header block
|
||||
sip = None
|
||||
ptr = None
|
||||
|
||||
@ -110,7 +110,7 @@ class Ip2Region(object):
|
||||
#pass the super block
|
||||
self.__f.seek(8)
|
||||
#read the header block
|
||||
b = self.__f.read(4086)
|
||||
b = self.__f.read(8192)
|
||||
#parse the header block
|
||||
sip = None
|
||||
ptr = None
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user