From: Ralph Ronnquist Date: Sat, 13 Nov 2021 09:08:57 +0000 (+1100) Subject: use signed offsets X-Git-Tag: 0.3~11 X-Git-Url: https://git.rrq.au/?a=commitdiff_plain;h=488587f5db0b708d3fab7a5e59c7c66c3688759a;p=rrq%2Ffusefile.git use signed offsets --- diff --git a/fusefile.c b/fusefile.c index 5aa2917..00f7f7f 100644 --- a/fusefile.c +++ b/fusefile.c @@ -36,16 +36,16 @@ struct Source { char *filename; - size_t from; - size_t to; - size_t start; // starting position in concatenated file + ssize_t from; + ssize_t to; + ssize_t start; // starting position in concatenated file int fd; }; static struct { struct Source *array; int count; - size_t size; + ssize_t size; } sources; #if DEBUG @@ -76,6 +76,7 @@ static size_t scan_source(char *in,struct Source *p) { m = i; } } + fprintf( stderr, "m=%d s=%d\n", m, s ); // Copy the filename, and set from and to p->filename = strndup( in, ( s < 0 )? e : s ); struct stat buf; @@ -87,6 +88,7 @@ static size_t scan_source(char *in,struct Source *p) { if ( p->from < 0 ) { p->from = 0; } + fprintf( stderr, "p->from=%ld\n", p->from ); p->to = ( m < 0 )? buf.st_size : atol( in+m+1 ); if ( p->from > p->to || p->to > buf.st_size ) { return 1;