"Fossies" - the Fresh Open Source Software Archive

Member "xorriso-1.5.4/libburn/source.c" (30 Jan 2021, 1410 Bytes) of package /linux/misc/xorriso-1.5.4.pl02.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "source.c" see the Fossies "Dox" file reference documentation.

    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 
   29 enum burn_source_status burn_track_set_source(struct burn_track *t,
   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 
   41 struct burn_source *burn_source_new(void)
   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 */
   56 int burn_source_cancel(struct burn_source *src)
   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 }