Hi Kristen,
On 11/02/2010 09:41 AM, Kristen Carlson Accardi wrote:
> On Thu, 14 Oct 2010 11:18:00 -0700
> Kristen Carlson Accardi <[email protected]> wrote:
>
>> ---
>> src/simfs.c | 6 ++----
>> 1 files changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/src/simfs.c b/src/simfs.c
>> index fd768ef..bcb6ff8 100644
>> --- a/src/simfs.c
>> +++ b/src/simfs.c
>> @@ -231,8 +231,7 @@ static void sim_fs_op_read_block_cb(const struct
>> ofono_error *error,
>> tocopy = MIN(256 - op->offset % 256,
>> op->num_bytes - op->current * 256);
>> } else {
>> - bufoff = (op->current - start_block - 1) * 256 +
>> - op->offset % 256;
>> + bufoff = op->current * 256;
>> dataoff = 0;
>> tocopy = MIN(256, op->num_bytes - op->current * 256);
>> }
>> @@ -294,8 +293,7 @@ static gboolean sim_fs_op_read_block(gpointer user_data)
>> toread = MIN(256 - op->offset % 256,
>> op->num_bytes - op->current * 256);
>> } else {
>> - bufoff = (op->current - start_block - 1) * 256 +
>> - op->offset % 256;
>> + bufoff = op->current * 256;
>> seekoff = SIM_CACHE_HEADER_SIZE + op->current * 256;
>> toread = MIN(256, op->num_bytes - op->current * 256);
>> }
>
> Denis - any feedback on this patch? If we don't add this bugfix,
> reads > 256 bytes will be broken.
>
I don't believe the patch is correct:
In sim_fs_op_read_block:
...
if (op->current == start_block) {
op->buffer = g_try_new0(unsigned char, op->num_bytes);
...
We don't allocate a buffer for the entire file, just for the portion
we're reading. So setting buffoff to op->current * 256 will not work on
reads that start at non-zero offsets.
Regards,
-Denis
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono