Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Use correct types in AFC read/write signatures for length

#82

teuf just spotted this on IRC and it is actually something to better cleanup before we hit 1.0.

The afc_file_read() and afc_file_write() functions use "int length" for the passed buffer and a "uint32_t *bytes" to return bytes read/written.

However the AFCPacket stores sizes as uint64_t. We should fix the signature to support this as it probably leads to funky chaos while operating on huge files.

Reported by Martin S. · November 4th, 2009 @ 11:26 AM

State: resolved
Milestone: 1.0 Release
Assigned to: Matt Colyer Matt Colyer

Activity

  1. Nikias Bassen
    Nikias Bassen
    • Assigned user set to Matt Colyer
    • State changed from new to open

    Here's a patch that cleans up the messiness by adapting afc_file_write/afc_file_read and all corresponding functions to use uint32_t for buffer lengths. I really don't think it is useful to use uint64_t for buffer lengths (which are not same as file offsets), and on the other hand e.g. the parameter 'file_mode' in afc_file_open or 'operation' in afc_file_lock are enums that are also only 32 bits in size (at least on a 32bit system) even if they will be transferred as 64 bit values.

    November 28th, 2009 @ 03:48 AM

  2. Nikias Bassen
    Nikias Bassen

    Here's another patch that makes afc_truncate look more like afc_file_truncate by using uint64_t instead of off_t, just to be consistent.

    November 28th, 2009 @ 03:53 AM

  3. Nikias Bassen
    Nikias Bassen

    I just noticed I made these patches on top of my endianess patch from ticket #85. That ticket is on hold right now, but to be honest we don't loose anything when that patch goes into git even if big endian support has not been tested. Right now big endian is not supported correctly and the patch from #85 definitely improves this situation ;)

    November 29th, 2009 @ 01:49 AM

  4. Matt Colyer
    Matt Colyer
    • State changed from open to resolved

    (from [fe239d46809996def06502d55f8b34b46e475e53]) afc_truncate: use uint64_t instead of off_t

    This makes afc_truncate look more like afc_file_truncate which is also
    using uint64_t for the file size.

    [#82 state:resolved]

    Signed-off-by: Matt Colyer matt@colyer.name
    http://github.com/MattColyer/libiphone/commit/fe239d46809996def0650...

    December 1st, 2009 @ 05:03 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.