The #ifdef #else #endif pat of the following code snippet seems to prevent
successfully parsing the remaining code. (I tried to keep only the relevant
parts of the code, therefore it is a nonsense in its current form obviousy)
-------
static int tdb_oob(TDB_CONTEXT *tdb, tdb_off len, int probe)
{
struct stat st;
if (len <= tdb->map_size)
return 0;
return 0;
}
static int tdb_write(TDB_CONTEXT *tdb, tdb_off off, void *buf, tdb_len len)
{
if (tdb->map_ptr)
memcpy(off + (char *)tdb->map_ptr, buf, len);
#ifdef HAVE_PWRITE
else if (pwrite(tdb->fd, buf, len, off) != (ssize_t)len) {
#else
else if (lseek(tdb->fd, off, SEEK_SET) != off
|| write(tdb->fd, buf, len) != (ssize_t)len) {
#endif
return TDB_ERRCODE(TDB_ERR_IO, -1);
}
return 0;
}
static int tdb_read(TDB_CONTEXT *tdb,tdb_off off,void *buf,tdb_len len,int cv)
{
if (tdb->map_ptr)
memcpy(buf, off + (char *)tdb->map_ptr, len);
#ifdef HAVE_PREAD
else if (pread(tdb->fd, buf, len, off) != (ssize_t)len) {
#else
else if (lseek(tdb->fd, off, SEEK_SET) != off
|| read(tdb->fd, buf, len) != (ssize_t)len) {
#endif
return TDB_ERRCODE(TDB_ERR_IO, -1);
}
return 0;
}
static char *tdb_alloc_read(TDB_CONTEXT *tdb, tdb_off offset, tdb_len len)
{
char *buf;
return buf;
}
--
<http://forum.pspad.com/read.php?4,42192,42192>
PSPad freeware editor http://www.pspad.com