# HG changeset patch # User John Donoghue # Date 1428334200 14400 # Node ID d7b2bb282421307ef8314a6201fc3792440a51bb # Parent 34f28d85485371331ae9a613892a04f2c97494c9 mingw-w64: patch mingw-w64 for %g bug * dist-files.mk: add mingw-w64-3-fix-g-format.patch * src/mingw-w64-3-fix-g-format.patch: new file * src/build-gcc.mk: apply patches to mingw-w64 before building crt diff -r 34f28d854853 -r d7b2bb282421 dist-files.mk --- a/dist-files.mk Tue Mar 31 08:13:26 2015 -0400 +++ b/dist-files.mk Mon Apr 06 11:30:00 2015 -0400 @@ -335,6 +335,7 @@ mingw-utils-1-portability-fix.patch \ mingw-w64-1-float-h.patch \ mingw-w64-2-netioapi-winxp.patch \ + mingw-w64-3-fix-g-format.patch \ mingw-w64.mk \ mingwrt.mk \ mman-win32-1-include_name_change.patch \ diff -r 34f28d854853 -r d7b2bb282421 src/build-gcc.mk --- a/src/build-gcc.mk Tue Mar 31 08:13:26 2015 -0400 +++ b/src/build-gcc.mk Mon Apr 06 11:30:00 2015 -0400 @@ -59,6 +59,10 @@ # build mingw-w64-crt cd '$(1)' && $(call UNPACK_PKG_ARCHIVE,mingw-w64,$(TAR)) + $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/mingw-w64-*.patch)), + (cd '$(1)/$(mingw-w64_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH)) + $(foreach PKG_PATCH,$(sort $(wildcard $(TOP_DIR)/src/$(MXE_SYSTEM)-mingw-w64-*.patch)), + (cd '$(1)/$(mingw-w64_SUBDIR)' && $(PATCH) -p1 -u) < $(PKG_PATCH)) mkdir '$(1).crt-build' cd '$(1).crt-build' && '$(1)/$(mingw-w64_SUBDIR)/mingw-w64-crt/configure' \ --host='$(TARGET)' \ diff -r 34f28d854853 -r d7b2bb282421 src/mingw-w64-3-fix-g-format.patch --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/mingw-w64-3-fix-g-format.patch Mon Apr 06 11:30:00 2015 -0400 @@ -0,0 +1,20 @@ +From: John Donoghue +Date: Mon, 6 Apr 2015 09:29:43 -0400 +Subject: [PATCH] Fix printf("%g") width format out by one in some instances + (Bug 362) + +* mingw-w64-crt\stdio\mingw_pformat.c + (__pformat_emit_float): change width > len => width >= len + +diff -ur mingw-w64-v3.3.0.orig/mingw-w64-crt/stdio/mingw_pformat.c mingw-w64-v3.3.0/mingw-w64-crt/stdio/mingw_pformat.c +--- mingw-w64-v3.3.0.orig/mingw-w64-crt/stdio/mingw_pformat.c 2015-04-06 10:12:45.486721000 -0400 ++++ mingw-w64-v3.3.0/mingw-w64-crt/stdio/mingw_pformat.c 2015-04-06 10:14:26.200702676 -0400 +@@ -1055,7 +1055,7 @@ + * reserve space in the output field, for the required number of + * decimal digits to be placed before the decimal point... + */ +- if( stream->width > len ) ++ if( stream->width >= len ) + /* + * adjusting as appropriate, when width is sufficient... + */