Here is an updated patch with changes for makefile.in so no need to run
autoreconf

On Mon, Nov 10, 2014 at 11:58 PM, Martell Malone <[email protected]>
wrote:

> I noticed that this was missing from secapi
>
> Comments and suggestions are welcome
>
> From e56be479e2cb153e7cd8487bad1600ca6ec4e61b Mon Sep 17 00:00:00 2001
> From: martell <[email protected]>
> Date: Mon, 10 Nov 2014 23:52:58 +0000
> Subject: [PATCH] Add secapi wrapper for wmemmove_s
>
> ---
>  mingw-w64-crt/Makefile.am         |  3 +-
>  mingw-w64-crt/secapi/wmemmove_s.c | 60
> +++++++++++++++++++++++++++++++++++++++
>  2 files changed, 62 insertions(+), 1 deletion(-)
>  create mode 100644 mingw-w64-crt/secapi/wmemmove_s.c
>
> diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
> index 7ce2bd2..1077cd3 100644
> --- a/mingw-w64-crt/Makefile.am
> +++ b/mingw-w64-crt/Makefile.am
> @@ -191,7 +191,8 @@ src_msvcrt=\
>    secapi/sprintf_s.c \
>    secapi/strerror_s.c \
>    secapi/vsprintf_s.c \
> -  secapi/wmemcpy_s.c
> +  secapi/wmemcpy_s.c \
> +  secapi/wmemmove_s.c
>
>  src_msvcrt32=\
>    $(src_msvcrt) \
> diff --git a/mingw-w64-crt/secapi/wmemmove_s.c
> b/mingw-w64-crt/secapi/wmemmove_s.c
> new file mode 100644
> index 0000000..c59fee1
> --- /dev/null
> +++ b/mingw-w64-crt/secapi/wmemmove_s.c
> @@ -0,0 +1,60 @@
> +#include <windows.h>
> +#include <malloc.h>
> +#include <errno.h>
> +#include <msvcrt.h>
> +
> +errno_t __cdecl wmemmove_s (wchar_t *, size_t, const wchar_t *, size_t);
> +static errno_t __cdecl _int_wmemmove_s (wchar_t *, size_t, const wchar_t
> *, size_t);
> +static errno_t __cdecl _stub (wchar_t *, size_t, const wchar_t *, size_t);
> +
> +errno_t __cdecl (*__MINGW_IMP_SYMBOL(wmemmove_s))(wchar_t *, size_t,
> const wchar_t *, size_t) =
> + _stub;
> +
> +static errno_t __cdecl
> +_stub (wchar_t *d, size_t dn, const wchar_t *s, size_t n)
> +{
> +  errno_t __cdecl (*f)(wchar_t *, size_t, const wchar_t *, size_t) =
> __MINGW_IMP_SYMBOL(wmemmove_s);
> +
> +  if (f == _stub)
> +    {
> + f = (errno_t __cdecl (*)(wchar_t *, size_t, const wchar_t *, size_t))
> +    GetProcAddress (__mingw_get_msvcrt_handle (), "wmemmove_s");
> + if (!f)
> +  f = _int_wmemmove_s;
> + __MINGW_IMP_SYMBOL(wmemmove_s) = f;
> +    }
> +  return (*f)(d, dn, s, n);
> +}
> +
> +errno_t __cdecl
> +wmemmove_s (wchar_t *d, size_t dn, const wchar_t *s, size_t n)
> +{
> +  return _stub (d, dn, s, n);
> +}
> +
> +static errno_t __cdecl
> +_int_wmemmove_s (wchar_t *d, size_t dn, const wchar_t *s, size_t n)
> +{
> +  if (!n)
> +    return 0;
> +
> +  if (!d || !s)
> +    {
> +      if (d)
> +        memset (d, 0, dn * sizeof (wchar_t));
> +      errno = EINVAL;
> +      return EINVAL;
> +    }
> +
> +  if (dn < n)
> +    {
> +      memset (d, 0, dn * sizeof (wchar_t));
> +
> +      errno = ERANGE;
> +      return ERANGE;
> +    }
> +
> +  memmove (d, s, n * sizeof (wchar_t));
> +
> +  return 0;
> +}
> --
> 2.1.3
>
>

Attachment: 0001-Add-secapi-wrapper-for-wmemmove_s.patch
Description: Binary data

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to