Fix for LP32 platforms: convert pointers via uintptr_t to/from integral types#96
Conversation
|
Hi @fbrausse , Thanks for the PR! Could you add a note in the CHANGELOG and credit yourself for the PR? (like the one added here). I already implemented some of the proposed changes in one of the 0.8.0.beta repositories (this is just a single header library with the core modules that could be isolated from the IO logic)... I should have thought to test the code on 32 bit platforms, but all the machines I run my code on are 64 bit 🤷♂️ Anyway, thanks a lot! Bo. P.S. If there's anything you want to see in the next version (where breaking changes to the API will occur), let me know. I hate breaking the API, but 0.7.x is such a patchwork of ideas and the API isn't as unified and coherent as I'd like. I'm trying to smooth out API inconsistencies - i.e., |
* convert pointers via uintptr_t to/from integral types * mix in intermediate 64-bit `len` instead of platform-dependently sized `size_t` * default to compiling with -D_FILE_OFFSET_BITS=64 for consistent sendfile64() usage
|
Hi Bo, I've added the Changelog entry as requested and expanded detail in the commit message, the rest of the patch remains unchanged. Thank you for all your work on these libraries and APIs in particular - we don't need Python to have simple interfaces! :) Regarding API consistency, I'm afraid there are no suggestions I can give you right now. However, for ref-counted types (like Personally, I've adopted the convention of Kind regards, |
Codecov Report
@@ Coverage Diff @@
## 0.7.x #96 +/- ##
==========================================
+ Coverage 50.21% 50.48% +0.26%
==========================================
Files 33 33
Lines 14365 14382 +17
==========================================
+ Hits 7214 7261 +47
+ Misses 7151 7121 -30
Continue to review full report at Codecov.
|
|
Great! thanks! |
Hi,
I'm using facil.io on a i686 Linux machine (gcc-9.3.0) and noticed lots of warnings about casting pointers to integers of different widths, e.g.
(uint64_t)&obj, an (undefined) left-shift of a 32-bitsize_tby 33 in the risky hash computation, as well as the explicit use ofsendfile64with anoff_tparameter.This patch fixes these warnings by
uintptr_tfirst,uint64_tfor the risky hash mixing in ofsize_t len, and_FILE_OFFSET_BITS=64#define to theFLAGSinmakefile.The API has not been touched, just the internal calls. This has been the most obvious way for me to fix compilation of facil.io on this 32-bit platform, though I'm open to fixing these in a different way if you have any suggestions.