mail-index-util.c revision 765b5eec222d2546247e74cb9bcabd43633d2e4a
/* Copyright (c) 2003-2016 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "bsearch-insert-pos.h"
#include "mail-index-private.h"
#if WORDS_BIGENDIAN
/* FIXME: Unfortunately these functions were originally written to use
endian-specific code and we can't avoid that without breaking backwards
compatibility. When we do break it, just select one of these. */
{
offset >>= 2;
}
{
return 0;
return (((offset & 0x0000007f)) |
}
#else
{
offset >>= 2;
}
{
return 0;
}
#endif
{
/* number continues as long as the highest bit is set */
while (num >= 0x80) {
*p += 1;
num >>= 7;
}
**p = num;
*p += 1;
}
{
const uint8_t *c = *p;
unsigned int bits = 0;
for (;;) {
/* we should never see EOF */
*num_r = 0;
return -1;
}
if (*c < 0x80)
break;
bits += 7;
c++;
}
/* broken input */
*p = end;
*num_r = 0;
return -1;
}
*p = c + 1;
return 0;
}
{
}
{
}
{
sizeof(uint32_t) + aligned_record_size,
}
void *old_record)
{
void *p;
unsigned int idx, aligned_record_size;
/* records need to be 32bit aligned */
if (!array_is_created(array))
/* already there, update */
if (old_record != NULL) {
/* save the old record before overwriting it */
}
return TRUE;
} else {
/* insert */
return FALSE;
}
}