[mingw-crt/f18] Added Windows XP compatibility wrapper for the vsprintf_s function (RHBZ #917323)
Erik van Pienbroek
epienbro at fedoraproject.org
Fri May 3 22:25:05 UTC 2013
commit ca9cf689c45b420580724dc5f6199d82f6d70d51
Author: Erik van Pienbroek <epienbro at fedoraproject.org>
Date: Sat May 4 00:24:53 2013 +0200
Added Windows XP compatibility wrapper for the vsprintf_s function (RHBZ #917323)
mingw-crt.spec | 16 ++++++++-
mingw-w64-crt-add-vsprintf_s-wrapper.patch | 53 ++++++++++++++++++++++++++++
2 files changed, 68 insertions(+), 1 deletions(-)
---
diff --git a/mingw-crt.spec b/mingw-crt.spec
index ec0da79..cf5b891 100644
--- a/mingw-crt.spec
+++ b/mingw-crt.spec
@@ -5,7 +5,7 @@
Name: mingw-crt
Version: 2.0.999
-Release: 0.16.%{branch}.%{snapshot_date}%{?dist}
+Release: 0.17.%{branch}.%{snapshot_date}%{?dist}
Summary: MinGW Windows cross-compiler runtime
License: Public Domain and ZPLv2.1
@@ -31,12 +31,18 @@ BuildRequires: mingw64-binutils
BuildRequires: mingw64-headers
BuildRequires: mingw64-gcc
+# Needed for patch3
+BuildRequires: autoconf automake libtool
+
# Backport of SVN commits 5592, 5593 and 5594
# This improves support for various import libraries like setupapi and others
Patch0: mingw-w64-r5592.patch
Patch1: mingw-w64-r5593.patch
Patch2: mingw-w64-r5594.patch
+# Add Windows XP wrapper for vsprintf_s (RHBZ #917323)
+Patch3: mingw-w64-crt-add-vsprintf_s-wrapper.patch
+
%description
MinGW Windows cross-compiler runtime, base libraries.
@@ -76,6 +82,11 @@ tar -xf %{S:0}
%patch1 -p1
%patch2 -p1
+%patch3 -p0
+pushd mingw-w64-crt
+autoreconf -i --force
+popd
+
%build
pushd mingw-w64-crt
@@ -105,6 +116,9 @@ rm -rf $RPM_BUILD_ROOT%{mingw64_includedir}/*.c
%changelog
+* Sat May 4 2013 Erik van Pienbroek <epienbro at fedoraproject.org> - 2.0.999-0.17.trunk.20121110
+- Added Windows XP compatibility wrapper for the vsprintf_s function (RHBZ #917323)
+
* Mon Feb 18 2013 Erik van Pienbroek <epienbro at fedoraproject.org> - 2.0.999-0.16.trunk.20121110
- Backported upstream commits 5592, 5593 and 5594
- Improves support for import libraries like setupapi and others
diff --git a/mingw-w64-crt-add-vsprintf_s-wrapper.patch b/mingw-w64-crt-add-vsprintf_s-wrapper.patch
new file mode 100644
index 0000000..57e123b
--- /dev/null
+++ b/mingw-w64-crt-add-vsprintf_s-wrapper.patch
@@ -0,0 +1,53 @@
+--- mingw-w64-crt/Makefile.am.orig 2013-03-04 19:48:33.103373245 +0100
++++ mingw-w64-crt/Makefile.am 2013-03-04 19:49:42.175932725 +0100
+@@ -244,6 +244,7 @@
+ secapi/_vcprintf_s.c secapi/_vcprintf_s_l.c \
+ secapi/_cwprintf_s.c secapi/_cwprintf_s_l.c \
+ secapi/_vcwprintf_s.c secapi/_vcwprintf_s_l.c \
++ secapi/vsprintf_s.c \
+ secapi/_access_s.c secapi/_waccess_s.c \
+ secapi/_chsize_s.c secapi/_mktemp_s.c secapi/_wmktemp_s.c \
+ secapi/_umask_s.c \
+--- /dev/null 2013-03-03 23:07:12.487394095 +0100
++++ mingw-w64-crt/secapi/vsprintf_s.c 2013-03-04 19:48:26.188317233 +0100
+@@ -0,0 +1,40 @@
++#include <windows.h>
++#include <malloc.h>
++#include <errno.h>
++
++HMODULE __mingw_get_msvcrt_handle(void);
++int __cdecl vsprintf (char *, const char *, va_list);
++int __cdecl vsprintf_s (char *, size_t, const char *, va_list);
++static int __cdecl _int_vsprintf_s (char *, size_t, const char *, va_list);
++static int __cdecl _stub (char *, size_t, const char *, va_list);
++
++int __cdecl (*__MINGW_IMP_SYMBOL(vsprintf_s))(char *, size_t, const char *, va_list) =
++ _stub;
++
++static int __cdecl
++_stub (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
++{
++ int __cdecl (*f)(char *, size_t, const char *, va_list) = __MINGW_IMP_SYMBOL(vsprintf_s);
++
++ if (f == _stub)
++ {
++ f = (int __cdecl (*)(char *, size_t, const char *, va_list))
++ GetProcAddress (__mingw_get_msvcrt_handle (), "vprintf_s");
++ if (!f)
++ f = _int_vsprintf_s;
++ __MINGW_IMP_SYMBOL(vsprintf_s) = f;
++ }
++ return (*f)(_DstBuf, _Size, _Format, _ArgList);
++}
++
++int __cdecl
++vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
++{
++ return _stub (_DstBuf, _Size, _Format, _ArgList);
++}
++
++static int __cdecl
++_int_vsprintf_s (char *_DstBuf, size_t _Size, const char *_Format, va_list _ArgList)
++{
++ return vsprintf (_DstBuf, _Format, _ArgList);
++}
More information about the scm-commits
mailing list