Skip to content

Conversation

@carenas
Copy link
Contributor

@carenas carenas commented Oct 22, 2021

Visual Studio 2013 includes support for %zu and %td, so let newer
versions of it avoid the fallback, and while at it, make sure that
the first check is for DISABLE_PERCENT_ZT so it will be always
honoured if chosen.

prtdiff_t is signed, so use a signed type instead, and make sure
that an appropiate width is chosen if pointers are 64bit wide and
long is not (ex: Windows 64bit).

IMHO removing the cast (and therefore the positibilty of truncation)
make the code cleaner and the fallback is likely portable enough
with all 64-bit POSIX systems doing LP64 except for Windows.

@carenas carenas force-pushed the msvc branch 2 times, most recently from 4c8f57b to 4c55e69 Compare October 23, 2021 12:17
Visual Studio 2013 includes support for %zu and %td, so let newer
versions of it avoid the fallback, and while at it, make sure that
the first check is for DISABLE_PERCENT_ZT so it will be always
honoured if chosen.

prtdiff_t is signed, so use a signed type instead, and make sure
that an appropiate width is chosen if pointers are 64bit wide.

Remove the need for the size_t cast and instead change the size
of the equivalent format identifier to avoid truncations.
@carenas carenas marked this pull request as ready for review October 24, 2021 06:16
@PhilipHazel PhilipHazel merged commit d46f186 into PCRE2Project:master Oct 29, 2021
@carenas carenas deleted the msvc branch October 29, 2021 13:32
PhilipHazel added a commit that referenced this pull request Oct 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants