rbb 01/01/23 14:24:08
Modified: buckets apr_buckets_file.c
include apr_buckets.h
Log:
Fix the file_buckets, so that we record the offset correctly. This allows
us to split a file and still read from it correctly.
Revision Changes Path
1.24 +6 -6 apr-util/buckets/apr_buckets_file.c
Index: apr_buckets_file.c
===================================================================
RCS file: /home/cvs/apr-util/buckets/apr_buckets_file.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -b -w -u -r1.23 -r1.24
--- apr_buckets_file.c 2001/01/23 07:28:43 1.23
+++ apr_buckets_file.c 2001/01/23 22:24:03 1.24
@@ -107,7 +107,7 @@
* file mmapped */
apr_status_t status;
apr_pool_t *p = APR_GET_POOL(f);
- if ((status = apr_mmap_create(&mm, f, a->offset, e->length,
+ if ((status = apr_mmap_create(&mm, f, s->start, e->length,
APR_MMAP_READ, p)) != APR_SUCCESS) {
mm = NULL;
}
@@ -133,8 +133,8 @@
}
/* Handle offset ... */
- if (a->offset) {
- rv = apr_seek(f, APR_SET, &a->offset);
+ if (s->start) {
+ rv = apr_seek(f, APR_SET, &s->start);
if (rv != APR_SUCCESS) {
free(buf);
return rv;
@@ -155,7 +155,7 @@
/* If we have more to read from the file, then create another bucket
*/
if (length > 0) {
- b = apr_bucket_create_file(f, a->offset + (*len), length);
+ b = apr_bucket_create_file(f, s->start + (*len), length);
APR_BUCKET_INSERT_AFTER(e, b);
}
#if APR_HAS_MMAP
@@ -168,6 +168,7 @@
{
apr_bucket *b;
apr_bucket_shared *s;
+ apr_bucket_shared *temp = e->data;
apr_bucket_file *f;
apr_bucket_split_shared(e, offset);
@@ -175,7 +176,7 @@
s = b->data;
f = s->data;
- f->offset = offset;
+ s->start = offset + temp->start;
return APR_SUCCESS;
}
@@ -190,7 +191,6 @@
return NULL;
}
f->fd = fd;
- f->offset = offset;
b = apr_bucket_make_shared(b, f, offset, offset + len);
if (b == NULL) {
1.67 +0 -2 apr-util/include/apr_buckets.h
Index: apr_buckets.h
===================================================================
RCS file: /home/cvs/apr-util/include/apr_buckets.h,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -b -w -u -r1.66 -r1.67
--- apr_buckets.h 2001/01/23 07:28:44 1.66
+++ apr_buckets.h 2001/01/23 22:24:06 1.67
@@ -559,8 +559,6 @@
apr_bucket_refcount refcount;
/** The file this bucket refers to */
apr_file_t *fd;
- /** The offset into the file */
- apr_off_t offset;
};
/* ***** Bucket Brigade Functions ***** */