Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
unarr.h File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
+ Include dependency graph for unarr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define UNARR_API_VERSION   100
 

Typedefs

typedef int64_t off64_t
 
typedef int64_t time64_t
 
typedef struct ar_stream_s ar_stream
 
typedef struct ar_archive_s ar_archive
 

Functions

ar_streamar_open_file (const char *path)
 
ar_streamar_open_memory (const void *data, size_t datalen)
 
void ar_close (ar_stream *stream)
 
size_t ar_read (ar_stream *stream, void *buffer, size_t count)
 
bool ar_seek (ar_stream *stream, off64_t offset, int origin)
 
bool ar_skip (ar_stream *stream, off64_t count)
 
off64_t ar_tell (ar_stream *stream)
 
void ar_close_archive (ar_archive *ar)
 
bool ar_parse_entry (ar_archive *ar)
 
bool ar_parse_entry_at (ar_archive *ar, off64_t offset)
 
bool ar_parse_entry_for (ar_archive *ar, const char *entry_name)
 
bool ar_at_eof (ar_archive *ar)
 
const char * ar_entry_get_name (ar_archive *ar)
 
off64_t ar_entry_get_offset (ar_archive *ar)
 
size_t ar_entry_get_size (ar_archive *ar)
 
time64_t ar_entry_get_filetime (ar_archive *ar)
 
bool ar_entry_uncompress (ar_archive *ar, void *buffer, size_t count)
 
size_t ar_get_global_comment (ar_archive *ar, void *buffer, size_t count)
 
ar_archivear_open_rar_archive (ar_stream *stream)
 
ar_archivear_open_tar_archive (ar_stream *stream)
 
ar_archivear_open_zip_archive (ar_stream *stream, bool deflatedonly)
 
ar_archivear_open_7z_archive (ar_stream *stream)
 

Macro Definition Documentation

#define UNARR_API_VERSION   100

Definition at line 13 of file unarr.h.

Typedef Documentation

typedef struct ar_archive_s ar_archive

Definition at line 45 of file unarr.h.

typedef struct ar_stream_s ar_stream

Definition at line 17 of file unarr.h.

typedef int64_t off64_t

Definition at line 10 of file unarr.h.

typedef int64_t time64_t

Definition at line 11 of file unarr.h.

Function Documentation

bool ar_at_eof ( ar_archive ar)

Definition at line 32 of file unarr.c.

33 {
34  return ar->at_eof;
35 }
void ar_close ( ar_stream stream)

Definition at line 21 of file stream.c.

22 {
23  if (stream)
24  stream->close(stream->data);
25  free(stream);
26 }

+ Here is the caller graph for this function:

void ar_close_archive ( ar_archive ar)

Definition at line 25 of file unarr.c.

26 {
27  if (ar)
28  ar->close(ar);
29  free(ar);
30 }

+ Here is the caller graph for this function:

time64_t ar_entry_get_filetime ( ar_archive ar)

Definition at line 78 of file unarr.c.

79 {
80  return ar->entry_filetime;
81 }
const char* ar_entry_get_name ( ar_archive ar)

Definition at line 63 of file unarr.c.

64 {
65  return ar->get_name(ar);
66 }

+ Here is the caller graph for this function:

off64_t ar_entry_get_offset ( ar_archive ar)

Definition at line 68 of file unarr.c.

69 {
70  return ar->entry_offset;
71 }
size_t ar_entry_get_size ( ar_archive ar)

Definition at line 73 of file unarr.c.

74 {
75  return ar->entry_size_uncompressed;
76 }

+ Here is the caller graph for this function:

bool ar_entry_uncompress ( ar_archive ar,
void *  buffer,
size_t  count 
)

Definition at line 83 of file unarr.c.

84 {
85  return ar->uncompress(ar, buffer, count);
86 }

+ Here is the caller graph for this function:

size_t ar_get_global_comment ( ar_archive ar,
void *  buffer,
size_t  count 
)

