1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

Remove decode_encoded and associated backend functions.

This function was unused and only the dummy backend implemented it
correctly.  Fixing bug 534 will probably require adding this function
back again, but I think it will be easier to do it from scratch than
fix the bogus implementations we had here.
This commit is contained in:
Kalle Olavi Niemitalo 2007-02-24 21:35:29 +02:00 committed by Kalle Olavi Niemitalo
parent 1e7f26c33d
commit 20ba46ddde
5 changed files with 3 additions and 48 deletions

View File

@ -101,14 +101,6 @@ bzip2_read(struct stream_encoded *stream, unsigned char *buf, int len)
return len - data->fbz_stream.avail_out;
}
static unsigned char *
bzip2_decode(struct stream_encoded *stream, unsigned char *data, int len,
int *new_len)
{
*new_len = len;
return data;
}
#ifdef CONFIG_SMALL
#define BZIP2_SMALL 1
#else
@ -194,7 +186,6 @@ struct decoding_backend bzip2_decoding_backend = {
bzip2_extensions,
bzip2_open,
bzip2_read,
bzip2_decode,
bzip2_decode_buffer,
bzip2_close,
};

View File

@ -51,14 +51,6 @@ dummy_read(struct stream_encoded *stream, unsigned char *data, int len)
return safe_read(((struct dummy_enc_data *) stream->data)->fd, data, len);
}
static unsigned char *
dummy_decode(struct stream_encoded *stream, unsigned char *data, int len,
int *new_len)
{
*new_len = len;
return data;
}
static unsigned char *
dummy_decode_buffer(unsigned char *data, int len, int *new_len)
{
@ -84,7 +76,6 @@ static struct decoding_backend dummy_decoding_backend = {
dummy_extensions,
dummy_open,
dummy_read,
dummy_decode,
dummy_decode_buffer,
dummy_close,
};
@ -135,16 +126,9 @@ read_encoded(struct stream_encoded *stream, unsigned char *data, int len)
return decoding_backends[stream->encoding]->read(stream, data, len);
}
/* Decode the given chunk of data in the context of @stream. @data contains the
* original data chunk, @len bytes long. The resulting decoded data chunk is
* *@new_len bytes long. */
unsigned char *
decode_encoded(struct stream_encoded *stream, unsigned char *data, int len,
int *new_len)
{
return decoding_backends[stream->encoding]->decode(stream, data, len, new_len);
}
/* Decode an entire file from a buffer. This function is not suitable
* for parts of files. @data contains the original data, @len bytes
* long. The resulting decoded data chunk is *@new_len bytes long. */
unsigned char *
decode_encoded_buffer(enum stream_encoding encoding, unsigned char *data, int len,
int *new_len)

View File

@ -24,14 +24,12 @@ struct decoding_backend {
unsigned char **extensions;
int (*open)(struct stream_encoded *stream, int fd);
int (*read)(struct stream_encoded *stream, unsigned char *data, int len);
unsigned char *(*decode)(struct stream_encoded *stream, unsigned char *data, int len, int *new_len);
unsigned char *(*decode_buffer)(unsigned char *data, int len, int *new_len);
void (*close)(struct stream_encoded *stream);
};
struct stream_encoded *open_encoded(int, enum stream_encoding);
int read_encoded(struct stream_encoded *, unsigned char *, int);
unsigned char *decode_encoded(struct stream_encoded *, unsigned char *, int, int *);
unsigned char *decode_encoded_buffer(enum stream_encoding encoding, unsigned char *data, int len, int *new_len);
void close_encoded(struct stream_encoded *);

View File

@ -37,14 +37,6 @@ gzip_read(struct stream_encoded *stream, unsigned char *data, int len)
return gzread((gzFile *) stream->data, data, len);
}
static unsigned char *
gzip_decode(struct stream_encoded *stream, unsigned char *data, int len,
int *new_len)
{
*new_len = len;
return data;
}
/* The following code for decoding gzip in memory is a mix of code from zlib's
* gzio.c file copyrighted 1995-2002 by Jean-loup Gailly and the costumized
@ -244,7 +236,6 @@ struct decoding_backend gzip_decoding_backend = {
gzip_extensions,
gzip_open,
gzip_read,
gzip_decode,
gzip_decode_buffer,
gzip_close,
};

View File

@ -126,14 +126,6 @@ lzma_read(struct stream_encoded *stream, unsigned char *buf, int len)
return len;
}
static unsigned char *
lzma_decode(struct stream_encoded *stream, unsigned char *data, int len,
int *new_len)
{
*new_len = len;
return data;
}
static unsigned char *
lzma_decode_buffer(unsigned char *data, int len, int *new_len)
{
@ -197,7 +189,6 @@ struct decoding_backend lzma_decoding_backend = {
lzma_extensions,
lzma_open,
lzma_read,
lzma_decode,
lzma_decode_buffer,
lzma_close,
};