36#define CHUNK_SIZE 1024
60 if (fread(
PacketBuf + *used, 1, material, fp) < material)
86 startpos = ftello(fp);
96 if (fread(&ctb, 1, 1, fp) < 1)
110 bool partial =
false;
116 if (fread(&b, 1, 1, fp) < 1)
129 material = (b - 192) * 256;
130 if (fread(&b, 1, 1, fp) < 1)
140 material = 1 << (b & 0x1f);
145 unsigned char buf[4];
146 if (fread(buf, 4, 1, fp) < 1)
151 material = (size_t) buf[0] << 24;
152 material |= buf[1] << 16;
153 material |= buf[2] << 8;
166 PacketBuf[0] = 0x80 | ((ctb >> 2) & 0x0f);
173 if (fread(&b, 1, 1, fp) < 1)
194 for (
int i = 0; i < bytes; i++)
196 if (fread(&b, 1, 1, fp) < 1)
202 material = (material << 8) + b;
bool mutt_file_seek(FILE *fp, LOFF_T offset, int whence)
Wrapper for fseeko with error handling.
#define MUTT_MEM_REALLOC(pptr, n, type)
#define MUTT_MEM_MALLOC(n, type)
Convenience wrapper for the library headers.
static unsigned char * PacketBuf
Cached PGP data packet.
void pgp_release_packet(void)
Free the cached PGP packet.
static size_t PacketBufLen
Length of cached packet.
static int read_material(size_t material, size_t *used, FILE *fp)
Read PGP data into a buffer.
#define CHUNK_SIZE
Amount of data to read at once.
unsigned char * pgp_read_packet(FILE *fp, size_t *len)
Read a PGP packet from a file.