-/* $Id: apropos_db.c,v 1.24 2011/12/16 12:06:35 kristaps Exp $ */
+/* $Id: apropos_db.c,v 1.27 2011/12/20 21:41:11 schwarze Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2011 Ingo Schwarze <schwarze@openbsd.org>
{ TYPE_Va, "Va" },
{ TYPE_Va, "Vt" },
{ TYPE_Xr, "Xr" },
- { INT_MAX, "any" },
+ { UINT64_MAX, "any" },
{ 0, NULL }
};
const struct mchars *mc,
struct db_val *dbv, char **buf)
{
- const struct db_val *vp;
+ struct db_val raw_dbv;
/* Are our sizes sane? */
if (k->size < 2 || sizeof(struct db_val) != v->size)
if ('\0' != ((const char *)k->data)[(int)k->size - 1])
return(0);
- vp = v->data;
norm_string((const char *)k->data, mc, buf);
- dbv->rec = betoh32(vp->rec);
- dbv->mask = betoh64(vp->mask);
+ memcpy(&raw_dbv, v->data, v->size);
+ dbv->rec = betoh32(raw_dbv.rec);
+ dbv->mask = betoh64(raw_dbv.mask);
return(1);
}
static size_t
norm_utf8(unsigned int cp, char out[7])
{
- size_t rc;
+ int rc;
rc = 0;
return(0);
out[rc] = '\0';
- return(rc);
+ return((size_t)rc);
}
/*
return(0);
cp = val->data;
- rec->res.rec = *(recno_t *)key->data;
+ assert(sizeof(recno_t) == key->size);
+ memcpy(&rec->res.rec, key->data, key->size);
rec->res.volume = index;
if ('d' == (type = *cp++))