Platon Technologies
neprihlásený Prihlásiť Registrácia
SlovakEnglish
open source software development oslavujeme 10 rokov vývoja otvoreného softvéru! Sobota, 20. apríl 2024

Súbor: [Platon] / cpdf / filter.c (stiahnutie)

Revízia 1.4, Sun Nov 10 16:58:30 2002 UTC (21 years, 5 months ago) by lynx

Zmeny od 1.3: +2 -2 [lines]

Some minor changes in parse.c
Added alpha-beta-gama-delta drawing code.

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <zconf.h>
#include <zlib.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 *) malloc(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 corupted!\n");
    }
    return NULL;
}
void *dctdecode(void)
{
    return NULL;
}

/*
char *lzwdecode(char *encoded)
{
    return;
}*/

Platon Group <platon@platon.sk> http://platon.sk/
Copyright © 2002-2006 Platon Group
Stránka používa redakčný systém Metafox
Na začiatok