Subversion Repositories freemyipod

Rev

Rev 447 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
445 theseven 1
/*
450 theseven 2
 * Helper functions to handle compression via UCL
445 theseven 3
 *
450 theseven 4
 * Copyright (C) 2011 Michael Sparmann
5
 *
6
 * Based on: Helper functions to handle compression via zlib
7
 *
445 theseven 8
 * Copyright (C) 2007-2008 Julian Brown
9
 * Copyright (C) 2008 Mike Frysinger
10
 *
11
 * Licensed under the GPL-2 or later.
12
 */
13
 
14
#ifndef __ELF2FLT_COMPRESS_H__
15
#define __ELF2FLT_COMPRESS_H__
16
 
447 theseven 17
//#include <zlib.h>
445 theseven 18
 
19
typedef enum
20
{
21
  INVALID,
22
  UNCOMPRESSED,
23
  COMPRESSED
24
} stream_type;
25
 
26
/* Tagged union holding either a regular FILE* handle or a zlib gzFile
27
   handle.  */
28
typedef struct
29
{
30
  stream_type type;
31
  const char *mode;
447 theseven 32
  FILE *filep;
33
  char* buffer;
34
  int bufsize;
35
  int bufused;
36
//  union
37
//    {
38
//      FILE *filep;
39
//      gzFile gzfilep;
40
//    } u;
445 theseven 41
} stream;
42
 
43
int fopen_stream_u(stream *fp, const char *path, const char *mode);
44
size_t fread_stream(void *ptr, size_t size, size_t nmemb, stream *str);
45
size_t fwrite_stream(const void *ptr, size_t size, size_t nmemb, stream *str);
46
int fclose_stream(stream *str);
47
int ferror_stream(stream *str);
48
int fseek_stream(stream *str, long offset, int whence);
49
void reopen_stream_compressed(stream *str);
50
void transfer(stream *ifp, stream *ofp, int count);
51
 
52
#endif