From cdb198bb0bbb1c9994751c528173f83906c67b93 Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 23 Jan 2012 09:36:47 +0000 Subject: [PATCH] Introduced burn_offst_source_new() flag bit0 which bans size changes --- libburn/trunk/libburn/file.c | 9 +++++++-- libburn/trunk/libburn/file.h | 4 ++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libburn/trunk/libburn/file.c b/libburn/trunk/libburn/file.c index f878daee..2baee15d 100644 --- a/libburn/trunk/libburn/file.c +++ b/libburn/trunk/libburn/file.c @@ -779,7 +779,7 @@ static off_t offst_get_size(struct burn_source *source) if ((fs = offst_auth(source, 0)) == NULL) return (off_t) 0; - return fs->size; + return fs->nominal_size; } static int offst_set_size(struct burn_source *source, off_t size) @@ -788,7 +788,10 @@ static int offst_set_size(struct burn_source *source, off_t size) if ((fs = offst_auth(source, 0)) == NULL) return 0; - fs->size = size; + + fs->nominal_size = size; + if (fs->size <= 0 || fs->size_adjustable) + fs->size = size; return 1; } @@ -907,6 +910,8 @@ struct burn_source *burn_offst_source_new( } fs->start = start; fs->size = size; + fs->size_adjustable = !(flag & 1); + fs->nominal_size = size; fs->running = 0; fs->pos = 0; inp->refcount++; /* make sure inp lives longer than src */ diff --git a/libburn/trunk/libburn/file.h b/libburn/trunk/libburn/file.h index 49268e11..5c50e370 100644 --- a/libburn/trunk/libburn/file.h +++ b/libburn/trunk/libburn/file.h @@ -82,6 +82,10 @@ struct burn_source_offst { struct burn_source *prev; off_t start; off_t size; + int size_adjustable; + + /* for set_size/get_size */ + int nominal_size; /* To help offst_free() */ struct burn_source *next;