mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
755 stars 138 forks source link

Use ptrdiff_t for pointer-difference types #232

Closed ec1oud closed 5 months ago

ec1oud commented 5 months ago

This fixes warnings on msvc in several places:

md4c.c(3087): warning C4244: 'function': conversion from '__int64' to 'int', possible loss of data

ec1oud commented 5 months ago

I hope it's portable enough. https://stackoverflow.com/questions/3597743/where-is-ptrdiff-t-defined-in-c

We'll find out soon enough on Qt's CI: https://codereview.qt-project.org/c/qt/qtbase/+/534446

codecov[bot] commented 5 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (aeddaf5) 91.80% compared to head (8d807b0) 91.81%. Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #232 +/- ## ======================================= Coverage 91.80% 91.81% ======================================= Files 5 5 Lines 3406 3408 +2 ======================================= + Hits 3127 3129 +2 Misses 279 279 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

mity commented 5 months ago

Thanks for it.

However I have to admit I dislike the patch because it now uses ptrdiff_t on numerous places which have nothing to do with pointer difference and I find the result misleading and not really improving quality of the code.

I've created an alternative patch based on this, if youre ok with it. See PR #233.

mity commented 5 months ago

Closing, as the #233 was merged instead.