Use correct types in AFC read/write signatures for length
Reported by Martin S. | November 4th, 2009 @ 11:26 AM | in 1.0 Release
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.
Comments and changes to this ticket
-
Nikias Bassen November 28th, 2009 @ 03:48 AM
- 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.
-
Nikias Bassen November 28th, 2009 @ 03:53 AM
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.
-
Nikias Bassen November 29th, 2009 @ 01:49 AM
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 ;)
-
Matt Colyer December 1st, 2009 @ 05:03 AM
- 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...
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.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
A project around supporting the iPhone in Linux.
See http://libimobiledevice.org
People watching this ticket
Attachments
Referenced by
- 85 ensure endian safety for non-little-endian machines Applied this to resolve #82.
- 82 Use correct types in AFC read/write signatures for length [#82 state:resolved]