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.c File Reference
#include "unarr-imp.h"
+ Include dependency graph for unarr.c:

Go to the source code of this file.

Functions

ar_archivear_open_archive (ar_stream *stream, size_t struct_size, ar_archive_close_fn close, ar_parse_entry_fn parse_entry, ar_entry_get_name_fn get_name, ar_entry_uncompress_fn uncompress, ar_get_global_comment_fn get_comment, off64_t first_entry_offset)
 
void ar_close_archive (ar_archive *ar)
 
bool ar_at_eof (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)
 
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)
 
void ar_log (const char *prefix, const char *file, int line, const char *msg,...)
 

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_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 }
void ar_log ( const char *  prefix,
const char *  file,
int  line,
const char *  msg,
  ... 
)

Definition at line 95 of file unarr.c.

96 {
97  va_list args;
98  va_start(args, msg);
99  if (prefix)
100  fprintf(stderr, "%s ", prefix);
101  if (strrchr(file, '/'))
102  file = strrchr(file, '/') + 1;
103  if (strrchr(file, '\\'))
104  file = strrchr(file, '\\') + 1;
105  fprintf(stderr, "%s:%d: ", file, line);
106  vfprintf(stderr, msg, args);
107  fprintf(stderr, "\n");
108  va_end(args);
109 }
ar_archive* ar_open_archive ( ar_stream stream,
size_t  struct_size,
ar_archive_close_fn  close,
ar_parse_entry_fn  parse_entry,
ar_entry_get_name_fn  get_name,
ar_entry_uncompress_fn  uncompress,
ar_get_global_comment_fn  get_comment,
off64_t  first_entry_offset 
)

Definition at line 6 of file unarr.c.

9 {
10  ar_archive *ar = malloc(struct_size);
11  if (!ar)
12  return NULL;
13  memset(ar, 0, struct_size);
14  ar->close = close;
15  ar->parse_entry = parse_entry;
16  ar->get_name = get_name;
17  ar->uncompress = uncompress;
18  ar->get_comment = get_comment;
19  ar->stream = stream;
20  ar->entry_offset_first = first_entry_offset;
21  ar->entry_offset_next = first_entry_offset;
22  return ar;
23 }

+ Here is the caller graph for this function:

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 }