-
Notifications
You must be signed in to change notification settings - Fork 12
Update getFileBlock #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update getFileBlock #39
Conversation
Adding issue tracking .yml file for issue tracking in GH Projects.
Version 1.1.9
This fixes sparkfun#38 When used with ARM GCC Toolchain supplied with Arduino_STM32 newlib nano version is built without C99 formats support, so the %zu format specifier doesn't work, and instead of putting the number it puts "zu" into the resulting string
This adds more error checking and command formatting to make it similar to other methods. Also makes detecting comma_idx (offset of file size in the response) more reliable
Hi @fronders , Thanks for submitting this. Some compilers are 'fussy' and will throw an error on Cheers, |
Yeah... It's messy, but you can fix this with a selective compile. Something like:
|
@PaulZC I just noticed, that I forgot to add more error handling to response parser, hence the unused |
@PaulZC I think using it with an explicit cast to // OK, yet insufficient with large sizes > ULONG_MAX
printf("%lu\n", (unsigned long) some_size_t_object); We should be fine with this for all 32-bit MCUs Taken from here, what do you think? |
Added sprintf arguments type casting from size_t to unsigned long (or unsigned long long on 64-bit arch)
This adds response error checking for getFileBlock and minor formatting fixes to make it similar to other methods
@PaulZC just added that fix from code above that should work everywhere. Also added error handling and response checks for |
After more testing, kept only casting from size_t to unsigned long (compatible with 32-bit MCUs)
Thanks @fronders , I'll give this another read through tomorrow, but all looks good... Cheers, |
hey @PaulZC, any updates? :) |
Sorry @fronders - other stuff got in the way. I'll try and do this today. Please nudge me if I don't... Thanks! |
This addresses several things:
%lu
specifier which will work for everyonegetFileBlock()
similar to other methodscomma_idx
- the offset of file size in+URDBLOCK
response