Increment the copy source address to match the data read offset. (seek):
2000-02-09 NotZed <notzed@zedzone.helixcode.com> * camel/camel-simple-data-wrapper-stream.c (read): Increment the copy source address to match the data read offset. (seek): Actually implement the seek. svn path=/trunk/; revision=1722
This commit is contained in:
@ -1,5 +1,9 @@
|
|||||||
2000-02-09 NotZed <notzed@zedzone.helixcode.com>
|
2000-02-09 NotZed <notzed@zedzone.helixcode.com>
|
||||||
|
|
||||||
|
* camel/camel-simple-data-wrapper-stream.c (read): Increment the
|
||||||
|
copy source address to match the data read offset.
|
||||||
|
(seek): Actually implement the seek.
|
||||||
|
|
||||||
* camel/camel-mime-part-utils.c
|
* camel/camel-mime-part-utils.c
|
||||||
(camel_mime_part_store_stream_in_buffer): If we get a -1 read,
|
(camel_mime_part_store_stream_in_buffer): If we get a -1 read,
|
||||||
DONT update the total bytes, and try and truncate the array in
|
DONT update the total bytes, and try and truncate the array in
|
||||||
|
|||||||
@ -50,7 +50,7 @@ read (CamelStream *stream,
|
|||||||
|
|
||||||
len = MIN (n, array->len - wrapper_stream->current_position);
|
len = MIN (n, array->len - wrapper_stream->current_position);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
memcpy (buffer, array->data, len);
|
memcpy (buffer, wrapper_stream->current_position + array->data, len);
|
||||||
wrapper_stream->current_position += len;
|
wrapper_stream->current_position += len;
|
||||||
return len;
|
return len;
|
||||||
} else {
|
} else {
|
||||||
@ -161,13 +161,18 @@ seek (CamelSeekableStream *stream,
|
|||||||
new_position = wrapper_stream->current_position + offset;
|
new_position = wrapper_stream->current_position + offset;
|
||||||
break;
|
break;
|
||||||
case CAMEL_STREAM_END:
|
case CAMEL_STREAM_END:
|
||||||
new_position = wrapper_stream->wrapper->byte_array->len;
|
new_position = wrapper_stream->wrapper->byte_array->len - offset;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
g_warning ("Unknown CamelStreamSeekPolicy %d.", policy);
|
g_warning ("Unknown CamelStreamSeekPolicy %d.", policy);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (new_position<0)
|
||||||
|
new_position = 0;
|
||||||
|
else if (new_position>=wrapper_stream->wrapper->byte_array->len)
|
||||||
|
new_position = wrapper_stream->wrapper->byte_array->len-1;
|
||||||
|
|
||||||
wrapper_stream->current_position = new_position;
|
wrapper_stream->current_position = new_position;
|
||||||
return new_position;
|
return new_position;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user