20 num = buf[3]; num <<= 8;
21 num += buf[2]; num <<= 8;
22 num += buf[1]; num <<= 8;
49 if (fstat(fd,&st) == 0)
50 if (st.st_size <= 0xffffffff) {
51 x = mmap(0,st.st_size,PROT_READ,MAP_SHARED,fd,0);
62 if ((pos > c->
size) || (c->
size - pos < len))
goto FORMAT;
71 while ((r == -1) && (errno == EINTR));
72 if (r == -1)
return -1;
73 if (r == 0)
goto FORMAT;
85static int match(
struct cdb *c,
char *key,
unsigned int len,
uint32 pos)
93 if (
cdb_read(c,buf,n,pos) == -1)
return -1;
110 if (
cdb_read(c,buf,8,(u << 3) & 2047) == -1)
return -1;
130 if (
cdb_read(c,buf,8,pos) == -1)
return -1;
133 switch(match(c,key,len,pos + 8)) {
138 c->
dpos = pos + 8 + len;
int read(int _str, void *_buf, int _b)
void cdb_init(struct cdb *c, int fd)
uint32 cdb_unpack(unsigned char *buf)
int cdb_findnext(struct cdb *c, char *key, unsigned int len)
void cdb_free(struct cdb *c)
uint32 cdb_hashadd(uint32 h, unsigned char c)
int cdb_read(struct cdb *c, char *buf, unsigned int len, uint32 pos)
int cdb_find(struct cdb *c, char *key, unsigned int len)
void cdb_findstart(struct cdb *c)
uint32 cdb_hash(char *buf, unsigned int len)
void uint32_unpack(char *, uint32 *)
int seek_set(int, seek_pos)
int byte_diff(const void *, unsigned int, const void *)
void byte_copy(void *, unsigned int, const void *)