/* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "numpack.h"
{
/* number continues as long as the highest bit is set */
while (num >= 0x80) {
num >>= 7;
}
}
{
const uint8_t *c = *p;
unsigned int bits = 0;
while (bits < 64) {
if (c == end)
return -1;
if (*c < 0x80)
break;
bits += 7;
c++;
}
bits += bits_required8(*c);
return -1;
*p = c + 1;
return 0;
}
{
return -1;
if (num > 4294967295U)
return -1;
return 0;
}