Definition at line 88 of file unarr.c.

89 {
90  if (!ar->get_comment)
91  return 0;
92  return ar->get_comment(ar, buffer, count);
93 }
ar_archive* ar_open_7z_archive ( ar_stream stream)
ar_stream* ar_open_file ( const char *  path)

Definition at line 86 of file stream.c.

87 {
88  FILE *f = path ? fopen(path, "rb") : NULL;
89  if (!f)
90  return NULL;
92 }

+ Here is the caller graph for this function:

ar_stream* ar_open_memory ( const void *  data,
size_t  datalen 
)

Definition at line 147 of file stream.c.

148 {
149  struct MemoryStream *stm = malloc(sizeof(struct MemoryStream));
150  if (!stm)
151  return NULL;
152  stm->data = data;
153  stm->length = datalen;
154  stm->offset = 0;
156 }
ar_archive* ar_open_rar_archive ( ar_stream stream)

Definition at line 205 of file rar.c.

206 {
207  char signature[FILE_SIGNATURE_SIZE];
208  if (!ar_seek(stream, 0, SEEK_SET))
209  return NULL;
210  if (ar_read(stream, signature, sizeof(signature)) != sizeof(signature))
211  return NULL;
212  if (memcmp(signature, "Rar!\x1A\x07\x00", sizeof(signature)) != 0) {
213  if (memcmp(signature, "Rar!\x1A\x07\x01", sizeof(signature)) == 0)
214  warn("RAR 5 format isn't supported");
215  else if (memcmp(signature, "RE~^", 4) == 0)
216  warn("Ancient RAR format isn't supported");
217  else if (memcmp(signature, "MZ", 2) == 0 || memcmp(signature, "\x7F\x45LF", 4) == 0)
218  warn("SFX archives aren't supported");
219  return NULL;
220  }
221 
223 }

+ Here is the caller graph for this function:

ar_archive* ar_open_tar_archive ( ar_stream stream)
ar_archive* ar_open_zip_archive ( ar_stream stream,
bool  deflatedonly 
)
bool ar_parse_entry ( ar_archive ar)

Definition at line 37 of file unarr.c.

38 {
39  return ar->parse_entry(ar, ar->entry_offset_next);
40 }

+ Here is the caller graph for this function:

bool ar_parse_entry_at ( ar_archive ar,
off64_t  offset 
)

Definition at line 42 of file unarr.c.

43 {
44  ar->at_eof = false;
45  return ar->parse_entry(ar, offset ? offset : ar->entry_offset_first);
46 }

+ Here is the caller graph for this function:

bool ar_parse_entry_for ( ar_archive ar,
const char *  entry_name 
)

Definition at line 48 of file unarr.c.

49 {
50  ar->at_eof = false;
51  if (!entry_name)
52  return false;
54  return false;
55  do {
56  const char *name = ar_entry_get_name(ar);
57  if (name && strcmp(name, entry_name) == 0)
58  return true;
59  } while (ar_parse_entry(ar));
60  return false;
61 }
size_t ar_read ( ar_stream stream,
void *  buffer,
size_t  count 
)

Definition at line 28 of file stream.c.

29 {
30  return stream->read(stream->data, buffer, count);
31 }

+ Here is the caller graph for this function:

bool ar_seek ( ar_stream stream,
off64_t  offset,
int  origin 
)

Definition at line 33 of file stream.c.

34 {
35  return stream->seek(stream->data, offset, origin);
36 }

+ Here is the caller graph for this function:

bool ar_skip ( ar_stream stream,
off64_t  count 
)

Definition at line 38 of file stream.c.

39 {
40  return stream->seek(stream->data, count, SEEK_CUR);
41 }

+ Here is the caller graph for this function:

off64_t ar_tell ( ar_stream stream)

Definition at line 43 of file stream.c.

44 {
45  return stream->tell(stream->data);
46 }

+ Here is the caller graph for this function: