/[LeafOK_CVS]/pvpgn-1.7.4/src/tinycdb/cdb_seq.c
ViewVC logotype

Contents of /pvpgn-1.7.4/src/tinycdb/cdb_seq.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Tue Jun 6 03:41:38 2006 UTC (19 years, 9 months ago) by sysadm
Branch: GNU, MAIN
CVS Tags: arelease, HEAD
Changes since 1.1: +0 -0 lines
Content type: text/x-csrc
Error occurred while calculating annotation data.
no message

1 /* sequential record retrieval routines
2 *
3 * This file is a part of tinycdb package by Michael Tokarev, mjt@corpit.ru.
4 * Public domain.
5 */
6
7 #include "common/setup_before.h"
8 #include "cdb_int.h"
9 #include "common/setup_after.h"
10
11 int
12 cdb_seqnext(unsigned *cptr, struct cdb *cdbp) {
13 unsigned klen, vlen;
14 unsigned pos = *cptr;
15 unsigned dend = cdbp->cdb_dend;
16 const unsigned char *mem = cdbp->cdb_mem;
17 if (pos > dend - 8)
18 return 0;
19 klen = cdb_unpack(mem + pos);
20 vlen = cdb_unpack(mem + pos + 4);
21 pos += 8;
22 if (dend - klen < pos || dend - vlen < pos + klen)
23 return errno = EPROTO, -1;
24 cdbp->cdb_kpos = pos;
25 cdbp->cdb_klen = klen;
26 cdbp->cdb_vpos = pos + klen;
27 cdbp->cdb_vlen = vlen;
28 *cptr = pos + klen + vlen;
29 return 1;
30 }

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1