#include <unistd.h>
#include <time.h>
+#include <lib-lib/mem.h>
+
#include "sha1.h"
#include "lib.h"
#include "pgplib.h"
#include "pgppacket.h"
-#include "lib/mem.h"
-
#define CHUNKSIZE 1024
static unsigned char *pbuf = NULL;
unsigned char *pgp_read_packet (FILE * fp, size_t * len)
{
size_t used = 0;
- long startpos;
+ off_t startpos;
unsigned char ctb;
unsigned char b;
size_t material;
- startpos = ftell (fp);
+ startpos = ftello (fp);
if (!plen) {
- plen = CHUNKSIZE;
- pbuf = safe_malloc (plen);
+ pbuf = p_new(char, plen = CHUNKSIZE);
}
if (fread (&ctb, 1, 1, fp) < 1) {
bail:
- fseek (fp, startpos, SEEK_SET);
+ fseeko (fp, startpos, SEEK_SET);
return NULL;
}
void pgp_release_packet (void)
{
plen = 0;
- FREE (&pbuf);
+ p_delete(&pbuf);
}