Hi,
Thanks for the v2
On Mon, Nov 13, 2017 at 4:49 AM, Simon Rozman <si...@rozman.si> wrote:
> Data size arithmetic was reviewed according to 64-bit MSVC complaints.
>
> The warnings were addressed by migrating to size_t, rewriting the code,
> or silencing the warnings by an explicit cast where appropriate.
> ---
> src/openvpnserv/automatic.c | 20 ++++----------------
> src/openvpnserv/interactive.c | 12 ++++++------
> 2 files changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/src/openvpnserv/automatic.c b/src/openvpnserv/automatic.c
> index 75c3be2..4d5501b 100644
> --- a/src/openvpnserv/automatic.c
> +++ b/src/openvpnserv/automatic.c
> @@ -115,25 +115,13 @@ close_if_open(HANDLE h)
> static bool
> match(const WIN32_FIND_DATA *find, LPCTSTR ext)
> {
> - int i;
> -
> if (find->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
> {
> return false;
> }
>
> - if (!_tcslen(ext))
> - {
> - return true;
> - }
> -
> - i = _tcslen(find->cFileName) - _tcslen(ext) - 1;
> - if (i < 1)
> - {
> - return false;
> - }
> -
> - return find->cFileName[i] == '.' && !_tcsicmp(find->cFileName + i +
> 1, ext);
> + const TCHAR *p = _tcsrchr(find->cFileName, TEXT('.'));
> + return p && p != find->cFileName && _tcsicmp(p + 1, ext) == 0;
FWIW, ensuring the extension string is not empty seems to be required to
avoid a regression (see my reply to v1). A check for ext[0] != TEXT('\0')
should do the trick.
The rest looks good.
Selva
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel