Súbor: [Platon] / cpdf / filter.c (stiahnutie)
Revízia 1.6, Tue Feb 11 20:10:30 2003 UTC (21 years, 9 months ago) by lynx
Zmeny od 1.5: +6 -4
[lines]
improved reading and working with objects
remove read bug from get_startxref() if PDF uses \r\n as a newline.
better reading streams.
AND MANY MANY MORE! :))) but you still cant use it :-D
|
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <zconf.h>
#include <zlib.h>
#include "utils.h"
#include "filter.h"
#include "parse.h"
void *filter(char number, uint8_t * src, uint32_t srclen, void *dest,
unsigned long *destlen)
{
switch (number) {
case FLATEDECODE:
return flatedecode(dest, destlen, src, srclen);
/*case DCTDECODE:
return dctdecode(); */
case HEXDECODE:
return asciihexdecode(dest, src, srclen);
/*case DECODE85:
return ascii85decode(); */
}
return NULL;
}
void *asciihexdecode(void *dest, uint8_t * src, int srclen)
{
char *decode = (char *) xmalloc(srclen + 2);
decode[0] = '<';
strncpy(decode + 1, (char *) src, srclen);
decode[srclen + 1] = '>';
dest = (void *) hex(decode);
return dest;
}
/*
char *ascii85decode(char *encoded)
{
return;
}
*/
void *flatedecode(Bytef * dest, uLong * destlen, Bytef * src, uLong srclen)
{
int i;
i = uncompress(dest, destlen, src, srclen);
switch (i) {
case Z_OK:
return dest;
case Z_MEM_ERROR:
fprintf(stderr, "Not enough memory!\n");
break;
case Z_BUF_ERROR:
fprintf(stderr, "Not enough room in output buffer!\n");
break;
case Z_DATA_ERROR:
fprintf(stderr, "Input buffer is corrupted!\n");
}
abort();
}
void *dctdecode(void)
{
return NULL;
}
/*
char *lzwdecode(char *encoded)
{
return;
}*/
Platon Group <platon@platon.sk> http://platon.sk/
|