xorriso  1.5.4.pl02
About: GNU xorriso creates, loads, manipulates and writes ISO 9660 filesystem images with Rock Ridge extensions. It is suitable for incremental data backup and for production of bootable ISO 9660 images. GNU xorriso is a statical compilation of the libraries libburn, libisofs, libisoburn, and libjte.
  Fossies Dox: xorriso-1.5.4.pl02.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

source.c
Go to the documentation of this file.
1 /* -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 8; -*- */
2 
3 /* Copyright (c) 2004 - 2006 Derek Foreman, Ben Jansens
4  Copyright (c) 2006 - 2010 Thomas Schmitt <scdbackup@gmx.net>
5  Provided under GPL version 2 or later.
6 */
7 
8 #ifdef HAVE_CONFIG_H
9 #include "../config.h"
10 #endif
11 
12 
13 #include <stdlib.h>
14 #include <string.h>
15 #include "libburn.h"
16 #include "source.h"
17 #include "structure.h"
18 #include "init.h"
19 
20 void burn_source_free(struct burn_source *src)
21 {
22  if (--src->refcount < 1) {
23  if (src->free_data)
24  src->free_data(src);
25  free(src);
26  }
27 }
28 
30  struct burn_source *s)
31 {
32  s->refcount++;
33  t->source = s;
34 
35  /* ts A61031 */
36  t->open_ended = (s->get_size(s) <= 0);
37 
38  return BURN_SOURCE_OK;
39 }
40 
42 {
43  struct burn_source *out;
44 
45  /* ts A70825 , B11219 */
46  out = burn_alloc_mem(sizeof(struct burn_source), 1, 0);
47  if (out == NULL)
48  return NULL;
49 
50  out->refcount = 1;
51  return out;
52 }
53 
54 
55 /* ts A71223 */
57 {
58  if(src->read == NULL)
59  if(src->version > 0)
60  if(src->cancel != NULL)
61  src->cancel(src);
62  return 1;
63 }
64 
65 
66 /* ts B00922 */
67 int burn_source_read(struct burn_source *src, unsigned char *buffer, int size)
68 {
69  int ret;
70 
71  if (src->read != NULL)
72  ret = src->read(src, buffer, size);
73  else
74  ret = src->read_xt(src, buffer, size);
75  return ret;
76 }
void * burn_alloc_mem(size_t size, size_t count, int flag)
Definition: init.c:653
burn_source_status
Definition: libburn.h:281
@ BURN_SOURCE_OK
Definition: libburn.h:283
enum burn_source_status burn_track_set_source(struct burn_track *t, struct burn_source *s)
Definition: source.c:29
void burn_source_free(struct burn_source *src)
Definition: source.c:20
int burn_source_cancel(struct burn_source *src)
Definition: source.c:56
struct burn_source * burn_source_new(void)
Definition: source.c:41
int burn_source_read(struct burn_source *src, unsigned char *buffer, int size)
Definition: source.c:67
void(* free_data)(struct burn_source *)
Definition: libburn.h:533
off_t(* get_size)(struct burn_source *)
Definition: libburn.h:509
int(* read)(struct burn_source *, unsigned char *buffer, int size)
Definition: libburn.h:493
int(* cancel)(struct burn_source *source)
Definition: libburn.h:581
int refcount
Definition: libburn.h:469
int(* read_xt)(struct burn_source *, unsigned char *buffer, int size)
Definition: libburn.h:575
int version
Definition: libburn.h:572
int open_ended
Definition: structure.h:74
struct burn_source * source
Definition: structure.h:63