istream-base64-decoder.c revision 13984f1ae4258317236228de92adc1481ae4fc40
/* Copyright (c) 2012 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "base64.h"
#include "istream-private.h"
#include "istream-base64.h"
struct base64_decoder_istream {
struct istream_private istream;
};
{
if (size >= 4)
return 1;
/* we have less than one base64 block.
see if there is more data available. */
if (ret <= 0) {
return ret;
}
return 1;
}
static int
{
const unsigned char *data;
if (size == 0)
return 0;
/* can't fit everything to destination buffer.
write as much as we can. */
if (size == 0)
return -2;
}
return -1;
}
return pos > 0 ? 1 : 0;
}
{
struct base64_decoder_istream *bstream =
(struct base64_decoder_istream *)stream;
int ret;
do {
if (ret <= 0) {
/* base64 input with a partial block */
}
return ret;
}
/* encode as many blocks as fits into destination buffer */
return ret;
return post_count - pre_count;
}
static void
{
/* seeking backwards - go back to beginning and seek
forward from there. */
}
}
struct istream *
{
struct base64_decoder_istream *bstream;
}