Sign In
Sign Up
Search is temporarily disabled. See
ticket
for more info.
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
List overview
Download
Arch-excludes
April 2018
----- 2024 -----
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
arch-excludes@lists.fedoraproject.org
2 participants
238 discussions
Start a n
N
ew thread
Architecture specific change in rpms/compat-libicu57.git
by githook-noreply@fedoraproject.org
01 May '18
01 May '18
The package rpms/compat-libicu57.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/compat-libicu57.git/commit/?id=bffb…
. Change: -%ifarch armv7hl Thanks. Full change: ============ commit bffb334159b4b3f359c1425f7cc11d7da53f01f9 Author: Pete Walter <pwalter(a)fedoraproject.org> Date: Mon Apr 30 20:50:53 2018 +0100 Retire old compat package in F29+ diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 581976a..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/icu4c-57_1-src.tgz diff --git a/armv7hl-disable-tests.patch b/armv7hl-disable-tests.patch deleted file mode 100644 index 2d869b1..0000000 --- a/armv7hl-disable-tests.patch +++ /dev/null @@ -1,96 +0,0 @@ -diff -ru orig.icu/source/test/cintltst/cnmdptst.c icu/source/test/cintltst/cnmdptst.c ---- orig.icu/source/test/cintltst/cnmdptst.c 2016-03-23 21:48:18.000000000 +0100 -+++ icu/source/test/cintltst/cnmdptst.c 2016-04-15 18:34:06.148251985 +0200 -@@ -186,6 +186,12 @@ - /* Test exponential pattern*/ - static void TestExponential(void) - { -+/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ -+#if 1 -+ /* Actually only 3 tests fail, but given the nested structure depending on -+ * array sizes there's no simple "disable this and that". */ -+ return; -+#endif - int32_t pat_length, val_length, lval_length; - int32_t ival, ilval, p, v, lneed; - UNumberFormat *fmt; -diff -ru orig.icu/source/test/intltest/dcfmtest.cpp icu/source/test/intltest/dcfmtest.cpp ---- orig.icu/source/test/intltest/dcfmtest.cpp 2016-03-23 21:48:38.000000000 +0100 -+++ icu/source/test/intltest/dcfmtest.cpp 2016-04-15 18:34:06.148251985 +0200 -@@ -279,6 +279,13 @@ - // - formatLineMat.reset(testLine); - if (formatLineMat.lookingAt(status)) { -+/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ -+#if 1 -+// [Formattable] file dcfmtest.txt, line 62: expected "12.35E5", got "1.235E6" -+// [StringPiece] file dcfmtest.txt, line 62: expected "12.35E5", got "1.235E6" -+ if (lineNum == 62) -+ continue; -+#endif - execFormatTest(lineNum, - formatLineMat.group(1, status), // Pattern - formatLineMat.group(2, status), // rounding mode -diff -ru orig.icu/source/test/intltest/numfmtspectest.cpp icu/source/test/intltest/numfmtspectest.cpp ---- orig.icu/source/test/intltest/numfmtspectest.cpp 2016-03-23 21:48:40.000000000 +0100 -+++ icu/source/test/intltest/numfmtspectest.cpp 2016-04-15 18:34:06.148251985 +0200 -@@ -137,11 +137,14 @@ - - void NumberFormatSpecificationTest::TestScientificNotation() { - assertPatternFr("1,23E4", 12345.0, "0.00E0", TRUE); -+/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ -+#if 0 - assertPatternFr("123,00E2", 12300.0, "000.00E0", TRUE); - assertPatternFr("123,0E2", 12300.0, "000.0#E0", TRUE); - assertPatternFr("123,0E2", 12300.1, "000.0#E0", TRUE); - assertPatternFr("123,01E2", 12301.0, "000.0#E0", TRUE); - assertPatternFr("123,01E+02", 12301.0, "000.0#E+00", TRUE); -+#endif - assertPatternFr("12,3E3", 12345.0, "##0.00E0", TRUE); - assertPatternFr("12,300E3", 12300.1, "##0.0000E0", TRUE); - assertPatternFr("12,30E3", 12300.1, "##0.000#E0", TRUE); -@@ -221,6 +224,8 @@ - assertEquals("", "USD (433.22)", result, TRUE); - } - } -+/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ -+#if 0 - const char *paddedSciPattern = "QU**00.#####E0"; - assertPatternFr("QU***43,3E-1", 4.33, paddedSciPattern, TRUE); - { -@@ -242,6 +247,7 @@ - } - // padding cannot work as intended with scientific notation. - assertPatternFr("QU**43,32E-1", 4.332, paddedSciPattern, TRUE); -+#endif - } - - void NumberFormatSpecificationTest::assertPatternFr( -diff -ru orig.icu/source/test/intltest/numfmtst.cpp icu/source/test/intltest/numfmtst.cpp ---- orig.icu/source/test/intltest/numfmtst.cpp 2016-03-23 21:48:40.000000000 +0100 -+++ icu/source/test/intltest/numfmtst.cpp 2016-04-15 18:34:06.150251997 +0200 -@@ -730,6 +730,12 @@ - void - NumberFormatTest::TestExponential(void) - { -+/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ -+#if 1 -+ /* Actually only 3 tests fail, but given the nested structure depending on -+ * array sizes there's no simple "disable this and that". */ -+ return; -+#endif - UErrorCode status = U_ZERO_ERROR; - DecimalFormatSymbols sym(Locale::getUS(), status); - if (U_FAILURE(status)) { errcheckln(status, "FAIL: Bad status returned by DecimalFormatSymbols ct - %s", u_errorName(status)); return; } -@@ -1846,8 +1852,11 @@ - (int32_t) 45678000, "5E7", status); - expect(new DecimalFormat("00E0", US, status), - (int32_t) 45678000, "46E6", status); -+/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ -+#if 0 - expect(new DecimalFormat("000E0", US, status), - (int32_t) 45678000, "457E5", status); -+#endif - /* - expect(new DecimalFormat("###E0", US, status), - new Object[] { new Double(0.0000123), "12.3E-6", diff --git a/compat-libicu57.spec b/compat-libicu57.spec deleted file mode 100644 index fd343d3..0000000 --- a/compat-libicu57.spec +++ /dev/null @@ -1,126 +0,0 @@ -Name: compat-libicu57 -Version: 57.1 -Release: 3%{?dist} -Summary: Compat package with icu libraries - -License: MIT and UCD and Public Domain -URL:
http://www.icu-project.org/
-Source0:
http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz
- -BuildRequires: doxygen, autoconf, python2 - -Patch1: icu.8198.revert.icu5431.patch -Patch2: icu.8800.freeserif.crash.patch -Patch3: icu.7601.Indic-ccmp.patch -Patch4: gennorm2-man.patch -Patch5: icuinfo-man.patch -Patch6: armv7hl-disable-tests.patch -Patch7: rhbz1360340-icu-changeset-39109.patch -Patch8: diff-icu_trunk_source_common_locid.cpp-from-39282-to-39384.patch -Patch9: rhbz1444101-icu-changeset-39671.patch -Patch10: rhbz1510932-icu-changeset-40324.patch - -# Explicitly conflict with older icu packages that ship libraries -# with the same soname as this compat package -Conflicts: libicu < 58 - -%description -Compatibility package with libicu libraries ABI version 57. - -%{!?endian: %global endian %(%{__python} -c "import sys;print (0 if sys.byteorder=='big' else 1)")} -# " this line just fixes syntax highlighting for vim that is confused by the above and continues literal - - -%prep -%setup -q -n icu -%patch1 -p2 -R -b .icu8198.revert.icu5431.patch -%patch2 -p1 -b .icu8800.freeserif.crash.patch -%patch3 -p1 -b .icu7601.Indic-ccmp.patch -%patch4 -p1 -b .gennorm2-man.patch -%patch5 -p1 -b .icuinfo-man.patch -%ifarch armv7hl -%patch6 -p1 -b .armv7hl-disable-tests.patch -%endif -%patch7 -p1 -b .rhbz1360340-icu-changeset-39109.patch -%patch8 -p1 -b .diff-icu_trunk_source_common_locid.cpp-from-39282-to-39384.patch -%patch9 -p1 -b .rhbz1444101-icu-changeset-39671.patch -%patch10 -p1 -b .rhbz1510932-icu-changeset-40324.patch - - -%build -pushd source -autoconf -CFLAGS='%optflags -fno-strict-aliasing' -CXXFLAGS='%optflags -fno-strict-aliasing' -# Endian: BE=0 LE=1 -%if ! 0%{?endian} -CPPFLAGS='-DU_IS_BIG_ENDIAN=1' -%endif - -#rhbz856594 do not use --disable-renaming or cope with the mess -OPTIONS='--with-data-packaging=library --disable-samples' -%if 0%{?debugtrace} -OPTIONS=$OPTIONS' --enable-debug --enable-tracing' -%endif -%configure $OPTIONS - -#rhbz#225896 -sed -i 's|-nodefaultlibs -nostdlib||' config/mh-linux -#rhbz#681941 -sed -i 's|^LIBS =.*|LIBS = -L../lib -licuuc -lpthread -lm|' i18n/Makefile -sed -i 's|^LIBS =.*|LIBS = -nostdlib -L../lib -licuuc -licui18n -lc -lgcc|' io/Makefile -sed -i 's|^LIBS =.*|LIBS = -nostdlib -L../lib -licuuc -lc|' layout/Makefile -sed -i 's|^LIBS =.*|LIBS = -nostdlib -L../lib -licuuc -licule -lc|' layoutex/Makefile -sed -i 's|^LIBS =.*|LIBS = -nostdlib -L../../lib -licutu -licuuc -lc|' tools/ctestfw/Makefile -# As of ICU 52.1 the -nostdlib in tools/toolutil/Makefile results in undefined reference to `__dso_handle' -sed -i 's|^LIBS =.*|LIBS = -L../../lib -licui18n -licuuc -lpthread -lc|' tools/toolutil/Makefile -#rhbz#813484 -sed -i 's| \$(docfilesdir)/installdox||' Makefile -# There is no source/doc/html/search/ directory -sed -i '/^\s\+\$(INSTALL_DATA) \$(docsrchfiles) \$(DESTDIR)\$(docdir)\/\$(docsubsrchdir)\s*$/d' Makefile -# rhbz#856594 The configure --disable-renaming and possibly other options -# result in icu/source/uconfig.h.prepend being created, include that content in -# icu/source/common/unicode/uconfig.h to propagate to consumer packages. -test -f uconfig.h.prepend && sed -e '/^#define __UCONFIG_H__/ r uconfig.h.prepend' -i common/unicode/uconfig.h - -# more verbosity for build.log -sed -i -r 's|(PKGDATA_OPTS = )|\1-v |' data/Makefile - -make %{?_smp_mflags} VERBOSE=1 - - -%install -make %{?_smp_mflags} -C source install DESTDIR=$RPM_BUILD_ROOT -chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so.* - -# Remove files that aren't needed for the compat package -rm -rf $RPM_BUILD_ROOT%{_bindir} -rm -rf $RPM_BUILD_ROOT%{_includedir} -rm -rf $RPM_BUILD_ROOT%{_libdir}/*.so -rm -rf $RPM_BUILD_ROOT%{_libdir}/icu/ -rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig/ -rm -rf $RPM_BUILD_ROOT%{_sbindir} -rm -rf $RPM_BUILD_ROOT%{_datadir}/icu/ -rm -rf $RPM_BUILD_ROOT%{_mandir} - - -%post -p /sbin/ldconfig - -%postun -p /sbin/ldconfig - - -%files -%license LICENSE -%{_libdir}/*.so.* - - -%changelog -* Thu Mar 15 2018 Iryna Shcherbina <ishcherb(a)redhat.com> - 57.1-3 -- Update Python 2 dependency declarations to new packaging standards - (See
https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
) - -* Wed Feb 07 2018 Fedora Release Engineering <releng(a)fedoraproject.org> - 57.1-2 -- Rebuilt for
https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
- -* Thu Nov 30 2017 Pete Walter <pwalter(a)fedoraproject.org> - 57.1-1 -- Initial packaging diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..2a9b05a --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +Retire old compat package in F29+ diff --git a/diff-icu_trunk_source_common_locid.cpp-from-39282-to-39384.patch b/diff-icu_trunk_source_common_locid.cpp-from-39282-to-39384.patch deleted file mode 100644 index 896cdda..0000000 --- a/diff-icu_trunk_source_common_locid.cpp-from-39282-to-39384.patch +++ /dev/null @@ -1,156 +0,0 @@ -Index: icu/trunk/source/common/locid.cpp -=================================================================== ---- icu/source/common/locid.cpp (revision 39282) -+++ icu/source/common/locid.cpp (revision 39384) -@@ -45,4 +45,5 @@ - #include "ucln_cmn.h" - #include "ustr_imp.h" -+#include "charstr.h" - - U_CDECL_BEGIN -@@ -59,4 +60,10 @@ - static UHashtable *gDefaultLocalesHashT = NULL; - static Locale *gDefaultLocale = NULL; -+ -+/** -+ * \def ULOC_STRING_LIMIT -+ * strings beyond this value crash in CharString -+ */ -+#define ULOC_STRING_LIMIT 357913941 - - U_NAMESPACE_END -@@ -286,5 +293,5 @@ - else - { -- MaybeStackArray<char, ULOC_FULLNAME_CAPACITY> togo; -+ UErrorCode status = U_ZERO_ERROR; - int32_t size = 0; - int32_t lsize = 0; -@@ -292,5 +299,4 @@ - int32_t vsize = 0; - int32_t ksize = 0; -- char *p; - - // Calculate the size of the resulting string. -@@ -300,6 +306,12 @@ - { - lsize = (int32_t)uprv_strlen(newLanguage); -+ if ( lsize < 0 || lsize > ULOC_STRING_LIMIT ) { // int32 wrap -+ setToBogus(); -+ return; -+ } - size = lsize; - } -+ -+ CharString togo(newLanguage, lsize, status); // start with newLanguage - - // _Country -@@ -307,4 +319,8 @@ - { - csize = (int32_t)uprv_strlen(newCountry); -+ if ( csize < 0 || csize > ULOC_STRING_LIMIT ) { // int32 wrap -+ setToBogus(); -+ return; -+ } - size += csize; - } -@@ -321,4 +337,8 @@ - // remove trailing _'s - vsize = (int32_t)uprv_strlen(newVariant); -+ if ( vsize < 0 || vsize > ULOC_STRING_LIMIT ) { // int32 wrap -+ setToBogus(); -+ return; -+ } - while( (vsize>1) && (newVariant[vsize-1] == SEP_CHAR) ) - { -@@ -345,48 +365,30 @@ - { - ksize = (int32_t)uprv_strlen(newKeywords); -+ if ( ksize < 0 || ksize > ULOC_STRING_LIMIT ) { -+ setToBogus(); -+ return; -+ } - size += ksize + 1; - } - -- - // NOW we have the full locale string.. -- -- /*if the whole string is longer than our internal limit, we need -- to go to the heap for temporary buffers*/ -- if (size >= togo.getCapacity()) -- { -- // If togo_heap could not be created, initialize with default settings. -- if (togo.resize(size+1) == NULL) { -- init(NULL, FALSE); -- } -- } -- -- togo[0] = 0; -- - // Now, copy it back. -- p = togo.getAlias(); -- if ( lsize != 0 ) -- { -- uprv_strcpy(p, newLanguage); -- p += lsize; -- } -+ -+ // newLanguage is already copied - - if ( ( vsize != 0 ) || (csize != 0) ) // at least: __v - { // ^ -- *p++ = SEP_CHAR; -+ togo.append(SEP_CHAR, status); - } - - if ( csize != 0 ) - { -- uprv_strcpy(p, newCountry); -- p += csize; -+ togo.append(newCountry, status); - } - - if ( vsize != 0) - { -- *p++ = SEP_CHAR; // at least: __v -- -- uprv_strncpy(p, newVariant, vsize); // Must use strncpy because -- p += vsize; // of trimming (above). -- *p = 0; // terminate -+ togo.append(SEP_CHAR, status) -+ .append(newVariant, vsize, status); - } - -@@ -394,19 +396,23 @@ - { - if (uprv_strchr(newKeywords, '=')) { -- *p++ = '@'; /* keyword parsing */ -+ togo.append('@', status); /* keyword parsing */ - } - else { -- *p++ = '_'; /* Variant parsing with a script */ -+ togo.append('_', status); /* Variant parsing with a script */ - if ( vsize == 0) { -- *p++ = '_'; /* No country found */ -+ togo.append('_', status); /* No country found */ - } - } -- uprv_strcpy(p, newKeywords); -- p += ksize; -- } -- -+ togo.append(newKeywords, status); -+ } -+ -+ if (U_FAILURE(status)) { -+ // Something went wrong with appending, etc. -+ setToBogus(); -+ return; -+ } - // Parse it, because for example 'language' might really be a complete - // string. -- init(togo.getAlias(), FALSE); -+ init(togo.data(), FALSE); - } - } diff --git a/gennorm2-man.patch b/gennorm2-man.patch deleted file mode 100644 index 07b5b9d..0000000 --- a/gennorm2-man.patch +++ /dev/null @@ -1,128 +0,0 @@ -Description: supply manual page for program that doesn't have one -Author: Jay Berkenbilt <qjb(a)debian.org> -Bug:
http://bugs.icu-project.org/trac/ticket/7554
- -diff -r -u -N icu.orig/source/tools/gennorm2/gennorm2.8.in icu/source/tools/gennorm2/gennorm2.8.in ---- icu.orig/source/tools/gennorm2/gennorm2.8.in 1970-01-01 01:00:00.000000000 +0100 -+++ icu/source/tools/gennorm2/gennorm2.8.in 2013-02-25 16:43:28.297062638 +0100 -@@ -0,0 +1,71 @@ -+.\" Hey, Emacs! This is -*-nroff-*- you know... -+.\" -+.\" gennorm2.8: manual page for the gennorm2 utility -+.\" -+.\" Copyright (C) 2005-2006 International Business Machines Corporation and others -+.\" -+.TH GENNORM2 8 "15 March 2010" "ICU MANPAGE" "ICU @VERSION@ Manual" -+.SH NAME -+.B gennorm2 -+\- Builds binary data file with Unicode normalization data. -+.SH SYNOPSIS -+.B gennorm2 -+[ -+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" -+] -+[ -+.BR "\-V\fP, \fB\-\-version" -+] -+[ -+.BR "\-c\fP, \fB\-\-copyright" -+] -+[ -+.BR "\-v\fP, \fB\-\-verbose" -+] -+[ -+.BI "\-u\fP, \fB\-\-unicode" " unicode\-version\-number" -+] -+[ -+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory" -+] -+[ -+.BI "\-o\fP, \fB\-\-output" " output\-filename" -+] -+.BI "\fB\-\-fast" -+.SH DESCRIPTION -+.B gennorm2 -+reads text files that define Unicode normalization, -+them, and builds a binary data file. -+.SH OPTIONS -+.TP -+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" -+Print help about usage and exit. -+.TP -+.BR "\-V\fP, \fB\-\-version" -+Print the version of -+.B gennorm2 -+and exit. -+.TP -+.BR "\-c\fP, \fB\-\-copyright" -+Include a copyright notice. -+.TP -+.BR "\-v\fP, \fB\-\-verbose" -+Display extra informative messages during execution. -+.TP -+.BR "\-u\fP, \fB\-\-unicode" -+Specify Unicode version number, such as 5.2.0. -+.TP -+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory" -+Specify the input directory. -+.TP -+.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory" -+Set the name of the output file. -+.TP -+.BI "\fB\-\-fast" -+optimize the .nrm file for fast normalization, -+which might increase its size (Writes fully decomposed -+regular mappings instead of delta mappings. -+You should measure the runtime speed to make sure that -+this is a good trade-off.) -+.SH COPYRIGHT -+Copyright (C) 2009-2010 International Business Machines Corporation and others -diff -r -u -N icu.orig/source/tools/gennorm2/Makefile.in icu/source/tools/gennorm2/Makefile.in ---- icu.orig/source/tools/gennorm2/Makefile.in 2013-01-11 01:23:32.000000000 +0100 -+++ icu/source/tools/gennorm2/Makefile.in 2013-02-25 16:43:28.296062632 +0100 -@@ -16,8 +16,13 @@ - - TARGET_STUB_NAME = gennorm2 - -+SECTION = 8 -+ -+MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) -+ -+ - ## Extra files to remove for 'make clean' --CLEANFILES = *~ $(DEPS) -+CLEANFILES = *~ $(DEPS) $(MAN_FILES) - - ## Target information - TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -@@ -44,12 +49,16 @@ - dist: dist-local - check: all check-local - --all-local: $(TARGET) -+all-local: $(TARGET) $(MAN_FILES) - --install-local: all-local -+install-local: all-local install-man - $(MKINSTALLDIRS) $(DESTDIR)$(sbindir) - $(INSTALL) $(TARGET) $(DESTDIR)$(sbindir) - -+install-man: $(MAN_FILES) -+ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION) -+ $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION) -+ - dist-local: - - clean-local: -@@ -70,6 +79,11 @@ - $(POST_BUILD_STEP) - - -+%.$(SECTION): $(srcdir)/%.$(SECTION).in -+ cd $(top_builddir) \ -+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -+ -+ - ifeq (,$(MAKECMDGOALS)) - -include $(DEPS) - else diff --git a/icu.7601.Indic-ccmp.patch b/icu.7601.Indic-ccmp.patch deleted file mode 100644 index 9de5a45..0000000 --- a/icu.7601.Indic-ccmp.patch +++ /dev/null @@ -1,44 +0,0 @@ -diff -ru orig.icu/source/layout/IndicReordering.cpp icu/source/layout/IndicReordering.cpp ---- orig.icu/source/layout/IndicReordering.cpp 2016-04-15 18:30:15.788856946 +0200 -+++ icu/source/layout/IndicReordering.cpp 2016-04-15 18:30:39.244998995 +0200 -@@ -13,6 +13,7 @@ - - U_NAMESPACE_BEGIN - -+#define ccmpFeatureTag LE_CCMP_FEATURE_TAG - #define loclFeatureTag LE_LOCL_FEATURE_TAG - #define initFeatureTag LE_INIT_FEATURE_TAG - #define nuktFeatureTag LE_NUKT_FEATURE_TAG -@@ -35,6 +36,7 @@ - #define caltFeatureTag LE_CALT_FEATURE_TAG - #define kernFeatureTag LE_KERN_FEATURE_TAG - -+#define ccmpFeatureMask 0x00000001UL - #define loclFeatureMask 0x80000000UL - #define rphfFeatureMask 0x40000000UL - #define blwfFeatureMask 0x20000000UL -@@ -73,7 +75,7 @@ - - #define repositionedGlyphMask 0x00000002UL - --#define basicShapingFormsMask ( loclFeatureMask | nuktFeatureMask | akhnFeatureMask | rkrfFeatureMask | blwfFeatureMask | halfFeatureMask | vatuFeatureMask | cjctFeatureMask ) -+#define basicShapingFormsMask ( ccmpFeatureMask | loclFeatureMask | nuktFeatureMask | akhnFeatureMask | rkrfFeatureMask | blwfFeatureMask | halfFeatureMask | vatuFeatureMask | cjctFeatureMask ) - #define positioningFormsMask ( kernFeatureMask | distFeatureMask | abvmFeatureMask | blwmFeatureMask ) - #define presentationFormsMask ( presFeatureMask | abvsFeatureMask | blwsFeatureMask | pstsFeatureMask | halnFeatureMask | caltFeatureMask ) - -@@ -484,6 +486,7 @@ - #define tagArray0 (rphfFeatureMask | tagArray1) - - static const FeatureMap featureMap[] = { -+ {ccmpFeatureTag, ccmpFeatureMask}, - {loclFeatureTag, loclFeatureMask}, - {initFeatureTag, initFeatureMask}, - {nuktFeatureTag, nuktFeatureMask}, -@@ -506,6 +509,7 @@ - static const le_int32 featureCount = LE_ARRAY_SIZE(featureMap); - - static const FeatureMap v2FeatureMap[] = { -+ {ccmpFeatureTag, ccmpFeatureMask}, - {loclFeatureTag, loclFeatureMask}, - {nuktFeatureTag, nuktFeatureMask}, - {akhnFeatureTag, akhnFeatureMask}, diff --git a/icu.8198.revert.icu5431.patch b/icu.8198.revert.icu5431.patch deleted file mode 100644 index 4c3e78b..0000000 --- a/icu.8198.revert.icu5431.patch +++ /dev/null @@ -1,129 +0,0 @@ -Index: icu/trunk/source/layout/IndicReordering.cpp -=================================================================== ---- icu/trunk/source/layout/IndicReordering.cpp (revision 25772) -+++ icu/trunk/source/layout/IndicReordering.cpp (revision 26090) -@@ -126,4 +126,8 @@ - FeatureMask fSMFeatures; - -+ LEUnicode fPreBaseConsonant; -+ LEUnicode fPreBaseVirama; -+ le_int32 fPBCIndex; -+ FeatureMask fPBCFeatures; - - void saveMatra(LEUnicode matra, le_int32 matraIndex, IndicClassTable::CharClass matraClass) -@@ -172,5 +176,6 @@ - fMatraFeatures(0), fMPreOutIndex(-1), fMPreFixups(mpreFixups), - fVMabove(0), fVMpost(0), fVMIndex(0), fVMFeatures(0), -- fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0) -+ fSMabove(0), fSMbelow(0), fSMIndex(0), fSMFeatures(0), -+ fPreBaseConsonant(0), fPreBaseVirama(0), fPBCIndex(0), fPBCFeatures(0) - { - // nothing else to do... -@@ -191,4 +196,6 @@ - fVMabove = fVMpost = 0; - fSMabove = fSMbelow = 0; -+ -+ fPreBaseConsonant = fPreBaseVirama = 0; - } - -@@ -386,4 +393,12 @@ - } - -+ void notePreBaseConsonant(le_uint32 index,LEUnicode PBConsonant, LEUnicode PBVirama, FeatureMask features) -+ { -+ fPBCIndex = index; -+ fPreBaseConsonant = PBConsonant; -+ fPreBaseVirama = PBVirama; -+ fPBCFeatures = features; -+ } -+ - void noteBaseConsonant() - { -@@ -465,4 +480,20 @@ - } - -+ void writePreBaseConsonant() -+ { -+ // The TDIL spec says that consonant + virama + RRA should produce a rakar in Malayalam. However, -+ // it seems that almost none of the fonts for Malayalam are set up to handle this. -+ // So, we're going to force the issue here by using the rakar as defined with RA in most fonts. -+ -+ if (fPreBaseConsonant == 0x0d31) { // RRA -+ fPreBaseConsonant = 0x0d30; // RA -+ } -+ -+ if (fPreBaseConsonant != 0) { -+ writeChar(fPreBaseConsonant, fPBCIndex, fPBCFeatures); -+ writeChar(fPreBaseVirama,fPBCIndex-1,fPBCFeatures); -+ } -+ } -+ - le_int32 getOutputIndex() - { -@@ -723,4 +754,5 @@ - } - -+ - IndicClassTable::CharClass charClass = CC_RESERVED; - IndicClassTable::CharClass nextClass = CC_RESERVED; -@@ -730,7 +762,9 @@ - le_bool seenVattu = FALSE; - le_bool seenBelowBaseForm = FALSE; -+ le_bool seenPreBaseForm = FALSE; - le_bool hasNukta = FALSE; - le_bool hasBelowBaseForm = FALSE; - le_bool hasPostBaseForm = FALSE; -+ le_bool hasPreBaseForm = FALSE; - - if (postBase < markStart && classTable->isNukta(chars[postBase])) { -@@ -746,12 +780,20 @@ - hasBelowBaseForm = IndicClassTable::hasBelowBaseForm(charClass) && !hasNukta; - hasPostBaseForm = IndicClassTable::hasPostBaseForm(charClass) && !hasNukta; -+ hasPreBaseForm = IndicClassTable::hasPreBaseForm(charClass) && !hasNukta; - - if (IndicClassTable::isConsonant(charClass)) { - if (postBaseLimit == 0 || seenVattu || - (baseConsonant > baseLimit && !classTable->isVirama(chars[baseConsonant - 1])) || -- !(hasBelowBaseForm || hasPostBaseForm)) { -+ !(hasBelowBaseForm || hasPostBaseForm || hasPreBaseForm)) { - break; - } - -+ // Note any pre-base consonants -+ if ( baseConsonant == lastConsonant && lastConsonant > 0 && -+ hasPreBaseForm && classTable->isVirama(chars[baseConsonant - 1])) { -+ output.notePreBaseConsonant(lastConsonant,chars[lastConsonant],chars[lastConsonant-1],tagArray2); -+ seenPreBaseForm = TRUE; -+ -+ } - // consonants with nuktas are never vattus - seenVattu = IndicClassTable::isVattu(charClass) && !hasNukta; -@@ -786,10 +828,12 @@ - - // write any pre-base consonants -+ output.writePreBaseConsonant(); -+ - le_bool supressVattu = TRUE; - - for (i = baseLimit; i < baseConsonant; i += 1) { - LEUnicode ch = chars[i]; -- // Don't put 'blwf' on first consonant. -- FeatureMask features = (i == baseLimit? tagArray2 : tagArray1); -+ // Don't put 'pstf' or 'blwf' on anything before the base consonant. -+ FeatureMask features = tagArray1 & ~( pstfFeatureMask | blwfFeatureMask ); - - charClass = classTable->getCharClass(ch); -@@ -842,5 +886,5 @@ - - // write below-base consonants -- if (baseConsonant != lastConsonant) { -+ if (baseConsonant != lastConsonant && !seenPreBaseForm) { - for (i = bcSpan + 1; i < postBase; i += 1) { - output.writeChar(chars[i], i, tagArray1); -@@ -872,5 +916,5 @@ - // write post-base consonants - // FIXME: does this put the right tags on post-base consonants? -- if (baseConsonant != lastConsonant) { -+ if (baseConsonant != lastConsonant && !seenPreBaseForm) { - if (postBase <= lastConsonant) { - for (i = postBase; i <= lastConsonant; i += 1) { diff --git a/icu.8800.freeserif.crash.patch b/icu.8800.freeserif.crash.patch deleted file mode 100644 index 6d8061a..0000000 --- a/icu.8800.freeserif.crash.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -ru orig.icu/source/layout/LookupProcessor.cpp icu/source/layout/LookupProcessor.cpp ---- orig.icu/source/layout/LookupProcessor.cpp 2016-03-23 21:56:44.000000000 +0100 -+++ icu/source/layout/LookupProcessor.cpp 2016-04-15 18:19:26.903927005 +0200 -@@ -223,7 +223,9 @@ - - if (requiredFeatureIndex != 0xFFFF) { - requiredFeatureTable = featureListTable->getFeatureTable(featureListTable, requiredFeatureIndex, &requiredFeatureTag, success); -- featureReferences += SWAPW(requiredFeatureTable->lookupCount); -+ if (requiredFeatureTable.isValid()) { -+ featureReferences += SWAPW(requiredFeatureTable->lookupCount); -+ } - } - - lookupOrderArray = LE_NEW_ARRAY(le_uint16, featureReferences); diff --git a/icuinfo-man.patch b/icuinfo-man.patch deleted file mode 100644 index 987e879..0000000 --- a/icuinfo-man.patch +++ /dev/null @@ -1,145 +0,0 @@ -Description: supply manual page for program that doesn't have one -Author: Jay Berkenbilt <qjb(a)debian.org> -Bug:
http://bugs.icu-project.org/trac/ticket/7665
-erAck: adapted to ICU 56.1 icu/source/tools/icuinfo/Makefile.in - -diff -Nur orig.icu/source/tools/icuinfo/icuinfo.1.in icu/source/tools/icuinfo/icuinfo.1.in ---- orig.icu/source/tools/icuinfo/icuinfo.1.in 1970-01-01 01:00:00.000000000 +0100 -+++ icu/source/tools/icuinfo/icuinfo.1.in 2015-10-27 19:19:35.184056800 +0100 -@@ -0,0 +1,76 @@ -+.\" Hey, Emacs! This is -*-nroff-*- you know... -+.\" -+.\" icuinfo.1: manual page for the icuinfo utility -+.\" -+.\" Copyright (C) 2005-2006 International Business Machines Corporation and others -+.\" -+.TH ICUINFO 1 "1 May 2010" "ICU MANPAGE" "ICU @VERSION@ Manual" -+.SH NAME -+.B icuinfo -+\- Shows some basic info about the current ICU -+.SH SYNOPSIS -+.B icuinfo -+[ -+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" -+] -+[ -+.BR "\-V\fP, \fB\-\-version" -+] -+[ -+.BR "\-c\fP, \fB\-\-copyright" -+] -+[ -+.BI "\-i\fP, \fB\-\-icudatadir" " directory" -+] -+[ -+.BR "\-v\fP, \fB\-\-verbose" -+] -+[ -+.BI "\-L\fP, \fB\-\-list-plugins" -+] -+[ -+.BI "\-m\fP, \fB\-\-milisecond-time" -+] -+[ -+.BI "\-K\fP, \fB\-\-cleanup" -+] -+.SH DESCRIPTION -+.B icuinfo -+prints basic information about the current version of ICU. -+.SH OPTIONS -+.TP -+.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" -+Print help about usage and exit. -+.TP -+.BR "\-V\fP, \fB\-\-version" -+Print the version of -+.B icuinfo -+and exit. -+.TP -+.BR "\-c\fP, \fB\-\-copyright" -+Embeds the standard ICU copyright into the -+.IR output-file . -+.TP -+.BR "\-v\fP, \fB\-\-verbose" -+Display extra informative messages during execution. -+.TP -+.BI "\-i\fP, \fB\-\-icudatadir" " directory" -+Look for any necessary ICU data files in -+.IR directory . -+For example, the file -+.B pnames.icu -+must be located when ICU's data is not built as a shared library. -+The default ICU data directory is specified by the environment variable -+.BR ICU_DATA . -+Most configurations of ICU do not require this argument. -+.TP -+.BI "\-L\fP, \fB\-\-list-plugins" -+If specified, list and diagnose issues with ICU plugins. -+.TP -+.BI "\-K\fP, \fB\-\-cleanup" -+Attempt to unload plugins before exiting. -+.TP -+.BI "\-m\fP, \fB\-\-milisecond-time" -+Print the current UTC time in milliseconds. -+.SH COPYRIGHT -+Copyright (C) 2010 International Business Machines Corporation and others -diff -Nur orig.icu/source/tools/icuinfo/Makefile.in icu/source/tools/icuinfo/Makefile.in ---- orig.icu/source/tools/icuinfo/Makefile.in 2015-10-08 05:53:56.000000000 +0200 -+++ icu/source/tools/icuinfo/Makefile.in 2015-10-27 19:23:19.115509906 +0100 -@@ -14,8 +14,15 @@ - ## Build directory information - subdir = tools/icuinfo - -+TARGET_STUB_NAME = icuinfo -+ -+SECTION = 1 -+ -+MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) -+ -+ - ## Extra files to remove for 'make clean' --CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) -+CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) $(MAN_FILES) - - ## Target information - TARGET = icuinfo$(EXEEXT) -@@ -35,7 +42,8 @@ - - ## List of phony targets - .PHONY : all all-local install install-local clean clean-local \ --distclean distclean-local dist dist-local check check-local plugin-check -+distclean distclean-local dist dist-local check check-local plugin-check \ -+install-man - - ## Clear suffix list - .SUFFIXES : -@@ -48,12 +56,16 @@ - dist: dist-local - check: all check-local - --all-local: $(TARGET) -+all-local: $(TARGET) $(MAN_FILES) - --install-local: all-local -+install-local: all-local install-man - $(MKINSTALLDIRS) $(DESTDIR)$(bindir) - $(INSTALL) $(TARGET) $(DESTDIR)$(bindir) - -+install-man: $(MAN_FILES) -+ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION) -+ $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION) -+ - dist-local: - - clean-local: -@@ -103,6 +115,10 @@ - @echo "Plugins are disabled (use --enable-plugins to enable)" - endif - -+%.$(SECTION): $(srcdir)/%.$(SECTION).in -+ cd $(top_builddir) \ -+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -+ - ifeq (,$(MAKECMDGOALS)) - -include $(DEPS) - else diff --git a/rhbz1360340-icu-changeset-39109.patch b/rhbz1360340-icu-changeset-39109.patch deleted file mode 100644 index 90f4d1e..0000000 --- a/rhbz1360340-icu-changeset-39109.patch +++ /dev/null @@ -1,244 +0,0 @@ -# Offsets corected from
https://ssl.icu-project.org/trac/changeset/39109
-diff -ru icu.orig/source/common/uloc.cpp icu/source/common/uloc.cpp ---- icu.orig/source/common/uloc.cpp 2016-03-23 21:50:12.000000000 +0100 -+++ icu/source/common/uloc.cpp 2016-11-01 15:21:16.542151312 +0100 -@@ -2246,7 +2246,7 @@ - typedef struct { - float q; - int32_t dummy; /* to avoid uninitialized memory copy from qsort */ -- char *locale; -+ char locale[ULOC_FULLNAME_CAPACITY+1]; - } _acceptLangItem; - - static int32_t U_CALLCONV -@@ -2288,9 +2288,7 @@ - UEnumeration* availableLocales, - UErrorCode *status) - { -- _acceptLangItem *j; -- _acceptLangItem smallBuffer[30]; -- char **strs; -+ MaybeStackArray<_acceptLangItem, 4> items; // Struct for collecting items. - char tmp[ULOC_FULLNAME_CAPACITY +1]; - int32_t n = 0; - const char *itemEnd; -@@ -2300,11 +2298,7 @@ - int32_t res; - int32_t i; - int32_t l = (int32_t)uprv_strlen(httpAcceptLanguage); -- int32_t jSize; -- char *tempstr; /* Use for null pointer check */ - -- j = smallBuffer; -- jSize = UPRV_LENGTHOF(smallBuffer); - if(U_FAILURE(*status)) { - return -1; - } -@@ -2332,27 +2326,29 @@ - while(isspace(*t)) { - t++; - } -- j[n].q = (float)_uloc_strtod(t,NULL); -+ items[n].q = (float)_uloc_strtod(t,NULL); - } else { - /* no semicolon - it's 1.0 */ -- j[n].q = 1.0f; -+ items[n].q = 1.0f; - paramEnd = itemEnd; - } -- j[n].dummy=0; -+ items[n].dummy=0; - /* eat spaces prior to semi */ - for(t=(paramEnd-1);(paramEnd>s)&&isspace(*t);t--) - ; -- /* Check for null pointer from uprv_strndup */ -- tempstr = uprv_strndup(s,(int32_t)((t+1)-s)); -- if (tempstr == NULL) { -- *status = U_MEMORY_ALLOCATION_ERROR; -- return -1; -- } -- j[n].locale = tempstr; -- uloc_canonicalize(j[n].locale,tmp,UPRV_LENGTHOF(tmp),status); -- if(strcmp(j[n].locale,tmp)) { -- uprv_free(j[n].locale); -- j[n].locale=uprv_strdup(tmp); -+ int32_t slen = ((t+1)-s); -+ if(slen > ULOC_FULLNAME_CAPACITY) { -+ *status = U_BUFFER_OVERFLOW_ERROR; -+ return -1; // too big -+ } -+ uprv_strncpy(items[n].locale, s, slen); -+ items[n].locale[slen]=0; // terminate -+ int32_t clen = uloc_canonicalize(items[n].locale, tmp, UPRV_LENGTHOF(tmp)-1, status); -+ if(U_FAILURE(*status)) return -1; -+ if((clen!=slen) || (uprv_strncmp(items[n].locale, tmp, slen))) { -+ // canonicalization had an effect- copy back -+ uprv_strncpy(items[n].locale, tmp, clen); -+ items[n].locale[clen] = 0; // terminate - } - #if defined(ULOC_DEBUG) - /*fprintf(stderr,"%d: s <%s> q <%g>\n", n, j[n].locale, j[n].q);*/ -@@ -2362,63 +2358,29 @@ - while(*s==',') { /* eat duplicate commas */ - s++; - } -- if(n>=jSize) { -- if(j==smallBuffer) { /* overflowed the small buffer. */ -- j = static_cast<_acceptLangItem *>(uprv_malloc(sizeof(j[0])*(jSize*2))); -- if(j!=NULL) { -- uprv_memcpy(j,smallBuffer,sizeof(j[0])*jSize); -- } -+ if(n>=items.getCapacity()) { // If we need more items -+ if(NULL == items.resize(items.getCapacity()*2, items.getCapacity())) { -+ *status = U_MEMORY_ALLOCATION_ERROR; -+ return -1; -+ } - #if defined(ULOC_DEBUG) -- fprintf(stderr,"malloced at size %d\n", jSize); -+ fprintf(stderr,"malloced at size %d\n", items.getCapacity()); - #endif -- } else { -- j = static_cast<_acceptLangItem *>(uprv_realloc(j, sizeof(j[0])*jSize*2)); --#if defined(ULOC_DEBUG) -- fprintf(stderr,"re-alloced at size %d\n", jSize); --#endif -- } -- jSize *= 2; -- if(j==NULL) { -- *status = U_MEMORY_ALLOCATION_ERROR; -- return -1; -- } - } - } -- uprv_sortArray(j, n, sizeof(j[0]), uloc_acceptLanguageCompare, NULL, TRUE, status); -+ uprv_sortArray(items.getAlias(), n, sizeof(items[0]), uloc_acceptLanguageCompare, NULL, TRUE, status); -+ LocalArray<const char*> strs(new const char*[n], *status); - if(U_FAILURE(*status)) { -- if(j != smallBuffer) { --#if defined(ULOC_DEBUG) -- fprintf(stderr,"freeing j %p\n", j); --#endif -- uprv_free(j); -- } -- return -1; -- } -- strs = static_cast<char **>(uprv_malloc((size_t)(sizeof(strs[0])*n))); -- /* Check for null pointer */ -- if (strs == NULL) { -- uprv_free(j); /* Free to avoid memory leak */ -- *status = U_MEMORY_ALLOCATION_ERROR; -- return -1; -+ return -1; - } - for(i=0;i<n;i++) { - #if defined(ULOC_DEBUG) - /*fprintf(stderr,"%d: s <%s> q <%g>\n", i, j[i].locale, j[i].q);*/ - #endif -- strs[i]=j[i].locale; -+ strs[i]=items[i].locale; - } - res = uloc_acceptLanguage(result, resultAvailable, outResult, -- (const char**)strs, n, availableLocales, status); -- for(i=0;i<n;i++) { -- uprv_free(strs[i]); -- } -- uprv_free(strs); -- if(j != smallBuffer) { --#if defined(ULOC_DEBUG) -- fprintf(stderr,"freeing j %p\n", j); --#endif -- uprv_free(j); -- } -+ strs.getAlias(), n, availableLocales, status); - return res; - } - -diff -ru icu.orig/source/test/cintltst/cloctst.c icu/source/test/cintltst/cloctst.c ---- icu.orig/source/test/cintltst/cloctst.c 2016-03-23 21:48:18.000000000 +0100 -+++ icu/source/test/cintltst/cloctst.c 2016-11-01 15:21:16.544151315 +0100 -@@ -2775,16 +2775,20 @@ - const char *icuSet; /**< ? */ - const char *expect; /**< The expected locale result */ - UAcceptResult res; /**< The expected error code */ -+ UErrorCode expectStatus; /**< expected status */ - } tests[] = { -- /*0*/{ 0, NULL, "mt_MT", ULOC_ACCEPT_VALID }, -- /*1*/{ 1, NULL, "en", ULOC_ACCEPT_VALID }, -- /*2*/{ 2, NULL, "en", ULOC_ACCEPT_FALLBACK }, -- /*3*/{ 3, NULL, "", ULOC_ACCEPT_FAILED }, -- /*4*/{ 4, NULL, "es", ULOC_ACCEPT_VALID }, -- -- /*5*/{ 5, NULL, "en", ULOC_ACCEPT_VALID }, /* XF */ -- /*6*/{ 6, NULL, "ja", ULOC_ACCEPT_FALLBACK }, /* XF */ -- /*7*/{ 7, NULL, "zh", ULOC_ACCEPT_FALLBACK }, /* XF */ -+ /*0*/{ 0, NULL, "mt_MT", ULOC_ACCEPT_VALID, U_ZERO_ERROR}, -+ /*1*/{ 1, NULL, "en", ULOC_ACCEPT_VALID, U_ZERO_ERROR}, -+ /*2*/{ 2, NULL, "en", ULOC_ACCEPT_FALLBACK, U_ZERO_ERROR}, -+ /*3*/{ 3, NULL, "", ULOC_ACCEPT_FAILED, U_ZERO_ERROR}, -+ /*4*/{ 4, NULL, "es", ULOC_ACCEPT_VALID, U_ZERO_ERROR}, -+ /*5*/{ 5, NULL, "en", ULOC_ACCEPT_VALID, U_ZERO_ERROR}, /* XF */ -+ /*6*/{ 6, NULL, "ja", ULOC_ACCEPT_FALLBACK, U_ZERO_ERROR}, /* XF */ -+ /*7*/{ 7, NULL, "zh", ULOC_ACCEPT_FALLBACK, U_ZERO_ERROR}, /* XF */ -+ /*8*/{ 8, NULL, "", ULOC_ACCEPT_FAILED, U_ZERO_ERROR }, /* */ -+ /*9*/{ 9, NULL, "", ULOC_ACCEPT_FAILED, U_ZERO_ERROR }, /* */ -+ /*10*/{10, NULL, "", ULOC_ACCEPT_FAILED, U_BUFFER_OVERFLOW_ERROR }, /* */ -+ /*11*/{11, NULL, "", ULOC_ACCEPT_FAILED, U_BUFFER_OVERFLOW_ERROR }, /* */ - }; - const int32_t numTests = UPRV_LENGTHOF(tests); - static const char *http[] = { -@@ -2800,10 +2804,25 @@ - "xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, " - "xxx-yyy;q=.01, xxx-yyy;q=.01, xxx-yyy;q=.01, xx-yy;q=.1, " - "es", -- - /*5*/ "zh-xx;q=0.9, en;q=0.6", - /*6*/ "ja-JA", - /*7*/ "zh-xx;q=0.9", -+ /*08*/ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", // 156 -+ /*09*/ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB", // 157 (this hits U_STRING_NOT_TERMINATED_WARNING ) -+ /*10*/ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABC", // 158 -+ /*11*/ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" -+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", // 163 bytes - }; - - for(i=0;i<numTests;i++) { -@@ -2818,17 +2837,22 @@ - (void)rc; /* Suppress set but not used warning. */ - uenum_close(available); - log_verbose(" got %s, %s [%s]\n", tmp[0]?tmp:"(EMPTY)", acceptResult(outResult), u_errorName(status)); -- if(outResult != tests[i].res) { -+ if(status != tests[i].expectStatus) { -+ log_err_status(status, "FAIL: expected status %s but got %s\n", u_errorName(tests[i].expectStatus), u_errorName(status)); -+ } else if(U_SUCCESS(tests[i].expectStatus)) { -+ /* don't check content if expected failure */ -+ if(outResult != tests[i].res) { - log_err_status(status, "FAIL: #%d: expected outResult of %s but got %s\n", i, - acceptResult( tests[i].res), - acceptResult( outResult)); - log_info("test #%d: http[%s], ICU[%s], expect %s, %s\n", - i, http[tests[i].httpSet], tests[i].icuSet, tests[i].expect,acceptResult(tests[i].res)); -- } -- if((outResult>0)&&uprv_strcmp(tmp, tests[i].expect)) { -- log_err_status(status, "FAIL: #%d: expected %s but got %s\n", i, tests[i].expect, tmp); -- log_info("test #%d: http[%s], ICU[%s], expect %s, %s\n", -- i, http[tests[i].httpSet], tests[i].icuSet, tests[i].expect, acceptResult(tests[i].res)); -+ } -+ if((outResult>0)&&uprv_strcmp(tmp, tests[i].expect)) { -+ log_err_status(status, "FAIL: #%d: expected %s but got %s\n", i, tests[i].expect, tmp); -+ log_info("test #%d: http[%s], ICU[%s], expect %s, %s\n", -+ i, http[tests[i].httpSet], tests[i].icuSet, tests[i].expect, acceptResult(tests[i].res)); -+ } - } - } - } diff --git a/rhbz1444101-icu-changeset-39671.patch b/rhbz1444101-icu-changeset-39671.patch deleted file mode 100644 index 59e4375..0000000 --- a/rhbz1444101-icu-changeset-39671.patch +++ /dev/null @@ -1,156 +0,0 @@ -#
https://ssl.icu-project.org/trac/changeset/39671
-Index: /trunk/icu4c/source/common/utext.cpp -=================================================================== ---- icu.orig/source/common/utext.cpp -+++ icu/source/common/utext.cpp -@@ -848,7 +848,13 @@ - - // Chunk size. --// Must be less than 85, because of byte mapping from UChar indexes to native indexes. --// Worst case is three native bytes to one UChar. (Supplemenaries are 4 native bytes --// to two UChars.) -+// Must be less than 42 (256/6), because of byte mapping from UChar indexes to native indexes. -+// Worst case there are six UTF-8 bytes per UChar. -+// obsolete 6 byte form fd + 5 trails maps to fffd -+// obsolete 5 byte form fc + 4 trails maps to fffd -+// non-shortest 4 byte forms maps to fffd -+// normal supplementaries map to a pair of utf-16, two utf8 bytes per utf-16 unit -+// mapToUChars array size must allow for the worst case, 6. -+// This could be brought down to 4, by treating fd and fc as pure illegal, -+// rather than obsolete lead bytes. But that is not compatible with the utf-8 access macros. - // - enum { UTF8_TEXT_CHUNK_SIZE=32 }; -@@ -890,5 +896,5 @@ - // one for a supplementary starting in the last normal position, - // and one for an entry for the buffer limit position. -- uint8_t mapToUChars[UTF8_TEXT_CHUNK_SIZE*3+6]; // Map native offset from bufNativeStart to -+ uint8_t mapToUChars[UTF8_TEXT_CHUNK_SIZE*6+6]; // Map native offset from bufNativeStart to - // correspoding offset in filled part of buf. - int32_t align; -@@ -1033,4 +1039,5 @@ - u8b = (UTF8Buf *)ut->p; // the current buffer - mapIndex = ix - u8b->toUCharsMapStart; -+ U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars)); - ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; - return TRUE; -@@ -1299,4 +1306,8 @@ - // If index is at the end, there is no character there to look at. - if (ix != ut->b) { -+ // Note: this function will only move the index back if it is on a trail byte -+ // and there is a preceding lead byte and the sequence from the lead -+ // through this trail could be part of a valid UTF-8 sequence -+ // Otherwise the index remains unchanged. - U8_SET_CP_START(s8, 0, ix); - } -@@ -1312,5 +1323,8 @@ - uint8_t *mapToNative = u8b->mapToNative; - uint8_t *mapToUChars = u8b->mapToUChars; -- int32_t toUCharsMapStart = ix - (UTF8_TEXT_CHUNK_SIZE*3 + 1); -+ int32_t toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1; -+ // Note that toUCharsMapStart can be negative. Happens when the remaining -+ // text from current position to the beginning is less than the buffer size. -+ // + 1 because mapToUChars must have a slot at the end for the bufNativeLimit entry. - int32_t destIx = UTF8_TEXT_CHUNK_SIZE+2; // Start in the overflow region - // at end of buffer to leave room -@@ -1339,4 +1353,5 @@ - // Special case ASCII range for speed. - buf[destIx] = (UChar)c; -+ U_ASSERT(toUCharsMapStart <= srcIx); - mapToUChars[srcIx - toUCharsMapStart] = (uint8_t)destIx; - mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart); -@@ -1368,4 +1383,5 @@ - mapToUChars[sIx-- - toUCharsMapStart] = (uint8_t)destIx; - } while (sIx >= srcIx); -+ U_ASSERT(toUCharsMapStart <= (srcIx+1)); - - // Set native indexing limit to be the current position. -@@ -1542,4 +1558,5 @@ - U_ASSERT(index<=ut->chunkNativeLimit); - int32_t mapIndex = index - u8b->toUCharsMapStart; -+ U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars)); - int32_t offset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx; - U_ASSERT(offset>=0 && offset<=ut->chunkLength); -Index: /trunk/icu4c/source/test/intltest/utxttest.cpp -=================================================================== ---- icu.orig/source/test/intltest/utxttest.cpp -+++ icu/source/test/intltest/utxttest.cpp -@@ -68,4 +68,6 @@ - case 7: name = "Ticket12130"; - if (exec) Ticket12130(); break; -+ case 8: name = "Ticket12888"; -+ if (exec) Ticket12888(); break; - default: name = ""; break; - } -@@ -1584,2 +1586,62 @@ - utext_close(&ut); - } -+ -+// Ticket 12888: bad handling of illegal utf-8 containing many instances of the archaic, now illegal, -+// six byte utf-8 forms. Original implementation had an assumption that -+// there would be at most three utf-8 bytes per UTF-16 code unit. -+// The five and six byte sequences map to a single replacement character. -+ -+void UTextTest::Ticket12888() { -+ const char *badString = -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80" -+ "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"; -+ -+ UErrorCode status = U_ZERO_ERROR; -+ LocalUTextPointer ut(utext_openUTF8(NULL, badString, -1, &status)); -+ TEST_SUCCESS(status); -+ for (;;) { -+ UChar32 c = utext_next32(ut.getAlias()); -+ if (c == U_SENTINEL) { -+ break; -+ } -+ } -+ int32_t endIdx = utext_getNativeIndex(ut.getAlias()); -+ if (endIdx != (int32_t)strlen(badString)) { -+ errln("%s:%d expected=%d, actual=%d", __FILE__, __LINE__, strlen(badString), endIdx); -+ return; -+ } -+ -+ for (int32_t prevIndex = endIdx; prevIndex>0;) { -+ UChar32 c = utext_previous32(ut.getAlias()); -+ int32_t currentIndex = utext_getNativeIndex(ut.getAlias()); -+ if (c != 0xfffd) { -+ errln("%s:%d (expected, actual, index) = (%d, %d, %d)\n", -+ __FILE__, __LINE__, 0xfffd, c, currentIndex); -+ break; -+ } -+ if (currentIndex != prevIndex - 6) { -+ errln("%s:%d: wrong index. Expected, actual = %d, %d", -+ __FILE__, __LINE__, prevIndex - 6, currentIndex); -+ break; -+ } -+ prevIndex = currentIndex; -+ } -+} -Index: /trunk/icu4c/source/test/intltest/utxttest.h -=================================================================== ---- icu.orig/source/test/intltest/utxttest.h -+++ icu/source/test/intltest/utxttest.h -@@ -39,4 +39,5 @@ - void Ticket10983(); - void Ticket12130(); -+ void Ticket12888(); - - private: diff --git a/rhbz1510932-icu-changeset-40324.patch b/rhbz1510932-icu-changeset-40324.patch deleted file mode 100644 index a651eb1..0000000 --- a/rhbz1510932-icu-changeset-40324.patch +++ /dev/null @@ -1,11 +0,0 @@ -#
https://ssl.icu-project.org/trac/changeset/40324/trunk/icu4c/source/i18n/zo…
-Index: trunk/icu4c/source/i18n/zonemeta.cpp -=================================================================== ---- icu.orig/source/i18n/zonemeta.cpp -+++ icu/source/i18n/zonemeta.cpp -@@ -691,5 +691,4 @@ - if (U_FAILURE(status)) { - delete mzMappings; -- deleteOlsonToMetaMappingEntry(entry); - uprv_free(entry); - break; diff --git a/sources b/sources deleted file mode 100644 index 03d3a1e..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -SHA512 (icu4c-57_1-src.tgz) = a3c701e9c81622db545bcf93f315c7b13159750f43f009d0aec59ceae3a8e1ccb751826d4b8a7387aca47f38bff2a85816b1a123b07d2bf731558c7b66e47b8a
1
0
0
0
Architecture specific change in rpms/compat-libvpx4.git
by githook-noreply@fedoraproject.org
01 May '18
01 May '18
The package rpms/compat-libvpx4.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/compat-libvpx4.git/commit/?id=ead6e…
. Change: -%ifarch armv7hl Thanks. Full change: ============ commit ead6ec7694943cde708a3142eeeb73eb322ba96d Author: Pete Walter <pwalter(a)fedoraproject.org> Date: Mon Apr 30 20:50:10 2018 +0100 Retire old compat package in F29+ diff --git a/.gitignore b/.gitignore deleted file mode 100644 index c2e3f9a..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/v1.6.1.tar.gz diff --git a/0001-Fix-image-width-alignment.-Enable-ImageSizeSetting-t.patch b/0001-Fix-image-width-alignment.-Enable-ImageSizeSetting-t.patch deleted file mode 100644 index 7a9b469..0000000 --- a/0001-Fix-image-width-alignment.-Enable-ImageSizeSetting-t.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 5a40c8fde11bf82cccb5bd2f57c46ab5e6262cbf Mon Sep 17 00:00:00 2001 -From: Jerome Jiang <jianj(a)google.com> -Date: Wed, 27 Sep 2017 11:08:37 -0700 -Subject: [PATCH] Fix image width alignment. Enable ImageSizeSetting test. - -BUG=b/64710201 - -Change-Id: I5465f6c6481d3c9a5e00fcab024cf4ae562b6b01 - -diff --git a/vpx/src/vpx_image.c b/vpx/src/vpx_image.c -index dba439c10..ebd3d7f74 100644 ---- a/vpx/src/vpx_image.c -+++ b/vpx/src/vpx_image.c -@@ -88,11 +88,10 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt, - default: ycs = 0; break; - } - -- /* Calculate storage sizes given the chroma subsampling */ -- align = (1 << xcs) - 1; -- w = (d_w + align) & ~align; -- align = (1 << ycs) - 1; -- h = (d_h + align) & ~align; -+ /* Calculate storage sizes. If the buffer was allocated externally, the width -+ * and height shouldn't be adjusted. */ -+ w = d_w; -+ h = d_h; - s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8; - s = (s + stride_align - 1) & ~(stride_align - 1); - stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s; -@@ -111,9 +110,18 @@ static vpx_image_t *img_alloc_helper(vpx_image_t *img, vpx_img_fmt_t fmt, - img->img_data = img_data; - - if (!img_data) { -- const uint64_t alloc_size = (fmt & VPX_IMG_FMT_PLANAR) -- ? (uint64_t)h * s * bps / 8 -- : (uint64_t)h * s; -+ uint64_t alloc_size; -+ /* Calculate storage sizes given the chroma subsampling */ -+ align = xcs ? (1 << xcs) - 1 : 1; -+ w = (d_w + align - 1) & ~(align - 1); -+ align = ycs ? (1 << ycs) - 1 : 1; -+ h = (d_h + align - 1) & ~(align - 1); -+ -+ s = (fmt & VPX_IMG_FMT_PLANAR) ? w : bps * w / 8; -+ s = (s + stride_align - 1) & ~(stride_align - 1); -+ stride_in_bytes = (fmt & VPX_IMG_FMT_HIGHBITDEPTH) ? s * 2 : s; -+ alloc_size = (fmt & VPX_IMG_FMT_PLANAR) ? (uint64_t)h * s * bps / 8 -+ : (uint64_t)h * s; - - if (alloc_size != (size_t)alloc_size) goto fail; - --- -2.14.3 - diff --git a/compat-libvpx4.spec b/compat-libvpx4.spec deleted file mode 100644 index 607c9b6..0000000 --- a/compat-libvpx4.spec +++ /dev/null @@ -1,164 +0,0 @@ -%global somajor 4 -%global sominor 0 -%global sotiny 0 -%global soversion %{somajor}.%{sominor}.%{sotiny} - -Name: compat-libvpx4 -Summary: Compat package with libvpx libraries -Version: 1.6.1 -Release: 1%{?dist} -License: BSD -Group: System Environment/Libraries -#Source0:
http://downloads.webmproject.org/releases/webm/%{name}-%{version}.tar.bz2
-Source0:
https://github.com/webmproject/libvpx/archive/v%{version}.tar.gz
-# Thanks to debian. -Source2: libvpx.ver -URL:
http://www.webmproject.org/code/
-%ifarch %{ix86} x86_64 -BuildRequires: yasm -%endif -BuildRequires: doxygen, php-cli, perl(Getopt::Long) - -#Fix CVE-2017-13194 -Patch001: 0001-Fix-image-width-alignment.-Enable-ImageSizeSetting-t.patch - -# Explicitly conflict with older libvpx packages that ship libraries -# with the same soname as this compat package -Conflicts: libvpx < 1.7.0 - -%description -Compatibility package with libvpx libraries ABI version 4. - -%prep -%setup -q -n libvpx-%{version} -%patch001 -p1 -b .001 - -%build -%ifarch %{ix86} -%global vpxtarget x86-linux-gcc -%else -%ifarch x86_64 -%global vpxtarget x86_64-linux-gcc -%else -%ifarch armv7hl -%global vpxtarget armv7-linux-gcc -%else -%global vpxtarget generic-gnu -%endif -%endif -%endif - -# History: The configure script used to reject the shared flag on the generic target. -# This meant that we needed to fall back to manual shared lib creation. -# However, the modern configure script permits the shared flag and assumes ELF. -# Additionally, the libvpx.ver would need to be updated to work properly. -# As a result, we disable this universally, but keep it around in case we ever need to support -# something "special". -%if "%{vpxtarget}" == "generic-gnu" -%global generic_target 0 -%else -%global generic_target 0 -%endif - -%ifarch armv7hl -CROSS=armv7hl-redhat-linux-gnueabi- CHOST=armv7hl-redhat-linux-gnueabi-hardfloat ./configure \ -%else -./configure --target=%{vpxtarget} \ -%endif -%ifarch %{arm} ---disable-neon --disable-neon_asm \ -%endif ---enable-pic --disable-install-srcs \ ---enable-vp9-decoder --enable-vp9-encoder \ ---enable-experimental --enable-spatial-svc \ ---enable-vp9-highbitdepth \ -%if ! %{generic_target} ---enable-shared \ -%endif ---prefix=%{_prefix} --libdir=%{_libdir} --size-limit=16384x16384 - -# Hack our optflags in. -sed -i "s|-O3|%{optflags}|g" libs-%{vpxtarget}.mk -sed -i "s|-O3|%{optflags}|g" examples-%{vpxtarget}.mk -sed -i "s|-O3|%{optflags}|g" docs-%{vpxtarget}.mk - -%ifarch armv7hl -#hackety hack hack -sed -i "s|AR=armv7hl-redhat-linux-gnueabi-ar|AR=ar|g" libs-%{vpxtarget}.mk -sed -i "s|AR=armv7hl-redhat-linux-gnueabi-ar|AR=ar|g" examples-%{vpxtarget}.mk -sed -i "s|AR=armv7hl-redhat-linux-gnueabi-ar|AR=ar|g" docs-%{vpxtarget}.mk - -sed -i "s|AS=armv7hl-redhat-linux-gnueabi-as|AS=as|g" libs-%{vpxtarget}.mk -sed -i "s|AS=armv7hl-redhat-linux-gnueabi-as|AS=as|g" examples-%{vpxtarget}.mk -sed -i "s|AS=armv7hl-redhat-linux-gnueabi-as|AS=as|g" docs-%{vpxtarget}.mk - -sed -i "s|NM=armv7hl-redhat-linux-gnueabi-nm|NM=nm|g" libs-%{vpxtarget}.mk -sed -i "s|NM=armv7hl-redhat-linux-gnueabi-nm|NM=nm|g" examples-%{vpxtarget}.mk -sed -i "s|NM=armv7hl-redhat-linux-gnueabi-nm|NM=nm|g" docs-%{vpxtarget}.mk -%endif - -make %{?_smp_mflags} verbose=true - -# Manual shared library creation -# We should never need to do this anymore, and if we do, we need to fix the version-script. -%if %{generic_target} -mkdir tmp -cd tmp -ar x ../libvpx_g.a -cd .. -gcc -fPIC -shared -pthread -lm -Wl,--no-undefined -Wl,-soname,libvpx.so.%{somajor} -Wl,--version-script,%{SOURCE2} -Wl,-z,noexecstack -o libvpx.so.%{soversion} tmp/*.o -rm -rf tmp -%endif - -# Temporarily dance the static libs out of the way -# mv libvpx.a libNOTvpx.a -# mv libvpx_g.a libNOTvpx_g.a - -# We need to do this so the examples can link against it. -# ln -sf libvpx.so.%{soversion} libvpx.so - -# make %{?_smp_mflags} verbose=true target=examples CONFIG_SHARED=1 -# make %{?_smp_mflags} verbose=true target=docs - -# Put them back so the install doesn't fail -# mv libNOTvpx.a libvpx.a -# mv libNOTvpx_g.a libvpx_g.a - -%install -make DIST_DIR=%{buildroot}%{_prefix} dist - -# Simpler to label the dir as %%doc. -if [ -d %{buildroot}/usr/docs ]; then - mv %{buildroot}/usr/docs doc/ -fi - -# Again, we should never need to do this anymore. -%if %{generic_target} -install -p libvpx.so.%{soversion} %{buildroot}%{_libdir} -pushd %{buildroot}%{_libdir} -ln -sf libvpx.so.%{soversion} libvpx.so -ln -sf libvpx.so.%{soversion} libvpx.so.%{somajor} -ln -sf libvpx.so.%{soversion} libvpx.so.%{somajor}.%{sominor} -popd -%endif - -pushd %{buildroot} -# Stuff we don't need. -rm -rf usr/build/ usr/md5sums.txt usr/lib*/*.a usr/CHANGELOG usr/README -# No, bad google. No treat. -mv usr/bin/examples/* usr/bin/ -rm -rf usr/bin/examples - -# Remove files that aren't needed for the compat package -rm -rf %{buildroot}%{_bindir} -rm -rf %{buildroot}%{_includedir} -rm -rf %{buildroot}%{_libdir}/*.so -rm -rf %{buildroot}%{_libdir}/pkgconfig/ - -%files -%license LICENSE -%{_libdir}/libvpx.so.* - -%changelog -* Wed Feb 07 2018 Pete Walter <pwalter(a)fedoraproject.org> - 1.6.1-1 -- Initial packaging diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..2a9b05a --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +Retire old compat package in F29+ diff --git a/libvpx.ver b/libvpx.ver deleted file mode 100644 index aa147ab..0000000 --- a/libvpx.ver +++ /dev/null @@ -1,79 +0,0 @@ -{ global: -vpx_codec_build_config; -vpx_codec_control_; -vpx_codec_dec_init_ver; -vpx_codec_decode; -vpx_codec_destroy; -vpx_codec_enc_config_default; -vpx_codec_enc_config_set; -vpx_codec_enc_init_ver; -vpx_codec_encode; -vpx_codec_error; -vpx_codec_error_detail; -vpx_codec_err_to_string; -vpx_codec_get_caps; -vpx_codec_get_cx_data; -vpx_codec_get_frame; -vpx_codec_get_global_headers; -vpx_codec_get_mem_map; -vpx_codec_get_preview_frame; -vpx_codec_get_stream_info; -vpx_codec_iface_name; -vpx_codec_peek_stream_info; -vpx_codec_register_put_frame_cb; -vpx_codec_register_put_slice_cb; -vpx_codec_set_cx_data_buf; -vpx_codec_set_frame_buffer_functions; -vpx_codec_set_mem_map; -vpx_codec_version; -vpx_codec_version_extra_str; -vpx_codec_version_str; -vpx_codec_vp8_algo; -vpx_codec_vp8_cx; -vpx_codec_vp8_cx_algo; -vpx_codec_vp8_dx; -vpx_codec_vp8_dx_algo; -vpx_codec_vp9_cx; -vpx_codec_vp9_cx_algo; -vpx_codec_vp9_dx; -vpx_codec_vp9_dx_algo; -vpx_dec_control; -vpx_dec_decode; -vpx_dec_destroy; -vpx_dec_error; -vpx_dec_error_detail; -vpx_dec_err_to_string; -vpx_dec_get_caps; -vpx_dec_get_frame; -vpx_dec_get_mem_map; -vpx_dec_get_stream_info; -vpx_dec_iface_name; -vpx_dec_init_ver; -vpx_dec_peek_stream_info; -vpx_dec_register_put_frame_cb; -vpx_dec_register_put_slice_cb; -vpx_dec_set_mem_map; -vpx_dec_xma_init_ver; -vpx_enc_vp8_algo; -vpx_img_alloc; -vpx_img_flip; -vpx_img_free; -vpx_img_set_rect; -vpx_img_wrap; -vpx_svc_dump_statistics; -vpx_svc_encode; -vpx_svc_get_buffer; -vpx_svc_get_encode_frame_count; -vpx_svc_get_frame_size; -vpx_svc_get_layer_resolution; -vpx_svc_get_message; -vpx_svc_get_rc_stats_buffer; -vpx_svc_get_rc_stats_buffer_size; -vpx_svc_init; -vpx_svc_is_keyframe; -vpx_svc_release; -vpx_svc_set_keyframe; -vpx_svc_set_options; -vpx_svc_set_quantizers; -vpx_svc_set_scale_factors; -local: *; }; diff --git a/sources b/sources deleted file mode 100644 index 588eb3f..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -SHA512 (v1.6.1.tar.gz) = 13b7eb515d026b302b8c484d6f06df067feb5aed4ceac953d85fe84fd684dab07e89ddbf80b4f395c6d9127709422156287e5754f49246050b2e18930adb3970
1
0
0
0
Architecture specific change in rpms/compat-libicu60.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/compat-libicu60.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/compat-libicu60.git/commit/?id=8a44…
. Change: +%ifarch armv7hl Thanks. Full change: ============ commit 8a440b1d20cdc4d35182356b330c53315bff0b05 Author: Pete Walter <pwalter(a)fedoraproject.org> Date: Mon Apr 30 19:57:38 2018 +0100 Initial import diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1adc5c6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/icu4c-60_2-src.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 1108cb2..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# compat-libicu60 - -The compat-libicu60 package \ No newline at end of file diff --git a/armv7hl-disable-tests.patch b/armv7hl-disable-tests.patch new file mode 100644 index 0000000..2d869b1 --- /dev/null +++ b/armv7hl-disable-tests.patch @@ -0,0 +1,96 @@ +diff -ru orig.icu/source/test/cintltst/cnmdptst.c icu/source/test/cintltst/cnmdptst.c +--- orig.icu/source/test/cintltst/cnmdptst.c 2016-03-23 21:48:18.000000000 +0100 ++++ icu/source/test/cintltst/cnmdptst.c 2016-04-15 18:34:06.148251985 +0200 +@@ -186,6 +186,12 @@ + /* Test exponential pattern*/ + static void TestExponential(void) + { ++/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ ++#if 1 ++ /* Actually only 3 tests fail, but given the nested structure depending on ++ * array sizes there's no simple "disable this and that". */ ++ return; ++#endif + int32_t pat_length, val_length, lval_length; + int32_t ival, ilval, p, v, lneed; + UNumberFormat *fmt; +diff -ru orig.icu/source/test/intltest/dcfmtest.cpp icu/source/test/intltest/dcfmtest.cpp +--- orig.icu/source/test/intltest/dcfmtest.cpp 2016-03-23 21:48:38.000000000 +0100 ++++ icu/source/test/intltest/dcfmtest.cpp 2016-04-15 18:34:06.148251985 +0200 +@@ -279,6 +279,13 @@ + // + formatLineMat.reset(testLine); + if (formatLineMat.lookingAt(status)) { ++/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ ++#if 1 ++// [Formattable] file dcfmtest.txt, line 62: expected "12.35E5", got "1.235E6" ++// [StringPiece] file dcfmtest.txt, line 62: expected "12.35E5", got "1.235E6" ++ if (lineNum == 62) ++ continue; ++#endif + execFormatTest(lineNum, + formatLineMat.group(1, status), // Pattern + formatLineMat.group(2, status), // rounding mode +diff -ru orig.icu/source/test/intltest/numfmtspectest.cpp icu/source/test/intltest/numfmtspectest.cpp +--- orig.icu/source/test/intltest/numfmtspectest.cpp 2016-03-23 21:48:40.000000000 +0100 ++++ icu/source/test/intltest/numfmtspectest.cpp 2016-04-15 18:34:06.148251985 +0200 +@@ -137,11 +137,14 @@ + + void NumberFormatSpecificationTest::TestScientificNotation() { + assertPatternFr("1,23E4", 12345.0, "0.00E0", TRUE); ++/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ ++#if 0 + assertPatternFr("123,00E2", 12300.0, "000.00E0", TRUE); + assertPatternFr("123,0E2", 12300.0, "000.0#E0", TRUE); + assertPatternFr("123,0E2", 12300.1, "000.0#E0", TRUE); + assertPatternFr("123,01E2", 12301.0, "000.0#E0", TRUE); + assertPatternFr("123,01E+02", 12301.0, "000.0#E+00", TRUE); ++#endif + assertPatternFr("12,3E3", 12345.0, "##0.00E0", TRUE); + assertPatternFr("12,300E3", 12300.1, "##0.0000E0", TRUE); + assertPatternFr("12,30E3", 12300.1, "##0.000#E0", TRUE); +@@ -221,6 +224,8 @@ + assertEquals("", "USD (433.22)", result, TRUE); + } + } ++/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ ++#if 0 + const char *paddedSciPattern = "QU**00.#####E0"; + assertPatternFr("QU***43,3E-1", 4.33, paddedSciPattern, TRUE); + { +@@ -242,6 +247,7 @@ + } + // padding cannot work as intended with scientific notation. + assertPatternFr("QU**43,32E-1", 4.332, paddedSciPattern, TRUE); ++#endif + } + + void NumberFormatSpecificationTest::assertPatternFr( +diff -ru orig.icu/source/test/intltest/numfmtst.cpp icu/source/test/intltest/numfmtst.cpp +--- orig.icu/source/test/intltest/numfmtst.cpp 2016-03-23 21:48:40.000000000 +0100 ++++ icu/source/test/intltest/numfmtst.cpp 2016-04-15 18:34:06.150251997 +0200 +@@ -730,6 +730,12 @@ + void + NumberFormatTest::TestExponential(void) + { ++/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ ++#if 1 ++ /* Actually only 3 tests fail, but given the nested structure depending on ++ * array sizes there's no simple "disable this and that". */ ++ return; ++#endif + UErrorCode status = U_ZERO_ERROR; + DecimalFormatSymbols sym(Locale::getUS(), status); + if (U_FAILURE(status)) { errcheckln(status, "FAIL: Bad status returned by DecimalFormatSymbols ct - %s", u_errorName(status)); return; } +@@ -1846,8 +1852,11 @@ + (int32_t) 45678000, "5E7", status); + expect(new DecimalFormat("00E0", US, status), + (int32_t) 45678000, "46E6", status); ++/* erAck: fails on armv7hl,
https://bugzilla.redhat.com/show_bug.cgi?id=1239574
*/ ++#if 0 + expect(new DecimalFormat("000E0", US, status), + (int32_t) 45678000, "457E5", status); ++#endif + /* + expect(new DecimalFormat("###E0", US, status), + new Object[] { new Double(0.0000123), "12.3E-6", diff --git a/compat-libicu60.spec b/compat-libicu60.spec new file mode 100644 index 0000000..4a60b54 --- /dev/null +++ b/compat-libicu60.spec @@ -0,0 +1,89 @@ +Name: compat-libicu60 +Version: 60.2 +Release: 1%{?dist} +Summary: Compat package with icu libraries + +License: MIT and UCD and Public Domain +URL:
http://www.icu-project.org/
+Source0:
http://download.icu-project.org/files/icu4c/60.2/icu4c-60_2-src.tgz
+ +BuildRequires: doxygen, autoconf, python2 + +Patch4: gennorm2-man.patch +Patch5: icuinfo-man.patch +Patch100: armv7hl-disable-tests.patch + +# Explicitly conflict with older icu packages that ship libraries +# with the same soname as this compat package +Conflicts: libicu < 61 + +%description +Compatibility package with libicu libraries ABI version 60. + + +%prep +%setup -q -n icu +%patch4 -p1 -b .gennorm2-man.patch +%patch5 -p1 -b .icuinfo-man.patch +%ifarch armv7hl +%patch100 -p1 -b .armv7hl-disable-tests.patch +%endif + + +%build +pushd source +autoconf +CFLAGS='%optflags -fno-strict-aliasing' +CXXFLAGS='%optflags -fno-strict-aliasing' +# Endian: BE=0 LE=1 +%if ! 0%{?endian} +CPPFLAGS='-DU_IS_BIG_ENDIAN=1' +%endif + +#rhbz856594 do not use --disable-renaming or cope with the mess +OPTIONS='--with-data-packaging=library --disable-samples' +%if 0%{?debugtrace} +OPTIONS=$OPTIONS' --enable-debug --enable-tracing' +%endif +%configure $OPTIONS + +#rhbz#225896 +sed -i 's|-nodefaultlibs -nostdlib||' config/mh-linux +#rhbz#813484 +sed -i 's| \$(docfilesdir)/installdox||' Makefile +# There is no source/doc/html/search/ directory +sed -i '/^\s\+\$(INSTALL_DATA) \$(docsrchfiles) \$(DESTDIR)\$(docdir)\/\$(docsubsrchdir)\s*$/d' Makefile +# rhbz#856594 The configure --disable-renaming and possibly other options +# result in icu/source/uconfig.h.prepend being created, include that content in +# icu/source/common/unicode/uconfig.h to propagate to consumer packages. +test -f uconfig.h.prepend && sed -e '/^#define __UCONFIG_H__/ r uconfig.h.prepend' -i common/unicode/uconfig.h + +# more verbosity for build.log +sed -i -r 's|(PKGDATA_OPTS = )|\1-v |' data/Makefile + +make %{?_smp_mflags} VERBOSE=1 + + +%install +make %{?_smp_mflags} -C source install DESTDIR=$RPM_BUILD_ROOT +chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so.* + +# Remove files that aren't needed for the compat package +rm -rf $RPM_BUILD_ROOT%{_bindir} +rm -rf $RPM_BUILD_ROOT%{_includedir} +rm -rf $RPM_BUILD_ROOT%{_libdir}/*.so +rm -rf $RPM_BUILD_ROOT%{_libdir}/icu/ +rm -rf $RPM_BUILD_ROOT%{_libdir}/pkgconfig/ +rm -rf $RPM_BUILD_ROOT%{_sbindir} +rm -rf $RPM_BUILD_ROOT%{_datadir}/icu/ +rm -rf $RPM_BUILD_ROOT%{_mandir} + + +%files +%license LICENSE +%{_libdir}/*.so.* + + +%changelog +* Mon Apr 30 2018 Pete Walter <pwalter(a)fedoraproject.org> - 60.2-1 +- Initial packaging diff --git a/gennorm2-man.patch b/gennorm2-man.patch new file mode 100644 index 0000000..07b5b9d --- /dev/null +++ b/gennorm2-man.patch @@ -0,0 +1,128 @@ +Description: supply manual page for program that doesn't have one +Author: Jay Berkenbilt <qjb(a)debian.org> +Bug:
http://bugs.icu-project.org/trac/ticket/7554
+ +diff -r -u -N icu.orig/source/tools/gennorm2/gennorm2.8.in icu/source/tools/gennorm2/gennorm2.8.in +--- icu.orig/source/tools/gennorm2/gennorm2.8.in 1970-01-01 01:00:00.000000000 +0100 ++++ icu/source/tools/gennorm2/gennorm2.8.in 2013-02-25 16:43:28.297062638 +0100 +@@ -0,0 +1,71 @@ ++.\" Hey, Emacs! This is -*-nroff-*- you know... ++.\" ++.\" gennorm2.8: manual page for the gennorm2 utility ++.\" ++.\" Copyright (C) 2005-2006 International Business Machines Corporation and others ++.\" ++.TH GENNORM2 8 "15 March 2010" "ICU MANPAGE" "ICU @VERSION@ Manual" ++.SH NAME ++.B gennorm2 ++\- Builds binary data file with Unicode normalization data. ++.SH SYNOPSIS ++.B gennorm2 ++[ ++.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" ++] ++[ ++.BR "\-V\fP, \fB\-\-version" ++] ++[ ++.BR "\-c\fP, \fB\-\-copyright" ++] ++[ ++.BR "\-v\fP, \fB\-\-verbose" ++] ++[ ++.BI "\-u\fP, \fB\-\-unicode" " unicode\-version\-number" ++] ++[ ++.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory" ++] ++[ ++.BI "\-o\fP, \fB\-\-output" " output\-filename" ++] ++.BI "\fB\-\-fast" ++.SH DESCRIPTION ++.B gennorm2 ++reads text files that define Unicode normalization, ++them, and builds a binary data file. ++.SH OPTIONS ++.TP ++.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" ++Print help about usage and exit. ++.TP ++.BR "\-V\fP, \fB\-\-version" ++Print the version of ++.B gennorm2 ++and exit. ++.TP ++.BR "\-c\fP, \fB\-\-copyright" ++Include a copyright notice. ++.TP ++.BR "\-v\fP, \fB\-\-verbose" ++Display extra informative messages during execution. ++.TP ++.BR "\-u\fP, \fB\-\-unicode" ++Specify Unicode version number, such as 5.2.0. ++.TP ++.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory" ++Specify the input directory. ++.TP ++.BI "\-s\fP, \fB\-\-sourcedir" " source\-directory" ++Set the name of the output file. ++.TP ++.BI "\fB\-\-fast" ++optimize the .nrm file for fast normalization, ++which might increase its size (Writes fully decomposed ++regular mappings instead of delta mappings. ++You should measure the runtime speed to make sure that ++this is a good trade-off.) ++.SH COPYRIGHT ++Copyright (C) 2009-2010 International Business Machines Corporation and others +diff -r -u -N icu.orig/source/tools/gennorm2/Makefile.in icu/source/tools/gennorm2/Makefile.in +--- icu.orig/source/tools/gennorm2/Makefile.in 2013-01-11 01:23:32.000000000 +0100 ++++ icu/source/tools/gennorm2/Makefile.in 2013-02-25 16:43:28.296062632 +0100 +@@ -16,8 +16,13 @@ + + TARGET_STUB_NAME = gennorm2 + ++SECTION = 8 ++ ++MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) ++ ++ + ## Extra files to remove for 'make clean' +-CLEANFILES = *~ $(DEPS) ++CLEANFILES = *~ $(DEPS) $(MAN_FILES) + + ## Target information + TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) +@@ -44,12 +49,16 @@ + dist: dist-local + check: all check-local + +-all-local: $(TARGET) ++all-local: $(TARGET) $(MAN_FILES) + +-install-local: all-local ++install-local: all-local install-man + $(MKINSTALLDIRS) $(DESTDIR)$(sbindir) + $(INSTALL) $(TARGET) $(DESTDIR)$(sbindir) + ++install-man: $(MAN_FILES) ++ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION) ++ $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION) ++ + dist-local: + + clean-local: +@@ -70,6 +79,11 @@ + $(POST_BUILD_STEP) + + ++%.$(SECTION): $(srcdir)/%.$(SECTION).in ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ ++ + ifeq (,$(MAKECMDGOALS)) + -include $(DEPS) + else diff --git a/icuinfo-man.patch b/icuinfo-man.patch new file mode 100644 index 0000000..987e879 --- /dev/null +++ b/icuinfo-man.patch @@ -0,0 +1,145 @@ +Description: supply manual page for program that doesn't have one +Author: Jay Berkenbilt <qjb(a)debian.org> +Bug:
http://bugs.icu-project.org/trac/ticket/7665
+erAck: adapted to ICU 56.1 icu/source/tools/icuinfo/Makefile.in + +diff -Nur orig.icu/source/tools/icuinfo/icuinfo.1.in icu/source/tools/icuinfo/icuinfo.1.in +--- orig.icu/source/tools/icuinfo/icuinfo.1.in 1970-01-01 01:00:00.000000000 +0100 ++++ icu/source/tools/icuinfo/icuinfo.1.in 2015-10-27 19:19:35.184056800 +0100 +@@ -0,0 +1,76 @@ ++.\" Hey, Emacs! This is -*-nroff-*- you know... ++.\" ++.\" icuinfo.1: manual page for the icuinfo utility ++.\" ++.\" Copyright (C) 2005-2006 International Business Machines Corporation and others ++.\" ++.TH ICUINFO 1 "1 May 2010" "ICU MANPAGE" "ICU @VERSION@ Manual" ++.SH NAME ++.B icuinfo ++\- Shows some basic info about the current ICU ++.SH SYNOPSIS ++.B icuinfo ++[ ++.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" ++] ++[ ++.BR "\-V\fP, \fB\-\-version" ++] ++[ ++.BR "\-c\fP, \fB\-\-copyright" ++] ++[ ++.BI "\-i\fP, \fB\-\-icudatadir" " directory" ++] ++[ ++.BR "\-v\fP, \fB\-\-verbose" ++] ++[ ++.BI "\-L\fP, \fB\-\-list-plugins" ++] ++[ ++.BI "\-m\fP, \fB\-\-milisecond-time" ++] ++[ ++.BI "\-K\fP, \fB\-\-cleanup" ++] ++.SH DESCRIPTION ++.B icuinfo ++prints basic information about the current version of ICU. ++.SH OPTIONS ++.TP ++.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" ++Print help about usage and exit. ++.TP ++.BR "\-V\fP, \fB\-\-version" ++Print the version of ++.B icuinfo ++and exit. ++.TP ++.BR "\-c\fP, \fB\-\-copyright" ++Embeds the standard ICU copyright into the ++.IR output-file . ++.TP ++.BR "\-v\fP, \fB\-\-verbose" ++Display extra informative messages during execution. ++.TP ++.BI "\-i\fP, \fB\-\-icudatadir" " directory" ++Look for any necessary ICU data files in ++.IR directory . ++For example, the file ++.B pnames.icu ++must be located when ICU's data is not built as a shared library. ++The default ICU data directory is specified by the environment variable ++.BR ICU_DATA . ++Most configurations of ICU do not require this argument. ++.TP ++.BI "\-L\fP, \fB\-\-list-plugins" ++If specified, list and diagnose issues with ICU plugins. ++.TP ++.BI "\-K\fP, \fB\-\-cleanup" ++Attempt to unload plugins before exiting. ++.TP ++.BI "\-m\fP, \fB\-\-milisecond-time" ++Print the current UTC time in milliseconds. ++.SH COPYRIGHT ++Copyright (C) 2010 International Business Machines Corporation and others +diff -Nur orig.icu/source/tools/icuinfo/Makefile.in icu/source/tools/icuinfo/Makefile.in +--- orig.icu/source/tools/icuinfo/Makefile.in 2015-10-08 05:53:56.000000000 +0200 ++++ icu/source/tools/icuinfo/Makefile.in 2015-10-27 19:23:19.115509906 +0100 +@@ -14,8 +14,15 @@ + ## Build directory information + subdir = tools/icuinfo + ++TARGET_STUB_NAME = icuinfo ++ ++SECTION = 1 ++ ++MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) ++ ++ + ## Extra files to remove for 'make clean' +-CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) ++CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) $(MAN_FILES) + + ## Target information + TARGET = icuinfo$(EXEEXT) +@@ -35,7 +42,8 @@ + + ## List of phony targets + .PHONY : all all-local install install-local clean clean-local \ +-distclean distclean-local dist dist-local check check-local plugin-check ++distclean distclean-local dist dist-local check check-local plugin-check \ ++install-man + + ## Clear suffix list + .SUFFIXES : +@@ -48,12 +56,16 @@ + dist: dist-local + check: all check-local + +-all-local: $(TARGET) ++all-local: $(TARGET) $(MAN_FILES) + +-install-local: all-local ++install-local: all-local install-man + $(MKINSTALLDIRS) $(DESTDIR)$(bindir) + $(INSTALL) $(TARGET) $(DESTDIR)$(bindir) + ++install-man: $(MAN_FILES) ++ $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION) ++ $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION) ++ + dist-local: + + clean-local: +@@ -103,6 +115,10 @@ + @echo "Plugins are disabled (use --enable-plugins to enable)" + endif + ++%.$(SECTION): $(srcdir)/%.$(SECTION).in ++ cd $(top_builddir) \ ++ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status ++ + ifeq (,$(MAKECMDGOALS)) + -include $(DEPS) + else diff --git a/sources b/sources new file mode 100644 index 0000000..e9681f4 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (icu4c-60_2-src.tgz) = 8e718e66c13e7f25714404c46b91ed6305efff1df70c328be2ec743023a7719016dae72a5fa0a05d6f5599983590a2044ff72d3453a048d987ab546d0416d694
1
0
0
0
Architecture specific change in rpms/zlib.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/zlib.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/zlib.git/commit/?id=25e980271348488…
. Change: +%ifarch aarch64 Thanks. Full change: ============ commit 247bbe44e3293834b65cb2981b2f9ad364e4d8ea Merge: e5ee550 3c07ec7 Author: Peter Robinson <pbrobinson(a)gmail.com> Date: Mon Apr 30 17:42:17 2018 +0100 Optimisations for aarch64, Minor spec cleanups commit 3c07ec781440addcf412da061e5a28c8ec1cf381 Author: Peter Robinson <pbrobinson(a)gmail.com> Date: Mon Apr 30 17:27:26 2018 +0100 Optimisations for aarch64, Minor spec cleanups diff --git a/zlib.spec b/zlib.spec index 9087e98..72deb74 100644 --- a/zlib.spec +++ b/zlib.spec @@ -1,13 +1,12 @@ -Summary: The compression and decompression library -Name: zlib +Name: zlib Version: 1.2.11 -Release: 7%{?dist} +Release: 8%{?dist} +Summary: The compression and decompression library # /contrib/dotzlib/ have Boost license License: zlib and Boost -Group: System Environment/Libraries URL:
http://www.zlib.net/
-Source:
http://www.zlib.net/zlib-%{version}.tar.xz
+Source:
http://www.zlib.net/zlib-%{version}.tar.xz
#
https://github.com/madler/zlib/pull/210
Patch0: zlib-1.2.5-minizip-fixuncrypt.patch # resolves: #805113 @@ -27,7 +26,6 @@ library which is used by many different programs. %package devel Summary: Header files and libraries for Zlib development -Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel @@ -37,7 +35,6 @@ library. %package static Summary: Static libraries for Zlib development -Group: Development/Libraries Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description static @@ -47,7 +44,6 @@ decompression library. %package -n minizip Summary: Library for manipulation with .zip archives -Group: System Environment/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description -n minizip @@ -55,10 +51,8 @@ Minizip is a library for manipulation with files from .zip archives. %package -n minizip-devel Summary: Development files for the minizip library -Group: Development/Libraries Requires: minizip%{?_isa} = %{version}-%{release} Requires: %{name}-devel%{?_isa} = %{version}-%{release} -Requires: pkgconfig %description -n minizip-devel This package contains the libraries and header files needed for @@ -117,14 +111,11 @@ rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %ldconfig_scriptlets -n minizip %files -%{!?_licensedir:%global license %%doc} %license README %doc ChangeLog FAQ %{_libdir}/libz.so.* %files devel -%{!?_licensedir:%global license %%doc} -%license README %doc doc/algorithm.txt test/example.c %{_libdir}/libz.so %{_libdir}/pkgconfig/zlib.pc @@ -133,7 +124,6 @@ rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %{_mandir}/man3/zlib.3* %files static -%{!?_licensedir:%global license %%doc} %license README %{_libdir}/libz.a @@ -148,6 +138,10 @@ rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %{_libdir}/pkgconfig/minizip.pc %changelog +* Mon Apr 30 2018 Peter Robinson <pbrobinson(a)fedoraproject.org> 1.2.11-8 +- Optimisations for aarch64 +- Minor spec cleanups + * Thu Mar 15 2018 Pavel Raiskup <praiskup(a)redhat.com> - 1.2.11-7 - don't install crypt.h (rhbz#1424609) commit 25e9802713484882c27c1f979a6610a42414ee13 Author: Jeremy Linton <jeremy.linton(a)arm.com> Date: Thu Apr 5 16:20:56 2018 -0500 aarch64 optimizations diff --git a/0001-Neon-Optimized-hash-chain-rebase.patch b/0001-Neon-Optimized-hash-chain-rebase.patch new file mode 100644 index 0000000..bebec86 --- /dev/null +++ b/0001-Neon-Optimized-hash-chain-rebase.patch @@ -0,0 +1,157 @@ +From f849a23e0afc8b8a670fda64eec8b573fe62daa7 Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Mon, 9 Apr 2018 13:52:17 -0700 +Subject: [PATCH 1/3] Neon-Optimized hash chain rebase + +This should help with compression of data, using NEON instructions +(therefore useful for ARMv7/ARMv8). + +Original patch by Jun He. +--- + CMakeLists.txt | 5 ++- + contrib/arm/neon_slide_hash.h | 84 +++++++++++++++++++++++++++++++++++++++++++ + deflate.c | 7 ++++ + 3 files changed, 95 insertions(+), 1 deletion(-) + create mode 100644 contrib/arm/neon_slide_hash.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 98ee4dd..230ca6d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -139,7 +139,10 @@ if(CMAKE_COMPILER_IS_GNUCC) + + if(ARM_NEON) + list(REMOVE_ITEM ZLIB_SRCS inflate.c) +- set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h contrib/arm/inffast_chunk.h) ++ set(ZLIB_ARM_NEON_HDRS ++ contrib/arm/chunkcopy.h ++ contrib/arm/inffast_chunk.h ++ contrib/arm/neon_slide_hash.h) + set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast_chunk.c) + add_definitions(-DARM_NEON) + set(COMPILER ${CMAKE_C_COMPILER}) +diff --git a/contrib/arm/neon_slide_hash.h b/contrib/arm/neon_slide_hash.h +new file mode 100644 +index 0000000..0daffa1 +--- /dev/null ++++ b/contrib/arm/neon_slide_hash.h +@@ -0,0 +1,84 @@ ++/* Copyright (C) 1995-2011, 2016 Mark Adler ++ * Copyright (C) 2017 ARM Holdings Inc. ++ * Authors: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> ++ * Jun He <jun.he(a)arm.com> ++ * This software is provided 'as-is', without any express or implied ++ * warranty. In no event will the authors be held liable for any damages ++ * arising from the use of this software. ++ * Permission is granted to anyone to use this software for any purpose, ++ * including commercial applications, and to alter it and redistribute it ++ * freely, subject to the following restrictions: ++ * 1. The origin of this software must not be misrepresented; you must not ++ * claim that you wrote the original software. If you use this software ++ * in a product, an acknowledgment in the product documentation would be ++ * appreciated but is not required. ++ * 2. Altered source versions must be plainly marked as such, and must not be ++ * misrepresented as being the original software. ++ * 3. This notice may not be removed or altered from any source distribution. ++ */ ++#ifndef __NEON_SLIDE_HASH__ ++#define __NEON_SLIDE_HASH__ ++ ++#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) ++#include "deflate.h" ++#include <arm_neon.h> ++ ++inline static void neon_slide_hash(deflate_state *s) ++{ ++ /* ++ * This is ASIMD implementation for hash table rebase ++ * it assumes: ++ * 1. hash chain offset (Pos) is 2 bytes ++ * 2. hash table size is multiple*128 bytes ++ * #1 should be true as Pos is defined as "ush" ++ * #2 should be true as hash_bits are greater that 7 ++ */ ++ unsigned n, m; ++ unsigned short wsize = s->w_size; ++ uint16x8_t v, *p; ++ size_t size; ++ ++ size = s->hash_size*sizeof(s->head[0]); ++ Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); ++ ++ Assert(sizeof(Pos) == 2, "Wrong Pos size"); ++ ++ /* slide s->head */ ++ v = vdupq_n_u16(wsize); ++ p = (uint16x8_t *)(s->head); ++ n = size / (sizeof(uint16x8_t) * 8); ++ do { ++ p[0] = vqsubq_u16(p[0], v); ++ p[1] = vqsubq_u16(p[1], v); ++ p[2] = vqsubq_u16(p[2], v); ++ p[3] = vqsubq_u16(p[3], v); ++ p[4] = vqsubq_u16(p[4], v); ++ p[5] = vqsubq_u16(p[5], v); ++ p[6] = vqsubq_u16(p[6], v); ++ p[7] = vqsubq_u16(p[7], v); ++ p += 8; ++ } while (--n); ++#ifndef FASTEST ++ /* slide s->prev */ ++ size = wsize*sizeof(s->prev[0]); ++ ++ Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); ++ ++ p = (uint16x8_t *)(s->prev); ++ n = size / (sizeof(uint16x8_t) * 8); ++ do { ++ p[0] = vqsubq_u16(p[0], v); ++ p[1] = vqsubq_u16(p[1], v); ++ p[2] = vqsubq_u16(p[2], v); ++ p[3] = vqsubq_u16(p[3], v); ++ p[4] = vqsubq_u16(p[4], v); ++ p[5] = vqsubq_u16(p[5], v); ++ p[6] = vqsubq_u16(p[6], v); ++ p[7] = vqsubq_u16(p[7], v); ++ p += 8; ++ } while (--n); ++#endif ++} ++ ++#endif ++#endif +diff --git a/deflate.c b/deflate.c +index 1ec7614..36f99ac 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -50,6 +50,9 @@ + /* @(#) $Id$ */ + + #include "deflate.h" ++#if __ARM_NEON ++#include "contrib/arm/neon_slide_hash.h" ++#endif + + const char deflate_copyright[] = + " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; +@@ -201,6 +204,9 @@ local const config configuration_table[10] = { + local void slide_hash(s) + deflate_state *s; + { ++#if ARM_NEON ++ return neon_slide_hash(s); ++#else + unsigned n, m; + Posf *p; + uInt wsize = s->w_size; +@@ -222,6 +228,7 @@ local void slide_hash(s) + */ + } while (--n); + #endif ++#endif + } + + /* ========================================================================= */ +-- +2.14.3 + diff --git a/0001-Porting-inflate-using-wider-loads-and-stores.patch b/0001-Porting-inflate-using-wider-loads-and-stores.patch new file mode 100644 index 0000000..17c3e7c --- /dev/null +++ b/0001-Porting-inflate-using-wider-loads-and-stores.patch @@ -0,0 +1,2268 @@ +From 390b2713be0c7f682861264a74b202439caf9460 Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Wed, 4 Apr 2018 12:10:35 -0700 +Subject: [PATCH 1/2] Porting inflate using wider loads and stores + +In inflate_fast() the output pointer always has plenty of room to write. This +means that so long as the target is capable, wide un-aligned loads and stores +can be used to transfer several bytes at once. When the reference distance is +too short simply unroll the data a little to increase the distance. + +For reference, please see: +https://chromium.googlesource.com/chromium/src/+/78104f4d73e3bbb4155fa804d00ed66682180556 +ps: this is still missing the fix for inflate_back corner case. + +Change-Id: I5216424ab584e069b77ddf04000a313d5ca99839 +--- + CMakeLists.txt | 21 +- + contrib/arm/chunkcopy.h | 297 +++++++++ + contrib/arm/inffast.c | 307 +++++++++ + contrib/arm/inflate.c | 1572 +++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 2195 insertions(+), 2 deletions(-) + create mode 100644 contrib/arm/chunkcopy.h + create mode 100644 contrib/arm/inffast.c + create mode 100644 contrib/arm/inflate.c + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0fe939d..09bb3db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,6 +7,7 @@ set(VERSION "1.2.11") + + option(ASM686 "Enable building i686 assembly implementation") + option(AMD64 "Enable building amd64 assembly implementation") ++option(ARM_NEON "Enable building ARM NEON intrinsics implementation") + + set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") + set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") +@@ -136,6 +137,22 @@ if(CMAKE_COMPILER_IS_GNUCC) + set(ZLIB_ASMS contrib/amd64/amd64-match.S) + endif () + ++ if(ARM_NEON) ++ list(REMOVE_ITEM ZLIB_SRCS inflate.c) ++ list(REMOVE_ITEM ZLIB_SRCS inffast.c) ++ set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h) ++ set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast.c) ++ add_definitions(-DARM_NEON) ++ set(COMPILER ${CMAKE_C_COMPILER}) ++ # NEON is mandatory in ARMv8. ++ if(${COMPILER} MATCHES "aarch64") ++ set_source_files_properties(${ZLIB_ARM_NEON} PROPERTIES LANGUAGE C COMPILE_FLAGS -march=armv8-a) ++ # But it was optional for ARMv7. ++ elseif(${COMPILER} MATCHES "arm") ++ set_source_files_properties(${ZLIB_ARM_NEON} PROPERTIES LANGUAGE C COMPILE_FLAGS -mfpu=neon) ++ endif() ++ endif() ++ + if(ZLIB_ASMS) + add_definitions(-DASMV) + set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) +@@ -183,8 +200,8 @@ if(MINGW) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) + endif(MINGW) + +-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_ARM_NEON} ${ZLIB_ARM_NEON_HDRS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_ARM_NEON} ${ZLIB_ARM_NEON_HDRS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + set_target_properties(zlib PROPERTIES SOVERSION 1) + +diff --git a/contrib/arm/chunkcopy.h b/contrib/arm/chunkcopy.h +new file mode 100644 +index 0000000..d42995c +--- /dev/null ++++ b/contrib/arm/chunkcopy.h +@@ -0,0 +1,297 @@ ++/* chunkcopy.h -- fast copies and sets ++ * Copyright (C) 2017 ARM, Inc. ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++#ifndef CHUNKCOPY_H ++#define CHUNKCOPY_H ++ ++#include <arm_neon.h> ++#include "zutil.h" ++ ++#if __STDC_VERSION__ >= 199901L ++#define Z_RESTRICT restrict ++#else ++#define Z_RESTRICT ++#endif ++ ++typedef uint8x16_t chunkcopy_chunk_t; ++#define CHUNKCOPY_CHUNK_SIZE sizeof(chunkcopy_chunk_t) ++ ++/* ++ Ask the compiler to perform a wide, unaligned load with an machine ++ instruction appropriate for the chunkcopy_chunk_t type. ++ */ ++static inline chunkcopy_chunk_t loadchunk(const unsigned char FAR* s) { ++ chunkcopy_chunk_t c; ++ __builtin_memcpy(&c, s, sizeof(c)); ++ return c; ++} ++ ++/* ++ Ask the compiler to perform a wide, unaligned store with an machine ++ instruction appropriate for the chunkcopy_chunk_t type. ++ */ ++static inline void storechunk(unsigned char FAR* d, chunkcopy_chunk_t c) { ++ __builtin_memcpy(d, &c, sizeof(c)); ++} ++ ++/* ++ Perform a memcpy-like operation, but assume that length is non-zero and that ++ it's OK to overwrite at least CHUNKCOPY_CHUNK_SIZE bytes of output even if ++ the length is shorter than this. ++ ++ It also guarantees that it will properly unroll the data if the distance ++ between `out` and `from` is at least CHUNKCOPY_CHUNK_SIZE, which we rely on ++ in chunkcopy_relaxed(). ++ ++ Aside from better memory bus utilisation, this means that short copies ++ (CHUNKCOPY_CHUNK_SIZE bytes or fewer) will fall straight through the loop ++ without iteration, which will hopefully make the branch prediction more ++ reliable. ++ */ ++static inline unsigned char FAR* chunkcopy_core(unsigned char FAR* out, ++ const unsigned char FAR* from, ++ unsigned len) { ++ int bump = (--len % CHUNKCOPY_CHUNK_SIZE) + 1; ++ storechunk(out, loadchunk(from)); ++ out += bump; ++ from += bump; ++ len /= CHUNKCOPY_CHUNK_SIZE; ++ while (len-- > 0) { ++ storechunk(out, loadchunk(from)); ++ out += CHUNKCOPY_CHUNK_SIZE; ++ from += CHUNKCOPY_CHUNK_SIZE; ++ } ++ return out; ++} ++ ++/* ++ Like chunkcopy_core, but avoid writing beyond of legal output. ++ ++ Accepts an additional pointer to the end of safe output. A generic safe ++ copy would use (out + len), but it's normally the case that the end of the ++ output buffer is beyond the end of the current copy, and this can still be ++ exploited. ++ */ ++static inline unsigned char FAR* chunkcopy_core_safe( ++ unsigned char FAR* out, ++ const unsigned char FAR* from, ++ unsigned len, ++ unsigned char FAR* limit) { ++ Assert(out + len <= limit, "chunk copy exceeds safety limit"); ++ if (limit - out < CHUNKCOPY_CHUNK_SIZE) { ++ const unsigned char FAR* Z_RESTRICT rfrom = from; ++ if (len & 8) { ++ __builtin_memcpy(out, rfrom, 8); ++ out += 8; ++ rfrom += 8; ++ } ++ if (len & 4) { ++ __builtin_memcpy(out, rfrom, 4); ++ out += 4; ++ rfrom += 4; ++ } ++ if (len & 2) { ++ __builtin_memcpy(out, rfrom, 2); ++ out += 2; ++ rfrom += 2; ++ } ++ if (len & 1) { ++ *out++ = *rfrom++; ++ } ++ return out; ++ } ++ return chunkcopy_core(out, from, len); ++} ++ ++/* ++ Perform short copies until distance can be rewritten as being at least ++ CHUNKCOPY_CHUNK_SIZE. ++ ++ This assumes that it's OK to overwrite at least the first ++ 2*CHUNKCOPY_CHUNK_SIZE bytes of output even if the copy is shorter than ++ this. This assumption holds within inflate_fast() which starts every ++ iteration with at least 258 bytes of output space available (258 being the ++ maximum length output from a single token; see inffast.c). ++ */ ++static inline unsigned char FAR* chunkunroll_relaxed(unsigned char FAR* out, ++ unsigned FAR* dist, ++ unsigned FAR* len) { ++ const unsigned char FAR* from = out - *dist; ++ while (*dist < *len && *dist < CHUNKCOPY_CHUNK_SIZE) { ++ storechunk(out, loadchunk(from)); ++ out += *dist; ++ *len -= *dist; ++ *dist += *dist; ++ } ++ return out; ++} ++ ++static inline uint8x16_t chunkset_vld1q_dup_u8x8( ++ const unsigned char FAR* Z_RESTRICT from) { ++#if defined(__clang__) || defined(__aarch64__) ++ return vreinterpretq_u8_u64(vld1q_dup_u64((void*)from)); ++#else ++ /* 32-bit GCC uses an alignment hint for vld1q_dup_u64, even when given a ++ * void pointer, so here's an alternate implementation. ++ */ ++ uint8x8_t h = vld1_u8(from); ++ return vcombine_u8(h, h); ++#endif ++} ++ ++/* ++ Perform an overlapping copy which behaves as a memset() operation, but ++ supporting periods other than one, and assume that length is non-zero and ++ that it's OK to overwrite at least CHUNKCOPY_CHUNK_SIZE*3 bytes of output ++ even if the length is shorter than this. ++ */ ++static inline unsigned char FAR* chunkset_core(unsigned char FAR* out, ++ unsigned period, ++ unsigned len) { ++ uint8x16_t f; ++ int bump = ((len - 1) % sizeof(f)) + 1; ++ ++ switch (period) { ++ case 1: ++ f = vld1q_dup_u8(out - 1); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ while (len > 0) { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } ++ return out; ++ case 2: ++ f = vreinterpretq_u8_u16(vld1q_dup_u16((void*)(out - 2))); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ if (len > 0) { ++ f = vreinterpretq_u8_u16(vld1q_dup_u16((void*)(out - 2))); ++ do { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } while (len > 0); ++ } ++ return out; ++ case 4: ++ f = vreinterpretq_u8_u32(vld1q_dup_u32((void*)(out - 4))); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ if (len > 0) { ++ f = vreinterpretq_u8_u32(vld1q_dup_u32((void*)(out - 4))); ++ do { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } while (len > 0); ++ } ++ return out; ++ case 8: ++ f = chunkset_vld1q_dup_u8x8(out - 8); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ if (len > 0) { ++ f = chunkset_vld1q_dup_u8x8(out - 8); ++ do { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } while (len > 0); ++ } ++ return out; ++ } ++ out = chunkunroll_relaxed(out, &period, &len); ++ return chunkcopy_core(out, out - period, len); ++} ++ ++/* ++ Perform a memcpy-like operation, but assume that length is non-zero and that ++ it's OK to overwrite at least CHUNKCOPY_CHUNK_SIZE bytes of output even if ++ the length is shorter than this. ++ ++ Unlike chunkcopy_core() above, no guarantee is made regarding the behaviour ++ of overlapping buffers, regardless of the distance between the pointers. ++ This is reflected in the `restrict`-qualified pointers, allowing the ++ compiler to reorder loads and stores. ++ */ ++static inline unsigned char FAR* chunkcopy_relaxed( ++ unsigned char FAR* Z_RESTRICT out, ++ const unsigned char FAR* Z_RESTRICT from, ++ unsigned len) { ++ return chunkcopy_core(out, from, len); ++} ++ ++/* ++ Like chunkcopy_relaxed, but avoid writing beyond of legal output. ++ ++ Unlike chunkcopy_core_safe() above, no guarantee is made regarding the ++ behaviour of overlapping buffers, regardless of the distance between the ++ pointers. This is reflected in the `restrict`-qualified pointers, allowing ++ the compiler to reorder loads and stores. ++ ++ Accepts an additional pointer to the end of safe output. A generic safe ++ copy would use (out + len), but it's normally the case that the end of the ++ output buffer is beyond the end of the current copy, and this can still be ++ exploited. ++ */ ++static inline unsigned char FAR* chunkcopy_safe( ++ unsigned char FAR* out, ++ const unsigned char FAR* Z_RESTRICT from, ++ unsigned len, ++ unsigned char FAR* limit) { ++ Assert(out + len <= limit, "chunk copy exceeds safety limit"); ++ return chunkcopy_core_safe(out, from, len, limit); ++} ++ ++/* ++ Perform chunky copy within the same buffer, where the source and destination ++ may potentially overlap. ++ ++ Assumes that len > 0 on entry, and that it's safe to write at least ++ CHUNKCOPY_CHUNK_SIZE*3 bytes to the output. ++ */ ++static inline unsigned char FAR* ++chunkcopy_lapped_relaxed(unsigned char FAR* out, unsigned dist, unsigned len) { ++ if (dist < len && dist < CHUNKCOPY_CHUNK_SIZE) { ++ return chunkset_core(out, dist, len); ++ } ++ return chunkcopy_core(out, out - dist, len); ++} ++ ++/* ++ Behave like chunkcopy_lapped_relaxed, but avoid writing beyond of legal ++ output. ++ ++ Accepts an additional pointer to the end of safe output. A generic safe ++ copy would use (out + len), but it's normally the case that the end of the ++ output buffer is beyond the end of the current copy, and this can still be ++ exploited. ++ */ ++static inline unsigned char FAR* chunkcopy_lapped_safe( ++ unsigned char FAR* out, ++ unsigned dist, ++ unsigned len, ++ unsigned char FAR* limit) { ++ Assert(out + len <= limit, "chunk copy exceeds safety limit"); ++ if (limit - out < CHUNKCOPY_CHUNK_SIZE * 3) { ++ /* TODO(cavalcantii): try harder to optimise this */ ++ while (len-- > 0) { ++ *out = *(out - dist); ++ out++; ++ } ++ return out; ++ } ++ return chunkcopy_lapped_relaxed(out, dist, len); ++} ++ ++#undef Z_RESTRICT ++ ++#endif /* CHUNKCOPY_H */ +diff --git a/contrib/arm/inffast.c b/contrib/arm/inffast.c +new file mode 100644 +index 0000000..f7f5007 +--- /dev/null ++++ b/contrib/arm/inffast.c +@@ -0,0 +1,307 @@ ++/* inffast.c -- fast decoding ++ * Copyright (C) 1995-2017 Mark Adler ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++#include "zutil.h" ++#include "inftrees.h" ++#include "inflate.h" ++#include "inffast.h" ++#include "chunkcopy.h" ++ ++#ifdef ASMINF ++# pragma message("Assembler code may have bugs -- use at your own risk") ++#else ++ ++/* ++ Decode literal, length, and distance codes and write out the resulting ++ literal and match bytes until either not enough input or output is ++ available, an end-of-block is encountered, or a data error is encountered. ++ When large enough input and output buffers are supplied to inflate(), for ++ example, a 16K input buffer and a 64K output buffer, more than 95% of the ++ inflate execution time is spent in this routine. ++ ++ Entry assumptions: ++ ++ state->mode == LEN ++ strm->avail_in >= 6 ++ strm->avail_out >= 258 ++ start >= strm->avail_out ++ state->bits < 8 ++ ++ On return, state->mode is one of: ++ ++ LEN -- ran out of enough output space or enough available input ++ TYPE -- reached end of block code, inflate() to interpret next block ++ BAD -- error in block data ++ ++ Notes: ++ ++ - The maximum input bits used by a length/distance pair is 15 bits for the ++ length code, 5 bits for the length extra, 15 bits for the distance code, ++ and 13 bits for the distance extra. This totals 48 bits, or six bytes. ++ Therefore if strm->avail_in >= 6, then there is enough input to avoid ++ checking for available input while decoding. ++ ++ - The maximum bytes that a single length/distance pair can output is 258 ++ bytes, which is the maximum length that can be coded. inflate_fast() ++ requires strm->avail_out >= 258 for each loop to avoid checking for ++ output space. ++ */ ++void ZLIB_INTERNAL inflate_fast(strm, start) ++z_streamp strm; ++unsigned start; /* inflate()'s starting value for strm->avail_out */ ++{ ++ struct inflate_state FAR *state; ++ z_const unsigned char FAR *in; /* local strm->next_in */ ++ z_const unsigned char FAR *last; /* have enough input while in < last */ ++ unsigned char FAR *out; /* local strm->next_out */ ++ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ ++ unsigned char FAR *end; /* while out < end, enough space available */ ++ unsigned char FAR *limit; /* safety limit for chunky copies */ ++#ifdef INFLATE_STRICT ++ unsigned dmax; /* maximum distance from zlib header */ ++#endif ++ unsigned wsize; /* window size or zero if not using window */ ++ unsigned whave; /* valid bytes in the window */ ++ unsigned wnext; /* window write index */ ++ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ ++ unsigned long hold; /* local strm->hold */ ++ unsigned bits; /* local strm->bits */ ++ code const FAR *lcode; /* local strm->lencode */ ++ code const FAR *dcode; /* local strm->distcode */ ++ unsigned lmask; /* mask for first level of length codes */ ++ unsigned dmask; /* mask for first level of distance codes */ ++ code here; /* retrieved table entry */ ++ unsigned op; /* code bits, operation, extra bits, or */ ++ /* window position, window bytes to copy */ ++ unsigned len; /* match length, unused bytes */ ++ unsigned dist; /* match distance */ ++ unsigned char FAR *from; /* where to copy match from */ ++ ++ /* copy state to local variables */ ++ state = (struct inflate_state FAR *)strm->state; ++ in = strm->next_in; ++ last = in + (strm->avail_in - 5); ++ out = strm->next_out; ++ beg = out - (start - strm->avail_out); ++ end = out + (strm->avail_out - 257); ++ limit = out + strm->avail_out; ++#ifdef INFLATE_STRICT ++ dmax = state->dmax; ++#endif ++ wsize = state->wsize; ++ whave = state->whave; ++ wnext = (state->wnext == 0 && whave >= wsize) ? wsize : state->wnext; ++ window = state->window; ++ hold = state->hold; ++ bits = state->bits; ++ lcode = state->lencode; ++ dcode = state->distcode; ++ lmask = (1U << state->lenbits) - 1; ++ dmask = (1U << state->distbits) - 1; ++ ++ /* decode literals and length/distances until end-of-block or not enough ++ input data or output space */ ++ do { ++ if (bits < 15) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ here = lcode[hold & lmask]; ++ dolen: ++ op = (unsigned)(here.bits); ++ hold >>= op; ++ bits -= op; ++ op = (unsigned)(here.op); ++ if (op == 0) { /* literal */ ++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? ++ "inflate: literal '%c'\n" : ++ "inflate: literal 0x%02x\n", here.val)); ++ *out++ = (unsigned char)(here.val); ++ } ++ else if (op & 16) { /* length base */ ++ len = (unsigned)(here.val); ++ op &= 15; /* number of extra bits */ ++ if (op) { ++ if (bits < op) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ len += (unsigned)hold & ((1U << op) - 1); ++ hold >>= op; ++ bits -= op; ++ } ++ Tracevv((stderr, "inflate: length %u\n", len)); ++ if (bits < 15) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ here = dcode[hold & dmask]; ++ dodist: ++ op = (unsigned)(here.bits); ++ hold >>= op; ++ bits -= op; ++ op = (unsigned)(here.op); ++ if (op & 16) { /* distance base */ ++ dist = (unsigned)(here.val); ++ op &= 15; /* number of extra bits */ ++ if (bits < op) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ if (bits < op) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ } ++ dist += (unsigned)hold & ((1U << op) - 1); ++#ifdef INFLATE_STRICT ++ if (dist > dmax) { ++ strm->msg = (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#endif ++ hold >>= op; ++ bits -= op; ++ Tracevv((stderr, "inflate: distance %u\n", dist)); ++ op = (unsigned)(out - beg); /* max distance in output */ ++ if (dist > op) { /* see if copy from window */ ++ op = dist - op; /* distance back in window */ ++ if (op > whave) { ++ if (state->sane) { ++ strm->msg = ++ (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR ++ if (len <= op - whave) { ++ do { ++ *out++ = 0; ++ } while (--len); ++ continue; ++ } ++ len -= op - whave; ++ do { ++ *out++ = 0; ++ } while (--op > whave); ++ if (op == 0) { ++ from = out - dist; ++ do { ++ *out++ = *from++; ++ } while (--len); ++ continue; ++ } ++#endif ++ } ++ from = window; ++ if (wnext >= op) { /* contiguous in window */ ++ from += wnext - op; ++ } ++ else { /* wrap around window */ ++ op -= wnext; ++ from += wsize - op; ++ if (op < len) { /* some from end of window */ ++ len -= op; ++ out = chunkcopy_safe(out, from, op, limit); ++ from = window; /* more from start of window */ ++ op = wnext; ++ /* This (rare) case can create a situation where ++ the first chunkcopy below must be checked. ++ */ ++ } ++ } ++ if (op < len) { /* still need some from output */ ++ out = chunkcopy_safe(out, from, op, limit); ++ len -= op; ++ /* When dist is small the amount of data that can be ++ copied from the window is also small, and progress ++ towards the dangerous end of the output buffer is ++ also small. This means that for trivial memsets and ++ for chunkunroll_relaxed() a safety check is ++ unnecessary. However, these conditions may not be ++ entered at all, and in that case it's possible that ++ the main copy is near the end. ++ */ ++ out = chunkunroll_relaxed(out, &dist, &len); ++ out = chunkcopy_safe(out, out - dist, len, limit); ++ } else { ++ /* from points to window, so there is no risk of ++ overlapping pointers requiring memset-like behaviour ++ */ ++ out = chunkcopy_safe(out, from, len, limit); ++ } ++ } ++ else { ++ /* Whole reference is in range of current output. No ++ range checks are necessary because we start with room ++ for at least 258 bytes of output, so unroll and roundoff ++ operations can write beyond `out+len` so long as they ++ stay within 258 bytes of `out`. ++ */ ++ out = chunkcopy_lapped_relaxed(out, dist, len); ++ } ++ } ++ else if ((op & 64) == 0) { /* 2nd level distance code */ ++ here = dcode[here.val + (hold & ((1U << op) - 1))]; ++ goto dodist; ++ } ++ else { ++ strm->msg = (char *)"invalid distance code"; ++ state->mode = BAD; ++ break; ++ } ++ } ++ else if ((op & 64) == 0) { /* 2nd level length code */ ++ here = lcode[here.val + (hold & ((1U << op) - 1))]; ++ goto dolen; ++ } ++ else if (op & 32) { /* end-of-block */ ++ Tracevv((stderr, "inflate: end of block\n")); ++ state->mode = TYPE; ++ break; ++ } ++ else { ++ strm->msg = (char *)"invalid literal/length code"; ++ state->mode = BAD; ++ break; ++ } ++ } while (in < last && out < end); ++ ++ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ ++ len = bits >> 3; ++ in -= len; ++ bits -= len << 3; ++ hold &= (1U << bits) - 1; ++ ++ /* update state and return */ ++ strm->next_in = in; ++ strm->next_out = out; ++ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); ++ strm->avail_out = (unsigned)(out < end ? ++ 257 + (end - out) : 257 - (out - end)); ++ state->hold = hold; ++ state->bits = bits; ++ return; ++} ++ ++/* ++ inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): ++ - Using bit fields for code structure ++ - Different op definition to avoid & for extra bits (do & for table bits) ++ - Three separate decoding do-loops for direct, window, and wnext == 0 ++ - Special case for distance > 1 copies to do overlapped load and store copy ++ - Explicit branch predictions (based on measured branch probabilities) ++ - Deferring match copy and interspersed it with decoding subsequent codes ++ - Swapping literal/length else ++ - Swapping window/direct else ++ - Larger unrolled copy loops (three is about right) ++ - Moving len -= 3 statement into middle of loop ++ */ ++ ++#endif /* !ASMINF */ +diff --git a/contrib/arm/inflate.c b/contrib/arm/inflate.c +new file mode 100644 +index 0000000..23e95f1 +--- /dev/null ++++ b/contrib/arm/inflate.c +@@ -0,0 +1,1572 @@ ++/* inflate.c -- zlib decompression ++ * Copyright (C) 1995-2016 Mark Adler ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++/* ++ * Change history: ++ * ++ * 1.2.beta0 24 Nov 2002 ++ * - First version -- complete rewrite of inflate to simplify code, avoid ++ * creation of window when not needed, minimize use of window when it is ++ * needed, make inffast.c even faster, implement gzip decoding, and to ++ * improve code readability and style over the previous zlib inflate code ++ * ++ * 1.2.beta1 25 Nov 2002 ++ * - Use pointers for available input and output checking in inffast.c ++ * - Remove input and output counters in inffast.c ++ * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 ++ * - Remove unnecessary second byte pull from length extra in inffast.c ++ * - Unroll direct copy to three copies per loop in inffast.c ++ * ++ * 1.2.beta2 4 Dec 2002 ++ * - Change external routine names to reduce potential conflicts ++ * - Correct filename to inffixed.h for fixed tables in inflate.c ++ * - Make hbuf[] unsigned char to match parameter type in inflate.c ++ * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) ++ * to avoid negation problem on Alphas (64 bit) in inflate.c ++ * ++ * 1.2.beta3 22 Dec 2002 ++ * - Add comments on state->bits assertion in inffast.c ++ * - Add comments on op field in inftrees.h ++ * - Fix bug in reuse of allocated window after inflateReset() ++ * - Remove bit fields--back to byte structure for speed ++ * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths ++ * - Change post-increments to pre-increments in inflate_fast(), PPC biased? ++ * - Add compile time option, POSTINC, to use post-increments instead (Intel?) ++ * - Make MATCH copy in inflate() much faster for when inflate_fast() not used ++ * - Use local copies of stream next and avail values, as well as local bit ++ * buffer and bit count in inflate()--for speed when inflate_fast() not used ++ * ++ * 1.2.beta4 1 Jan 2003 ++ * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings ++ * - Move a comment on output buffer sizes from inffast.c to inflate.c ++ * - Add comments in inffast.c to introduce the inflate_fast() routine ++ * - Rearrange window copies in inflate_fast() for speed and simplification ++ * - Unroll last copy for window match in inflate_fast() ++ * - Use local copies of window variables in inflate_fast() for speed ++ * - Pull out common wnext == 0 case for speed in inflate_fast() ++ * - Make op and len in inflate_fast() unsigned for consistency ++ * - Add FAR to lcode and dcode declarations in inflate_fast() ++ * - Simplified bad distance check in inflate_fast() ++ * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new ++ * source file infback.c to provide a call-back interface to inflate for ++ * programs like gzip and unzip -- uses window as output buffer to avoid ++ * window copying ++ * ++ * 1.2.beta5 1 Jan 2003 ++ * - Improved inflateBack() interface to allow the caller to provide initial ++ * input in strm. ++ * - Fixed stored blocks bug in inflateBack() ++ * ++ * 1.2.beta6 4 Jan 2003 ++ * - Added comments in inffast.c on effectiveness of POSTINC ++ * - Typecasting all around to reduce compiler warnings ++ * - Changed loops from while (1) or do {} while (1) to for (;;), again to ++ * make compilers happy ++ * - Changed type of window in inflateBackInit() to unsigned char * ++ * ++ * 1.2.beta7 27 Jan 2003 ++ * - Changed many types to unsigned or unsigned short to avoid warnings ++ * - Added inflateCopy() function ++ * ++ * 1.2.0 9 Mar 2003 ++ * - Changed inflateBack() interface to provide separate opaque descriptors ++ * for the in() and out() functions ++ * - Changed inflateBack() argument and in_func typedef to swap the length ++ * and buffer address return values for the input function ++ * - Check next_in and next_out for Z_NULL on entry to inflate() ++ * ++ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. ++ */ ++ ++#include "zutil.h" ++#include "inftrees.h" ++#include "inflate.h" ++#include "inffast.h" ++#include "contrib/arm/chunkcopy.h" ++ ++#ifdef MAKEFIXED ++# ifndef BUILDFIXED ++# define BUILDFIXED ++# endif ++#endif ++ ++/* function prototypes */ ++local int inflateStateCheck OF((z_streamp strm)); ++local void fixedtables OF((struct inflate_state FAR *state)); ++local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, ++ unsigned copy)); ++#ifdef BUILDFIXED ++ void makefixed OF((void)); ++#endif ++local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, ++ unsigned len)); ++ ++local int inflateStateCheck(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ if (strm == Z_NULL || ++ strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) ++ return 1; ++ state = (struct inflate_state FAR *)strm->state; ++ if (state == Z_NULL || state->strm != strm || ++ state->mode < HEAD || state->mode > SYNC) ++ return 1; ++ return 0; ++} ++ ++int ZEXPORT inflateResetKeep(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ strm->total_in = strm->total_out = state->total = 0; ++ strm->msg = Z_NULL; ++ if (state->wrap) /* to support ill-conceived Java test suite */ ++ strm->adler = state->wrap & 1; ++ state->mode = HEAD; ++ state->last = 0; ++ state->havedict = 0; ++ state->dmax = 32768U; ++ state->head = Z_NULL; ++ state->hold = 0; ++ state->bits = 0; ++ state->lencode = state->distcode = state->next = state->codes; ++ state->sane = 1; ++ state->back = -1; ++ Tracev((stderr, "inflate: reset\n")); ++ return Z_OK; ++} ++ ++int ZEXPORT inflateReset(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ state->wsize = 0; ++ state->whave = 0; ++ state->wnext = 0; ++ return inflateResetKeep(strm); ++} ++ ++int ZEXPORT inflateReset2(strm, windowBits) ++z_streamp strm; ++int windowBits; ++{ ++ int wrap; ++ struct inflate_state FAR *state; ++ ++ /* get the state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ ++ /* extract wrap request from windowBits parameter */ ++ if (windowBits < 0) { ++ wrap = 0; ++ windowBits = -windowBits; ++ } ++ else { ++ wrap = (windowBits >> 4) + 5; ++#ifdef GUNZIP ++ if (windowBits < 48) ++ windowBits &= 15; ++#endif ++ } ++ ++ /* set number of window bits, free window if different */ ++ if (windowBits && (windowBits < 8 || windowBits > 15)) ++ return Z_STREAM_ERROR; ++ if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { ++ ZFREE(strm, state->window); ++ state->window = Z_NULL; ++ } ++ ++ /* update state and reset the rest of it */ ++ state->wrap = wrap; ++ state->wbits = (unsigned)windowBits; ++ return inflateReset(strm); ++} ++ ++int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) ++z_streamp strm; ++int windowBits; ++const char *version; ++int stream_size; ++{ ++ int ret; ++ struct inflate_state FAR *state; ++ ++ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || ++ stream_size != (int)(sizeof(z_stream))) ++ return Z_VERSION_ERROR; ++ if (strm == Z_NULL) return Z_STREAM_ERROR; ++ strm->msg = Z_NULL; /* in case we return an error */ ++ if (strm->zalloc == (alloc_func)0) { ++#ifdef Z_SOLO ++ return Z_STREAM_ERROR; ++#else ++ strm->zalloc = zcalloc; ++ strm->opaque = (voidpf)0; ++#endif ++ } ++ if (strm->zfree == (free_func)0) ++#ifdef Z_SOLO ++ return Z_STREAM_ERROR; ++#else ++ strm->zfree = zcfree; ++#endif ++ state = (struct inflate_state FAR *) ++ ZALLOC(strm, 1, sizeof(struct inflate_state)); ++ if (state == Z_NULL) return Z_MEM_ERROR; ++ Tracev((stderr, "inflate: allocated\n")); ++ strm->state = (struct internal_state FAR *)state; ++ state->strm = strm; ++ state->window = Z_NULL; ++ state->mode = HEAD; /* to pass state test in inflateReset2() */ ++ state->check = 1L; /* 1L is the result of adler32() zero length data */ ++ ret = inflateReset2(strm, windowBits); ++ if (ret != Z_OK) { ++ ZFREE(strm, state); ++ strm->state = Z_NULL; ++ } ++ return ret; ++} ++ ++int ZEXPORT inflateInit_(strm, version, stream_size) ++z_streamp strm; ++const char *version; ++int stream_size; ++{ ++ return inflateInit2_(strm, DEF_WBITS, version, stream_size); ++} ++ ++int ZEXPORT inflatePrime(strm, bits, value) ++z_streamp strm; ++int bits; ++int value; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (bits < 0) { ++ state->hold = 0; ++ state->bits = 0; ++ return Z_OK; ++ } ++ if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR; ++ value &= (1L << bits) - 1; ++ state->hold += (unsigned)value << state->bits; ++ state->bits += (uInt)bits; ++ return Z_OK; ++} ++ ++/* ++ Return state with length and distance decoding tables and index sizes set to ++ fixed code decoding. Normally this returns fixed tables from inffixed.h. ++ If BUILDFIXED is defined, then instead this routine builds the tables the ++ first time it's called, and returns those tables the first time and ++ thereafter. This reduces the size of the code by about 2K bytes, in ++ exchange for a little execution time. However, BUILDFIXED should not be ++ used for threaded applications, since the rewriting of the tables and virgin ++ may not be thread-safe. ++ */ ++local void fixedtables(state) ++struct inflate_state FAR *state; ++{ ++#ifdef BUILDFIXED ++ static int virgin = 1; ++ static code *lenfix, *distfix; ++ static code fixed[544]; ++ ++ /* build fixed huffman tables if first call (may not be thread safe) */ ++ if (virgin) { ++ unsigned sym, bits; ++ static code *next; ++ ++ /* literal/length table */ ++ sym = 0; ++ while (sym < 144) state->lens[sym++] = 8; ++ while (sym < 256) state->lens[sym++] = 9; ++ while (sym < 280) state->lens[sym++] = 7; ++ while (sym < 288) state->lens[sym++] = 8; ++ next = fixed; ++ lenfix = next; ++ bits = 9; ++ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); ++ ++ /* distance table */ ++ sym = 0; ++ while (sym < 32) state->lens[sym++] = 5; ++ distfix = next; ++ bits = 5; ++ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); ++ ++ /* do this just once */ ++ virgin = 0; ++ } ++#else /* !BUILDFIXED */ ++# include "inffixed.h" ++#endif /* BUILDFIXED */ ++ state->lencode = lenfix; ++ state->lenbits = 9; ++ state->distcode = distfix; ++ state->distbits = 5; ++} ++ ++#ifdef MAKEFIXED ++#include <stdio.h> ++ ++/* ++ Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also ++ defines BUILDFIXED, so the tables are built on the fly. makefixed() writes ++ those tables to stdout, which would be piped to inffixed.h. A small program ++ can simply call makefixed to do this: ++ ++ void makefixed(void); ++ ++ int main(void) ++ { ++ makefixed(); ++ return 0; ++ } ++ ++ Then that can be linked with zlib built with MAKEFIXED defined and run: ++ ++ a.out > inffixed.h ++ */ ++void makefixed() ++{ ++ unsigned low, size; ++ struct inflate_state state; ++ ++ fixedtables(&state); ++ puts(" /* inffixed.h -- table for decoding fixed codes"); ++ puts(" * Generated automatically by makefixed()."); ++ puts(" */"); ++ puts(""); ++ puts(" /* WARNING: this file should *not* be used by applications."); ++ puts(" It is part of the implementation of this library and is"); ++ puts(" subject to change. Applications should only use zlib.h."); ++ puts(" */"); ++ puts(""); ++ size = 1U << 9; ++ printf(" static const code lenfix[%u] = {", size); ++ low = 0; ++ for (;;) { ++ if ((low % 7) == 0) printf("\n "); ++ printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, ++ state.lencode[low].bits, state.lencode[low].val); ++ if (++low == size) break; ++ putchar(','); ++ } ++ puts("\n };"); ++ size = 1U << 5; ++ printf("\n static const code distfix[%u] = {", size); ++ low = 0; ++ for (;;) { ++ if ((low % 6) == 0) printf("\n "); ++ printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, ++ state.distcode[low].val); ++ if (++low == size) break; ++ putchar(','); ++ } ++ puts("\n };"); ++} ++#endif /* MAKEFIXED */ ++ ++/* ++ Update the window with the last wsize (normally 32K) bytes written before ++ returning. If window does not exist yet, create it. This is only called ++ when a window is already in use, or when output has been written during this ++ inflate call, but the end of the deflate stream has not been reached yet. ++ It is also called to create a window for dictionary data when a dictionary ++ is loaded. ++ ++ Providing output buffers larger than 32K to inflate() should provide a speed ++ advantage, since only the last 32K of output is copied to the sliding window ++ upon return from inflate(), and since all distances after the first 32K of ++ output will fall in the output data, making match copies simpler and faster. ++ The advantage may be dependent on the size of the processor's data caches. ++ */ ++local int updatewindow(strm, end, copy) ++z_streamp strm; ++const Bytef *end; ++unsigned copy; ++{ ++ struct inflate_state FAR *state; ++ unsigned dist; ++ ++ state = (struct inflate_state FAR *)strm->state; ++ ++ /* if it hasn't been done already, allocate space for the window */ ++ if (state->window == Z_NULL) { ++ unsigned wsize = 1U << state->wbits; ++ state->window = (unsigned char FAR *) ++ ZALLOC(strm, wsize + CHUNKCOPY_CHUNK_SIZE, ++ sizeof(unsigned char)); ++ if (state->window == Z_NULL) return 1; ++#ifdef INFLATE_CLEAR_UNUSED_UNDEFINED ++ /* Copies from the overflow portion of this buffer are undefined and ++ may cause analysis tools to raise a warning if we don't initialize ++ it. However, this undefined data overwrites other undefined data ++ and is subsequently either overwritten or left deliberately ++ undefined at the end of decode; so there's really no point. ++ */ ++ memset(state->window + wsize, 0, CHUNKCOPY_CHUNK_SIZE); ++#endif ++ } ++ ++ /* if window not in use yet, initialize */ ++ if (state->wsize == 0) { ++ state->wsize = 1U << state->wbits; ++ state->wnext = 0; ++ state->whave = 0; ++ } ++ ++ /* copy state->wsize or less output bytes into the circular window */ ++ if (copy >= state->wsize) { ++ zmemcpy(state->window, end - state->wsize, state->wsize); ++ state->wnext = 0; ++ state->whave = state->wsize; ++ } ++ else { ++ dist = state->wsize - state->wnext; ++ if (dist > copy) dist = copy; ++ zmemcpy(state->window + state->wnext, end - copy, dist); ++ copy -= dist; ++ if (copy) { ++ zmemcpy(state->window, end - copy, copy); ++ state->wnext = copy; ++ state->whave = state->wsize; ++ } ++ else { ++ state->wnext += dist; ++ if (state->wnext == state->wsize) state->wnext = 0; ++ if (state->whave < state->wsize) state->whave += dist; ++ } ++ } ++ return 0; ++} ++ ++/* Macros for inflate(): */ ++ ++/* check function to use adler32() for zlib or crc32() for gzip */ ++#ifdef GUNZIP ++# define UPDATE(check, buf, len) \ ++ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) ++#else ++# define UPDATE(check, buf, len) adler32(check, buf, len) ++#endif ++ ++/* check macros for header crc */ ++#ifdef GUNZIP ++# define CRC2(check, word) \ ++ do { \ ++ hbuf[0] = (unsigned char)(word); \ ++ hbuf[1] = (unsigned char)((word) >> 8); \ ++ check = crc32(check, hbuf, 2); \ ++ } while (0) ++ ++# define CRC4(check, word) \ ++ do { \ ++ hbuf[0] = (unsigned char)(word); \ ++ hbuf[1] = (unsigned char)((word) >> 8); \ ++ hbuf[2] = (unsigned char)((word) >> 16); \ ++ hbuf[3] = (unsigned char)((word) >> 24); \ ++ check = crc32(check, hbuf, 4); \ ++ } while (0) ++#endif ++ ++/* Load registers with state in inflate() for speed */ ++#define LOAD() \ ++ do { \ ++ put = strm->next_out; \ ++ left = strm->avail_out; \ ++ next = strm->next_in; \ ++ have = strm->avail_in; \ ++ hold = state->hold; \ ++ bits = state->bits; \ ++ } while (0) ++ ++/* Restore state from registers in inflate() */ ++#define RESTORE() \ ++ do { \ ++ strm->next_out = put; \ ++ strm->avail_out = left; \ ++ strm->next_in = next; \ ++ strm->avail_in = have; \ ++ state->hold = hold; \ ++ state->bits = bits; \ ++ } while (0) ++ ++/* Clear the input bit accumulator */ ++#define INITBITS() \ ++ do { \ ++ hold = 0; \ ++ bits = 0; \ ++ } while (0) ++ ++/* Get a byte of input into the bit accumulator, or return from inflate() ++ if there is no input available. */ ++#define PULLBYTE() \ ++ do { \ ++ if (have == 0) goto inf_leave; \ ++ have--; \ ++ hold += (unsigned long)(*next++) << bits; \ ++ bits += 8; \ ++ } while (0) ++ ++/* Assure that there are at least n bits in the bit accumulator. If there is ++ not enough available input to do that, then return from inflate(). */ ++#define NEEDBITS(n) \ ++ do { \ ++ while (bits < (unsigned)(n)) \ ++ PULLBYTE(); \ ++ } while (0) ++ ++/* Return the low n bits of the bit accumulator (n < 16) */ ++#define BITS(n) \ ++ ((unsigned)hold & ((1U << (n)) - 1)) ++ ++/* Remove n bits from the bit accumulator */ ++#define DROPBITS(n) \ ++ do { \ ++ hold >>= (n); \ ++ bits -= (unsigned)(n); \ ++ } while (0) ++ ++/* Remove zero to seven bits as needed to go to a byte boundary */ ++#define BYTEBITS() \ ++ do { \ ++ hold >>= bits & 7; \ ++ bits -= bits & 7; \ ++ } while (0) ++ ++/* ++ inflate() uses a state machine to process as much input data and generate as ++ much output data as possible before returning. The state machine is ++ structured roughly as follows: ++ ++ for (;;) switch (state) { ++ ... ++ case STATEn: ++ if (not enough input data or output space to make progress) ++ return; ++ ... make progress ... ++ state = STATEm; ++ break; ++ ... ++ } ++ ++ so when inflate() is called again, the same case is attempted again, and ++ if the appropriate resources are provided, the machine proceeds to the ++ next state. The NEEDBITS() macro is usually the way the state evaluates ++ whether it can proceed or should return. NEEDBITS() does the return if ++ the requested bits are not available. The typical use of the BITS macros ++ is: ++ ++ NEEDBITS(n); ++ ... do something with BITS(n) ... ++ DROPBITS(n); ++ ++ where NEEDBITS(n) either returns from inflate() if there isn't enough ++ input left to load n bits into the accumulator, or it continues. BITS(n) ++ gives the low n bits in the accumulator. When done, DROPBITS(n) drops ++ the low n bits off the accumulator. INITBITS() clears the accumulator ++ and sets the number of available bits to zero. BYTEBITS() discards just ++ enough bits to put the accumulator on a byte boundary. After BYTEBITS() ++ and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. ++ ++ NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return ++ if there is no input available. The decoding of variable length codes uses ++ PULLBYTE() directly in order to pull just enough bytes to decode the next ++ code, and no more. ++ ++ Some states loop until they get enough input, making sure that enough ++ state information is maintained to continue the loop where it left off ++ if NEEDBITS() returns in the loop. For example, want, need, and keep ++ would all have to actually be part of the saved state in case NEEDBITS() ++ returns: ++ ++ case STATEw: ++ while (want < need) { ++ NEEDBITS(n); ++ keep[want++] = BITS(n); ++ DROPBITS(n); ++ } ++ state = STATEx; ++ case STATEx: ++ ++ As shown above, if the next state is also the next case, then the break ++ is omitted. ++ ++ A state may also return if there is not enough output space available to ++ complete that state. Those states are copying stored data, writing a ++ literal byte, and copying a matching string. ++ ++ When returning, a "goto inf_leave" is used to update the total counters, ++ update the check value, and determine whether any progress has been made ++ during that inflate() call in order to return the proper return code. ++ Progress is defined as a change in either strm->avail_in or strm->avail_out. ++ When there is a window, goto inf_leave will update the window with the last ++ output written. If a goto inf_leave occurs in the middle of decompression ++ and there is no window currently, goto inf_leave will create one and copy ++ output to the window for the next call of inflate(). ++ ++ In this implementation, the flush parameter of inflate() only affects the ++ return code (per zlib.h). inflate() always writes as much as possible to ++ strm->next_out, given the space available and the provided input--the effect ++ documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers ++ the allocation of and copying into a sliding window until necessary, which ++ provides the effect documented in zlib.h for Z_FINISH when the entire input ++ stream available. So the only thing the flush parameter actually does is: ++ when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it ++ will return Z_BUF_ERROR if it has not reached the end of the stream. ++ */ ++ ++int ZEXPORT inflate(strm, flush) ++z_streamp strm; ++int flush; ++{ ++ struct inflate_state FAR *state; ++ z_const unsigned char FAR *next; /* next input */ ++ unsigned char FAR *put; /* next output */ ++ unsigned have, left; /* available input and output */ ++ unsigned long hold; /* bit buffer */ ++ unsigned bits; /* bits in bit buffer */ ++ unsigned in, out; /* save starting available input and output */ ++ unsigned copy; /* number of stored or match bytes to copy */ ++ unsigned char FAR *from; /* where to copy match bytes from */ ++ code here; /* current decoding table entry */ ++ code last; /* parent table entry */ ++ unsigned len; /* length to copy for repeats, bits to drop */ ++ int ret; /* return code */ ++#ifdef GUNZIP ++ unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ ++#endif ++ static const unsigned short order[19] = /* permutation of code lengths */ ++ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; ++ ++ if (inflateStateCheck(strm) || strm->next_out == Z_NULL || ++ (strm->next_in == Z_NULL && strm->avail_in != 0)) ++ return Z_STREAM_ERROR; ++ ++ state = (struct inflate_state FAR *)strm->state; ++ if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ ++ LOAD(); ++ in = have; ++ out = left; ++ ret = Z_OK; ++ for (;;) ++ switch (state->mode) { ++ case HEAD: ++ if (state->wrap == 0) { ++ state->mode = TYPEDO; ++ break; ++ } ++ NEEDBITS(16); ++#ifdef GUNZIP ++ if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ ++ if (state->wbits == 0) ++ state->wbits = 15; ++ state->check = crc32(0L, Z_NULL, 0); ++ CRC2(state->check, hold); ++ INITBITS(); ++ state->mode = FLAGS; ++ break; ++ } ++ state->flags = 0; /* expect zlib header */ ++ if (state->head != Z_NULL) ++ state->head->done = -1; ++ if (!(state->wrap & 1) || /* check if zlib header allowed */ ++#else ++ if ( ++#endif ++ ((BITS(8) << 8) + (hold >> 8)) % 31) { ++ strm->msg = (char *)"incorrect header check"; ++ state->mode = BAD; ++ break; ++ } ++ if (BITS(4) != Z_DEFLATED) { ++ strm->msg = (char *)"unknown compression method"; ++ state->mode = BAD; ++ break; ++ } ++ DROPBITS(4); ++ len = BITS(4) + 8; ++ if (state->wbits == 0) ++ state->wbits = len; ++ if (len > 15 || len > state->wbits) { ++ strm->msg = (char *)"invalid window size"; ++ state->mode = BAD; ++ break; ++ } ++ state->dmax = 1U << len; ++ Tracev((stderr, "inflate: zlib header ok\n")); ++ strm->adler = state->check = adler32(0L, Z_NULL, 0); ++ state->mode = hold & 0x200 ? DICTID : TYPE; ++ INITBITS(); ++ break; ++#ifdef GUNZIP ++ case FLAGS: ++ NEEDBITS(16); ++ state->flags = (int)(hold); ++ if ((state->flags & 0xff) != Z_DEFLATED) { ++ strm->msg = (char *)"unknown compression method"; ++ state->mode = BAD; ++ break; ++ } ++ if (state->flags & 0xe000) { ++ strm->msg = (char *)"unknown header flags set"; ++ state->mode = BAD; ++ break; ++ } ++ if (state->head != Z_NULL) ++ state->head->text = (int)((hold >> 8) & 1); ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC2(state->check, hold); ++ INITBITS(); ++ state->mode = TIME; ++ case TIME: ++ NEEDBITS(32); ++ if (state->head != Z_NULL) ++ state->head->time = hold; ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC4(state->check, hold); ++ INITBITS(); ++ state->mode = OS; ++ case OS: ++ NEEDBITS(16); ++ if (state->head != Z_NULL) { ++ state->head->xflags = (int)(hold & 0xff); ++ state->head->os = (int)(hold >> 8); ++ } ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC2(state->check, hold); ++ INITBITS(); ++ state->mode = EXLEN; ++ case EXLEN: ++ if (state->flags & 0x0400) { ++ NEEDBITS(16); ++ state->length = (unsigned)(hold); ++ if (state->head != Z_NULL) ++ state->head->extra_len = (unsigned)hold; ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC2(state->check, hold); ++ INITBITS(); ++ } ++ else if (state->head != Z_NULL) ++ state->head->extra = Z_NULL; ++ state->mode = EXTRA; ++ case EXTRA: ++ if (state->flags & 0x0400) { ++ copy = state->length; ++ if (copy > have) copy = have; ++ if (copy) { ++ if (state->head != Z_NULL && ++ state->head->extra != Z_NULL) { ++ len = state->head->extra_len - state->length; ++ zmemcpy(state->head->extra + len, next, ++ len + copy > state->head->extra_max ? ++ state->head->extra_max - len : copy); ++ } ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ state->check = crc32(state->check, next, copy); ++ have -= copy; ++ next += copy; ++ state->length -= copy; ++ } ++ if (state->length) goto inf_leave; ++ } ++ state->length = 0; ++ state->mode = NAME; ++ case NAME: ++ if (state->flags & 0x0800) { ++ if (have == 0) goto inf_leave; ++ copy = 0; ++ do { ++ len = (unsigned)(next[copy++]); ++ if (state->head != Z_NULL && ++ state->head->name != Z_NULL && ++ state->length < state->head->name_max) ++ state->head->name[state->length++] = (Bytef)len; ++ } while (len && copy < have); ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ state->check = crc32(state->check, next, copy); ++ have -= copy; ++ next += copy; ++ if (len) goto inf_leave; ++ } ++ else if (state->head != Z_NULL) ++ state->head->name = Z_NULL; ++ state->length = 0; ++ state->mode = COMMENT; ++ case COMMENT: ++ if (state->flags & 0x1000) { ++ if (have == 0) goto inf_leave; ++ copy = 0; ++ do { ++ len = (unsigned)(next[copy++]); ++ if (state->head != Z_NULL && ++ state->head->comment != Z_NULL && ++ state->length < state->head->comm_max) ++ state->head->comment[state->length++] = (Bytef)len; ++ } while (len && copy < have); ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ state->check = crc32(state->check, next, copy); ++ have -= copy; ++ next += copy; ++ if (len) goto inf_leave; ++ } ++ else if (state->head != Z_NULL) ++ state->head->comment = Z_NULL; ++ state->mode = HCRC; ++ case HCRC: ++ if (state->flags & 0x0200) { ++ NEEDBITS(16); ++ if ((state->wrap & 4) && hold != (state->check & 0xffff)) { ++ strm->msg = (char *)"header crc mismatch"; ++ state->mode = BAD; ++ break; ++ } ++ INITBITS(); ++ } ++ if (state->head != Z_NULL) { ++ state->head->hcrc = (int)((state->flags >> 9) & 1); ++ state->head->done = 1; ++ } ++ strm->adler = state->check = crc32(0L, Z_NULL, 0); ++ state->mode = TYPE; ++ break; ++#endif ++ case DICTID: ++ NEEDBITS(32); ++ strm->adler = state->check = ZSWAP32(hold); ++ INITBITS(); ++ state->mode = DICT; ++ case DICT: ++ if (state->havedict == 0) { ++ RESTORE(); ++ return Z_NEED_DICT; ++ } ++ strm->adler = state->check = adler32(0L, Z_NULL, 0); ++ state->mode = TYPE; ++ case TYPE: ++ if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; ++ case TYPEDO: ++ if (state->last) { ++ BYTEBITS(); ++ state->mode = CHECK; ++ break; ++ } ++ NEEDBITS(3); ++ state->last = BITS(1); ++ DROPBITS(1); ++ switch (BITS(2)) { ++ case 0: /* stored block */ ++ Tracev((stderr, "inflate: stored block%s\n", ++ state->last ? " (last)" : "")); ++ state->mode = STORED; ++ break; ++ case 1: /* fixed block */ ++ fixedtables(state); ++ Tracev((stderr, "inflate: fixed codes block%s\n", ++ state->last ? " (last)" : "")); ++ state->mode = LEN_; /* decode codes */ ++ if (flush == Z_TREES) { ++ DROPBITS(2); ++ goto inf_leave; ++ } ++ break; ++ case 2: /* dynamic block */ ++ Tracev((stderr, "inflate: dynamic codes block%s\n", ++ state->last ? " (last)" : "")); ++ state->mode = TABLE; ++ break; ++ case 3: ++ strm->msg = (char *)"invalid block type"; ++ state->mode = BAD; ++ } ++ DROPBITS(2); ++ break; ++ case STORED: ++ BYTEBITS(); /* go to byte boundary */ ++ NEEDBITS(32); ++ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { ++ strm->msg = (char *)"invalid stored block lengths"; ++ state->mode = BAD; ++ break; ++ } ++ state->length = (unsigned)hold & 0xffff; ++ Tracev((stderr, "inflate: stored length %u\n", ++ state->length)); ++ INITBITS(); ++ state->mode = COPY_; ++ if (flush == Z_TREES) goto inf_leave; ++ case COPY_: ++ state->mode = COPY; ++ case COPY: ++ copy = state->length; ++ if (copy) { ++ if (copy > have) copy = have; ++ if (copy > left) copy = left; ++ if (copy == 0) goto inf_leave; ++ zmemcpy(put, next, copy); ++ have -= copy; ++ next += copy; ++ left -= copy; ++ put += copy; ++ state->length -= copy; ++ break; ++ } ++ Tracev((stderr, "inflate: stored end\n")); ++ state->mode = TYPE; ++ break; ++ case TABLE: ++ NEEDBITS(14); ++ state->nlen = BITS(5) + 257; ++ DROPBITS(5); ++ state->ndist = BITS(5) + 1; ++ DROPBITS(5); ++ state->ncode = BITS(4) + 4; ++ DROPBITS(4); ++#ifndef PKZIP_BUG_WORKAROUND ++ if (state->nlen > 286 || state->ndist > 30) { ++ strm->msg = (char *)"too many length or distance symbols"; ++ state->mode = BAD; ++ break; ++ } ++#endif ++ Tracev((stderr, "inflate: table sizes ok\n")); ++ state->have = 0; ++ state->mode = LENLENS; ++ case LENLENS: ++ while (state->have < state->ncode) { ++ NEEDBITS(3); ++ state->lens[order[state->have++]] = (unsigned short)BITS(3); ++ DROPBITS(3); ++ } ++ while (state->have < 19) ++ state->lens[order[state->have++]] = 0; ++ state->next = state->codes; ++ state->lencode = (const code FAR *)(state->next); ++ state->lenbits = 7; ++ ret = inflate_table(CODES, state->lens, 19, &(state->next), ++ &(state->lenbits), state->work); ++ if (ret) { ++ strm->msg = (char *)"invalid code lengths set"; ++ state->mode = BAD; ++ break; ++ } ++ Tracev((stderr, "inflate: code lengths ok\n")); ++ state->have = 0; ++ state->mode = CODELENS; ++ case CODELENS: ++ while (state->have < state->nlen + state->ndist) { ++ for (;;) { ++ here = state->lencode[BITS(state->lenbits)]; ++ if ((unsigned)(here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ if (here.val < 16) { ++ DROPBITS(here.bits); ++ state->lens[state->have++] = here.val; ++ } ++ else { ++ if (here.val == 16) { ++ NEEDBITS(here.bits + 2); ++ DROPBITS(here.bits); ++ if (state->have == 0) { ++ strm->msg = (char *)"invalid bit length repeat"; ++ state->mode = BAD; ++ break; ++ } ++ len = state->lens[state->have - 1]; ++ copy = 3 + BITS(2); ++ DROPBITS(2); ++ } ++ else if (here.val == 17) { ++ NEEDBITS(here.bits + 3); ++ DROPBITS(here.bits); ++ len = 0; ++ copy = 3 + BITS(3); ++ DROPBITS(3); ++ } ++ else { ++ NEEDBITS(here.bits + 7); ++ DROPBITS(here.bits); ++ len = 0; ++ copy = 11 + BITS(7); ++ DROPBITS(7); ++ } ++ if (state->have + copy > state->nlen + state->ndist) { ++ strm->msg = (char *)"invalid bit length repeat"; ++ state->mode = BAD; ++ break; ++ } ++ while (copy--) ++ state->lens[state->have++] = (unsigned short)len; ++ } ++ } ++ ++ /* handle error breaks in while */ ++ if (state->mode == BAD) break; ++ ++ /* check for end-of-block code (better have one) */ ++ if (state->lens[256] == 0) { ++ strm->msg = (char *)"invalid code -- missing end-of-block"; ++ state->mode = BAD; ++ break; ++ } ++ ++ /* build code tables -- note: do not change the lenbits or distbits ++ values here (9 and 6) without reading the comments in inftrees.h ++ concerning the ENOUGH constants, which depend on those values */ ++ state->next = state->codes; ++ state->lencode = (const code FAR *)(state->next); ++ state->lenbits = 9; ++ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), ++ &(state->lenbits), state->work); ++ if (ret) { ++ strm->msg = (char *)"invalid literal/lengths set"; ++ state->mode = BAD; ++ break; ++ } ++ state->distcode = (const code FAR *)(state->next); ++ state->distbits = 6; ++ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, ++ &(state->next), &(state->distbits), state->work); ++ if (ret) { ++ strm->msg = (char *)"invalid distances set"; ++ state->mode = BAD; ++ break; ++ } ++ Tracev((stderr, "inflate: codes ok\n")); ++ state->mode = LEN_; ++ if (flush == Z_TREES) goto inf_leave; ++ case LEN_: ++ state->mode = LEN; ++ case LEN: ++ if (have >= 6 && left >= 258) { ++ RESTORE(); ++ inflate_fast(strm, out); ++ LOAD(); ++ if (state->mode == TYPE) ++ state->back = -1; ++ break; ++ } ++ state->back = 0; ++ for (;;) { ++ here = state->lencode[BITS(state->lenbits)]; ++ if ((unsigned)(here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ if (here.op && (here.op & 0xf0) == 0) { ++ last = here; ++ for (;;) { ++ here = state->lencode[last.val + ++ (BITS(last.bits + last.op) >> last.bits)]; ++ if ((unsigned)(last.bits + here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ DROPBITS(last.bits); ++ state->back += last.bits; ++ } ++ DROPBITS(here.bits); ++ state->back += here.bits; ++ state->length = (unsigned)here.val; ++ if ((int)(here.op) == 0) { ++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? ++ "inflate: literal '%c'\n" : ++ "inflate: literal 0x%02x\n", here.val)); ++ state->mode = LIT; ++ break; ++ } ++ if (here.op & 32) { ++ Tracevv((stderr, "inflate: end of block\n")); ++ state->back = -1; ++ state->mode = TYPE; ++ break; ++ } ++ if (here.op & 64) { ++ strm->msg = (char *)"invalid literal/length code"; ++ state->mode = BAD; ++ break; ++ } ++ state->extra = (unsigned)(here.op) & 15; ++ state->mode = LENEXT; ++ case LENEXT: ++ if (state->extra) { ++ NEEDBITS(state->extra); ++ state->length += BITS(state->extra); ++ DROPBITS(state->extra); ++ state->back += state->extra; ++ } ++ Tracevv((stderr, "inflate: length %u\n", state->length)); ++ state->was = state->length; ++ state->mode = DIST; ++ case DIST: ++ for (;;) { ++ here = state->distcode[BITS(state->distbits)]; ++ if ((unsigned)(here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ if ((here.op & 0xf0) == 0) { ++ last = here; ++ for (;;) { ++ here = state->distcode[last.val + ++ (BITS(last.bits + last.op) >> last.bits)]; ++ if ((unsigned)(last.bits + here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ DROPBITS(last.bits); ++ state->back += last.bits; ++ } ++ DROPBITS(here.bits); ++ state->back += here.bits; ++ if (here.op & 64) { ++ strm->msg = (char *)"invalid distance code"; ++ state->mode = BAD; ++ break; ++ } ++ state->offset = (unsigned)here.val; ++ state->extra = (unsigned)(here.op) & 15; ++ state->mode = DISTEXT; ++ case DISTEXT: ++ if (state->extra) { ++ NEEDBITS(state->extra); ++ state->offset += BITS(state->extra); ++ DROPBITS(state->extra); ++ state->back += state->extra; ++ } ++#ifdef INFLATE_STRICT ++ if (state->offset > state->dmax) { ++ strm->msg = (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#endif ++ Tracevv((stderr, "inflate: distance %u\n", state->offset)); ++ state->mode = MATCH; ++ case MATCH: ++ if (left == 0) goto inf_leave; ++ copy = out - left; ++ if (state->offset > copy) { /* copy from window */ ++ copy = state->offset - copy; ++ if (copy > state->whave) { ++ if (state->sane) { ++ strm->msg = (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR ++ Trace((stderr, "inflate.c too far\n")); ++ copy -= state->whave; ++ if (copy > state->length) copy = state->length; ++ if (copy > left) copy = left; ++ left -= copy; ++ state->length -= copy; ++ do { ++ *put++ = 0; ++ } while (--copy); ++ if (state->length == 0) state->mode = LEN; ++ break; ++#endif ++ } ++ if (copy > state->wnext) { ++ copy -= state->wnext; ++ from = state->window + (state->wsize - copy); ++ } ++ else ++ from = state->window + (state->wnext - copy); ++ if (copy > state->length) copy = state->length; ++ if (copy > left) copy = left; ++ put = chunkcopy_safe(put, from, copy, put + left); ++ } ++ else { /* copy from output */ ++ copy = state->length; ++ if (copy > left) copy = left; ++ put = chunkcopy_lapped_safe(put, state->offset, copy, put + left); ++ } ++ left -= copy; ++ state->length -= copy; ++ if (state->length == 0) state->mode = LEN; ++ break; ++ case LIT: ++ if (left == 0) goto inf_leave; ++ *put++ = (unsigned char)(state->length); ++ left--; ++ state->mode = LEN; ++ break; ++ case CHECK: ++ if (state->wrap) { ++ NEEDBITS(32); ++ out -= left; ++ strm->total_out += out; ++ state->total += out; ++ if ((state->wrap & 4) && out) ++ strm->adler = state->check = ++ UPDATE(state->check, put - out, out); ++ out = left; ++ if ((state->wrap & 4) && ( ++#ifdef GUNZIP ++ state->flags ? hold : ++#endif ++ ZSWAP32(hold)) != state->check) { ++ strm->msg = (char *)"incorrect data check"; ++ state->mode = BAD; ++ break; ++ } ++ INITBITS(); ++ Tracev((stderr, "inflate: check matches trailer\n")); ++ } ++#ifdef GUNZIP ++ state->mode = LENGTH; ++ case LENGTH: ++ if (state->wrap && state->flags) { ++ NEEDBITS(32); ++ if (hold != (state->total & 0xffffffffUL)) { ++ strm->msg = (char *)"incorrect length check"; ++ state->mode = BAD; ++ break; ++ } ++ INITBITS(); ++ Tracev((stderr, "inflate: length matches trailer\n")); ++ } ++#endif ++ state->mode = DONE; ++ case DONE: ++ ret = Z_STREAM_END; ++ goto inf_leave; ++ case BAD: ++ ret = Z_DATA_ERROR; ++ goto inf_leave; ++ case MEM: ++ return Z_MEM_ERROR; ++ case SYNC: ++ default: ++ return Z_STREAM_ERROR; ++ } ++ ++ /* ++ Return from inflate(), updating the total counts and the check value. ++ If there was no progress during the inflate() call, return a buffer ++ error. Call updatewindow() to create and/or update the window state. ++ Note: a memory error from inflate() is non-recoverable. ++ */ ++ inf_leave: ++ RESTORE(); ++ if (state->wsize || (out != strm->avail_out && state->mode < BAD && ++ (state->mode < CHECK || flush != Z_FINISH))) ++ if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { ++ state->mode = MEM; ++ return Z_MEM_ERROR; ++ } ++ in -= strm->avail_in; ++ out -= strm->avail_out; ++ strm->total_in += in; ++ strm->total_out += out; ++ state->total += out; ++ if ((state->wrap & 4) && out) ++ strm->adler = state->check = ++ UPDATE(state->check, strm->next_out - out, out); ++ strm->data_type = (int)state->bits + (state->last ? 64 : 0) + ++ (state->mode == TYPE ? 128 : 0) + ++ (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); ++ if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) ++ ret = Z_BUF_ERROR; ++ return ret; ++} ++ ++int ZEXPORT inflateEnd(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ if (inflateStateCheck(strm)) ++ return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (state->window != Z_NULL) ZFREE(strm, state->window); ++ ZFREE(strm, strm->state); ++ strm->state = Z_NULL; ++ Tracev((stderr, "inflate: end\n")); ++ return Z_OK; ++} ++ ++int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) ++z_streamp strm; ++Bytef *dictionary; ++uInt *dictLength; ++{ ++ struct inflate_state FAR *state; ++ ++ /* check state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ ++ /* copy dictionary */ ++ if (state->whave && dictionary != Z_NULL) { ++ zmemcpy(dictionary, state->window + state->wnext, ++ state->whave - state->wnext); ++ zmemcpy(dictionary + state->whave - state->wnext, ++ state->window, state->wnext); ++ } ++ if (dictLength != Z_NULL) ++ *dictLength = state->whave; ++ return Z_OK; ++} ++ ++int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) ++z_streamp strm; ++const Bytef *dictionary; ++uInt dictLength; ++{ ++ struct inflate_state FAR *state; ++ unsigned long dictid; ++ int ret; ++ ++ /* check state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (state->wrap != 0 && state->mode != DICT) ++ return Z_STREAM_ERROR; ++ ++ /* check for correct dictionary identifier */ ++ if (state->mode == DICT) { ++ dictid = adler32(0L, Z_NULL, 0); ++ dictid = adler32(dictid, dictionary, dictLength); ++ if (dictid != state->check) ++ return Z_DATA_ERROR; ++ } ++ ++ /* copy dictionary to window using updatewindow(), which will amend the ++ existing dictionary if appropriate */ ++ ret = updatewindow(strm, dictionary + dictLength, dictLength); ++ if (ret) { ++ state->mode = MEM; ++ return Z_MEM_ERROR; ++ } ++ state->havedict = 1; ++ Tracev((stderr, "inflate: dictionary set\n")); ++ return Z_OK; ++} ++ ++int ZEXPORT inflateGetHeader(strm, head) ++z_streamp strm; ++gz_headerp head; ++{ ++ struct inflate_state FAR *state; ++ ++ /* check state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; ++ ++ /* save header structure */ ++ state->head = head; ++ head->done = 0; ++ return Z_OK; ++} ++ ++/* ++ Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found ++ or when out of input. When called, *have is the number of pattern bytes ++ found in order so far, in 0..3. On return *have is updated to the new ++ state. If on return *have equals four, then the pattern was found and the ++ return value is how many bytes were read including the last byte of the ++ pattern. If *have is less than four, then the pattern has not been found ++ yet and the return value is len. In the latter case, syncsearch() can be ++ called again with more data and the *have state. *have is initialized to ++ zero for the first call. ++ */ ++local unsigned syncsearch(have, buf, len) ++unsigned FAR *have; ++const unsigned char FAR *buf; ++unsigned len; ++{ ++ unsigned got; ++ unsigned next; ++ ++ got = *have; ++ next = 0; ++ while (next < len && got < 4) { ++ if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) ++ got++; ++ else if (buf[next]) ++ got = 0; ++ else ++ got = 4 - got; ++ next++; ++ } ++ *have = got; ++ return next; ++} ++ ++int ZEXPORT inflateSync(strm) ++z_streamp strm; ++{ ++ unsigned len; /* number of bytes to look at or looked at */ ++ unsigned long in, out; /* temporary to save total_in and total_out */ ++ unsigned char buf[4]; /* to restore bit buffer to byte string */ ++ struct inflate_state FAR *state; ++ ++ /* check parameters */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; ++ ++ /* if first time, start search in bit buffer */ ++ if (state->mode != SYNC) { ++ state->mode = SYNC; ++ state->hold <<= state->bits & 7; ++ state->bits -= state->bits & 7; ++ len = 0; ++ while (state->bits >= 8) { ++ buf[len++] = (unsigned char)(state->hold); ++ state->hold >>= 8; ++ state->bits -= 8; ++ } ++ state->have = 0; ++ syncsearch(&(state->have), buf, len); ++ } ++ ++ /* search available input */ ++ len = syncsearch(&(state->have), strm->next_in, strm->avail_in); ++ strm->avail_in -= len; ++ strm->next_in += len; ++ strm->total_in += len; ++ ++ /* return no joy or set up to restart inflate() on a new block */ ++ if (state->have != 4) return Z_DATA_ERROR; ++ in = strm->total_in; out = strm->total_out; ++ inflateReset(strm); ++ strm->total_in = in; strm->total_out = out; ++ state->mode = TYPE; ++ return Z_OK; ++} ++ ++/* ++ Returns true if inflate is currently at the end of a block generated by ++ Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP ++ implementation to provide an additional safety check. PPP uses ++ Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored ++ block. When decompressing, PPP checks that at the end of input packet, ++ inflate is waiting for these length bytes. ++ */ ++int ZEXPORT inflateSyncPoint(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ return state->mode == STORED && state->bits == 0; ++} ++ ++int ZEXPORT inflateCopy(dest, source) ++z_streamp dest; ++z_streamp source; ++{ ++ struct inflate_state FAR *state; ++ struct inflate_state FAR *copy; ++ unsigned char FAR *window; ++ unsigned wsize; ++ ++ /* check input */ ++ if (inflateStateCheck(source) || dest == Z_NULL) ++ return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)source->state; ++ ++ /* allocate space */ ++ copy = (struct inflate_state FAR *) ++ ZALLOC(source, 1, sizeof(struct inflate_state)); ++ if (copy == Z_NULL) return Z_MEM_ERROR; ++ window = Z_NULL; ++ if (state->window != Z_NULL) { ++ window = (unsigned char FAR *) ++ ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); ++ if (window == Z_NULL) { ++ ZFREE(source, copy); ++ return Z_MEM_ERROR; ++ } ++ } ++ ++ /* copy state */ ++ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); ++ zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); ++ copy->strm = dest; ++ if (state->lencode >= state->codes && ++ state->lencode <= state->codes + ENOUGH - 1) { ++ copy->lencode = copy->codes + (state->lencode - state->codes); ++ copy->distcode = copy->codes + (state->distcode - state->codes); ++ } ++ copy->next = copy->codes + (state->next - state->codes); ++ if (window != Z_NULL) { ++ wsize = 1U << state->wbits; ++ zmemcpy(window, state->window, wsize); ++ } ++ copy->window = window; ++ dest->state = (struct internal_state FAR *)copy; ++ return Z_OK; ++} ++ ++int ZEXPORT inflateUndermine(strm, subvert) ++z_streamp strm; ++int subvert; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR ++ state->sane = !subvert; ++ return Z_OK; ++#else ++ (void)subvert; ++ state->sane = 1; ++ return Z_DATA_ERROR; ++#endif ++} ++ ++int ZEXPORT inflateValidate(strm, check) ++z_streamp strm; ++int check; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (check) ++ state->wrap |= 4; ++ else ++ state->wrap &= ~4; ++ return Z_OK; ++} ++ ++long ZEXPORT inflateMark(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) ++ return -(1L << 16); ++ state = (struct inflate_state FAR *)strm->state; ++ return (long)(((unsigned long)((long)state->back)) << 16) + ++ (state->mode == COPY ? state->length : ++ (state->mode == MATCH ? state->was - state->length : 0)); ++} ++ ++unsigned long ZEXPORT inflateCodesUsed(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ if (inflateStateCheck(strm)) return (unsigned long)-1; ++ state = (struct inflate_state FAR *)strm->state; ++ return (unsigned long)(state->next - state->codes); ++} +-- +2.14.3 + diff --git a/0002-Port-Fix-InflateBack-corner-case.patch b/0002-Port-Fix-InflateBack-corner-case.patch new file mode 100644 index 0000000..6673d9d --- /dev/null +++ b/0002-Port-Fix-InflateBack-corner-case.patch @@ -0,0 +1,147 @@ +From 267e6f20170edb9a00b11fc3a2ca7649ea1c4464 Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Wed, 4 Apr 2018 15:14:57 -0700 +Subject: [PATCH 2/2] Port Fix InflateBack corner case + +This handles the case where a zlib user could rely on InflateBack +API to decompress content. + +The NEON optimization assumes that it can perform wide stores, sometimes +overwriting data on the output pointer (but never overflowing the buffer +end as it has enough room for the write). + +For infback there is no such guarantees (i.e. no extra wiggle room), +which can result in illegal operations. This patch fixes the potential +issue by falling back to the non-optimized code for such cases. + +Also it adds some comments about the entry assumptions in inflate and +writes out a defined value at the write buffer to identify where +the real data has ended (helpful while debugging). + +For reference, please see: +https://chromium.googlesource.com/chromium/src/+/0bb11040792edc5b28fcb710fc4c01fedd98c97c + +Change-Id: Iffbda9eb5e08a661aa15c6e3d1c59b678cc23b2c +--- + CMakeLists.txt | 5 ++--- + contrib/arm/{inffast.c => inffast_chunk.c} | 10 +++++++--- + contrib/arm/inffast_chunk.h | 12 ++++++++++++ + contrib/arm/inflate.c | 14 ++++++++++++-- + 4 files changed, 33 insertions(+), 8 deletions(-) + rename contrib/arm/{inffast.c => inffast_chunk.c} (97%) + create mode 100644 contrib/arm/inffast_chunk.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 09bb3db..98ee4dd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -139,9 +139,8 @@ if(CMAKE_COMPILER_IS_GNUCC) + + if(ARM_NEON) + list(REMOVE_ITEM ZLIB_SRCS inflate.c) +- list(REMOVE_ITEM ZLIB_SRCS inffast.c) +- set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h) +- set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast.c) ++ set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h contrib/arm/inffast_chunk.h) ++ set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast_chunk.c) + add_definitions(-DARM_NEON) + set(COMPILER ${CMAKE_C_COMPILER}) + # NEON is mandatory in ARMv8. +diff --git a/contrib/arm/inffast.c b/contrib/arm/inffast_chunk.c +similarity index 97% +rename from contrib/arm/inffast.c +rename to contrib/arm/inffast_chunk.c +index f7f5007..0c5c583 100644 +--- a/contrib/arm/inffast.c ++++ b/contrib/arm/inffast_chunk.c +@@ -6,8 +6,8 @@ + #include "zutil.h" + #include "inftrees.h" + #include "inflate.h" +-#include "inffast.h" +-#include "chunkcopy.h" ++#include "contrib/arm/inffast_chunk.h" ++#include "contrib/arm/chunkcopy.h" + + #ifdef ASMINF + # pragma message("Assembler code may have bugs -- use at your own risk") +@@ -28,6 +28,10 @@ + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 ++ strm->next_out[0..strm->avail_out] does not overlap with ++ strm->next_in[0..strm->avail_in] ++ strm->state->window is allocated with an additional ++ CHUNKCOPY_CHUNK_SIZE-1 bytes of padding beyond strm->state->wsize + + On return, state->mode is one of: + +@@ -48,7 +52,7 @@ + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +-void ZLIB_INTERNAL inflate_fast(strm, start) ++void ZLIB_INTERNAL inflate_fast_chunk(strm, start) + z_streamp strm; + unsigned start; /* inflate()'s starting value for strm->avail_out */ + { +diff --git a/contrib/arm/inffast_chunk.h b/contrib/arm/inffast_chunk.h +new file mode 100644 +index 0000000..7839e1d +--- /dev/null ++++ b/contrib/arm/inffast_chunk.h +@@ -0,0 +1,12 @@ ++/* inffast.h -- header to use inffast.c ++ * Copyright (C) 1995-2003, 2010 Mark Adler ++ * Copyright (C) 2017 ARM, Inc. ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++/* WARNING: this file should *not* be used by applications. It is ++ part of the implementation of the compression library and is ++ subject to change. Applications should only use zlib.h. ++ */ ++ ++void ZLIB_INTERNAL inflate_fast_chunk OF((z_streamp strm, unsigned start)); +diff --git a/contrib/arm/inflate.c b/contrib/arm/inflate.c +index 23e95f1..d860542 100644 +--- a/contrib/arm/inflate.c ++++ b/contrib/arm/inflate.c +@@ -83,7 +83,7 @@ + #include "zutil.h" + #include "inftrees.h" + #include "inflate.h" +-#include "inffast.h" ++#include "contrib/arm/inffast_chunk.h" + #include "contrib/arm/chunkcopy.h" + + #ifdef MAKEFIXED +@@ -1056,7 +1056,7 @@ int flush; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); +- inflate_fast(strm, out); ++ inflate_fast_chunk(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; +@@ -1262,6 +1262,16 @@ int flush; + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: ++ /* We write a defined value in the unused space to help mark ++ * where the stream has ended. We don't use zeros as that can ++ * mislead clients relying on undefined behavior (i.e. assuming ++ * that the data is over when the buffer has a zero/null value). ++ */ ++ if (left >= CHUNKCOPY_CHUNK_SIZE) ++ memset(put, 0x55, CHUNKCOPY_CHUNK_SIZE); ++ else ++ memset(put, 0x55, left); ++ + RESTORE(); + if (state->wsize || (out != strm->avail_out && state->mode < BAD && + (state->mode < CHECK || flush != Z_FINISH))) +-- +2.14.3 + diff --git a/0002-Porting-optimized-longest_match.patch b/0002-Porting-optimized-longest_match.patch new file mode 100644 index 0000000..790ae2a --- /dev/null +++ b/0002-Porting-optimized-longest_match.patch @@ -0,0 +1,218 @@ +From 0ad56061ade1afe2896af1acffa5e15fbe5c98ed Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Mon, 9 Apr 2018 15:14:19 -0700 +Subject: [PATCH 2/3] Porting optimized longest_match + +This patch was contributed to zlib-ng and features an improved longest_match +function using the most distant hash code to reduce number of checks +(see:
http://www.gildor.org/en/projects/zlib
) + +Original patch by Jun He. +--- + CMakeLists.txt | 3 +- + contrib/arm/arm_longest_match.h | 142 ++++++++++++++++++++++++++++++++++++++++ + deflate.c | 11 +++- + 3 files changed, 152 insertions(+), 4 deletions(-) + create mode 100644 contrib/arm/arm_longest_match.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 230ca6d..c330093 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -142,7 +142,8 @@ if(CMAKE_COMPILER_IS_GNUCC) + set(ZLIB_ARM_NEON_HDRS + contrib/arm/chunkcopy.h + contrib/arm/inffast_chunk.h +- contrib/arm/neon_slide_hash.h) ++ contrib/arm/neon_slide_hash.h ++ contrib/arm/arm_longest_match.h) + set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast_chunk.c) + add_definitions(-DARM_NEON) + set(COMPILER ${CMAKE_C_COMPILER}) +diff --git a/contrib/arm/arm_longest_match.h b/contrib/arm/arm_longest_match.h +new file mode 100644 +index 0000000..9e7083f +--- /dev/null ++++ b/contrib/arm/arm_longest_match.h +@@ -0,0 +1,142 @@ ++/* Copyright (C) 1995-2011, 2016 Mark Adler ++ * Copyright (C) 2017 ARM Holdings Inc. ++ * Authors: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> ++ * Jun He <jun.he(a)arm.com> ++ * This software is provided 'as-is', without any express or implied ++ * warranty. In no event will the authors be held liable for any damages ++ * arising from the use of this software. ++ * Permission is granted to anyone to use this software for any purpose, ++ * including commercial applications, and to alter it and redistribute it ++ * freely, subject to the following restrictions: ++ * 1. The origin of this software must not be misrepresented; you must not ++ * claim that you wrote the original software. If you use this software ++ * in a product, an acknowledgment in the product documentation would be ++ * appreciated but is not required. ++ * 2. Altered source versions must be plainly marked as such, and must not be ++ * misrepresented as being the original software. ++ * 3. This notice may not be removed or altered from any source distribution. ++ */ ++#ifndef __ARM_LONGEST__MATCH__ ++#define __ARM_LONGEST__MATCH__ ++ ++#if defined(ARM_NEON) ++#include "deflate.h" ++#include <stdint.h> ++static inline long get_match_len(const unsigned char *a, const unsigned char *b, long max) ++{ ++ register int len = 0; ++ register unsigned long xor = 0; ++ register int check_loops = max/sizeof(unsigned long); ++ while(check_loops-- > 0) { ++ xor = (*(unsigned long *)(a+len)) ^ (*(unsigned long *)(b+len)); ++ if (xor) break; ++ len += sizeof(unsigned long); ++ } ++ if (0 == xor) { ++ while (len < max) { ++ if (a[len] != b[len]) break; ++ len++; ++ } ++ return len; ++ } ++ xor = __builtin_ctzl(xor)>>3; ++ return len + xor; ++} ++ ++/* ++ * This implementation is based on algorithm described at: ++ *
http://www.gildor.org/en/projects/zlib
++ * It uses the hash chain indexed by the most distant hash code to ++ * reduce number of checks. ++ * This also eliminates the those unnecessary check loops in legacy ++ * longest_match's do..while loop if the "most distant code" is out ++ * of search buffer ++ * ++ */ ++static inline unsigned arm_longest_match(deflate_state *const s, IPos cur_match) { ++ unsigned chain_length = s->max_chain_length;/* max hash chain length */ ++ unsigned char *scan = s->window + s->strstart; /* current string */ ++ unsigned char *match; /* matched string */ ++ unsigned int len; /* length of current match */ ++ unsigned int best_len = s->prev_length; /* best match length so far */ ++ unsigned int nice_match = s->nice_match; /* stop if match long enough */ ++ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? ++ s->strstart - (IPos)MAX_DIST(s) : 0; ++ /* Stop when cur_match becomes <= limit. To simplify the code, ++ * we prevent matches with the string of window index 0. ++ */ ++ int offset = 0; /* offset of the head[most_distant_hash] from IN cur_match */ ++ Pos *prev = s->prev; ++ unsigned int wmask = s->w_mask; ++ unsigned char *scan_buf_base = s->window; ++ ++ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. ++ * It is easy to get rid of this optimization if necessary. ++ */ ++ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); ++ ++ /* Do not look for matches beyond the end of the input. This is necessary ++ * to make deflate deterministic. ++ */ ++ if ((unsigned int)nice_match > s->lookahead) nice_match = s->lookahead; ++ ++ Assert((unsigned long)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); ++ ++ /* find most distant hash code for lazy_match */ ++ if (best_len > MIN_MATCH) { ++ /* search for most distant hash code */ ++ int i; ++ uint16_t hash = 0; ++ IPos pos; ++ ++ UPDATE_HASH(s, hash, scan[1]); ++ UPDATE_HASH(s, hash, scan[2]); ++ for (i = 3; i <= best_len; i++) { ++ UPDATE_HASH(s, hash, scan[i]); ++ /* get head IPos of hash calced by scan[i-2..i] */ ++ pos = s->head[hash]; ++ /* compare it to current "farthest hash" IPos */ ++ if (pos <= cur_match) { ++ /* we have a new "farthest hash" now */ ++ offset = i - 2; ++ cur_match = pos; ++ } ++ } ++ ++ /* update variables to correspond offset */ ++ limit += offset; ++ /* ++ * check if the most distant code's offset is out of search buffer ++ * if it is true, then this means scan[offset..offset+2] are not ++ * presented in the search buffer. So we just return best_len ++ * we've found. ++ */ ++ if (cur_match < limit) return best_len; ++ ++ scan_buf_base -= offset; ++ /* reduce hash search depth based on best_len */ ++ chain_length /= best_len - MIN_MATCH; ++ } ++ ++ do { ++ Assert(cur_match < s->strstart, "no future"); ++ ++ /* Determine matched length at current pos */ ++ match = scan_buf_base + cur_match; ++ len = get_match_len(match, scan, MAX_MATCH); ++ ++ if (len > best_len) { ++ /* found longer string */ ++ s->match_start = cur_match - offset; ++ best_len = len; ++ /* good enough? */ ++ if (len >= nice_match) break; ++ } ++ /* move to prev pos in this hash chain */ ++ } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0); ++ ++ return (best_len <= s->lookahead)? best_len : s->lookahead; ++} ++ ++#endif ++#endif +diff --git a/deflate.c b/deflate.c +index 36f99ac..4c42259 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -50,9 +50,6 @@ + /* @(#) $Id$ */ + + #include "deflate.h" +-#if __ARM_NEON +-#include "contrib/arm/neon_slide_hash.h" +-#endif + + const char deflate_copyright[] = + " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; +@@ -196,6 +193,11 @@ local const config configuration_table[10] = { + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + ++#if defined(ARM_NEON) ++#include "contrib/arm/arm_longest_match.h" ++#include "contrib/arm/neon_slide_hash.h" ++#endif ++ + /* =========================================================================== + * Slide the hash table when sliding the window down (could be avoided with 32 + * bit values at the expense of memory usage). We slide even when level == 0 to +@@ -1244,6 +1246,9 @@ local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ + { ++#if defined(ARM_NEON) ++ return arm_longest_match(s, cur_match); ++#endif + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ +-- +2.14.3 + diff --git a/0003-arm64-specific-build-patch.patch b/0003-arm64-specific-build-patch.patch new file mode 100644 index 0000000..74502d9 --- /dev/null +++ b/0003-arm64-specific-build-patch.patch @@ -0,0 +1,136 @@ +From bd30e5ff76aab2668ebfd46e5dbadc44322960c1 Mon Sep 17 00:00:00 2001 +From: Jeremy Linton <jeremy.linton(a)arm.com> +Date: Fri, 6 Apr 2018 11:46:42 -0500 +Subject: [PATCH 3/3] arm64 specific build patch + +--- + Makefile.in | 37 +++++++++++++++++++++++++++---------- + configure | 2 +- + contrib/minizip/zip.c | 6 ++++-- + 3 files changed, 32 insertions(+), 13 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 5a77949..1a1e452 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -57,11 +57,11 @@ SRCDIR= + ZINC= + ZINCOUT=-I. + +-OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o ++OBJZ = adler32.o crc32.o deflate.o infback.o arminffast.o inffast.o inflate.o inflate_chunk.o inftrees.o trees.o zutil.o + OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o + OBJC = $(OBJZ) $(OBJG) + +-PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo ++PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inflate_chunk.lo inftrees.lo trees.lo zutil.lo + PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo + PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) + +@@ -163,16 +163,22 @@ crc32.o: $(SRCDIR)crc32.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c + + deflate.o: $(SRCDIR)deflate.c +- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)deflate.c + + infback.o: $(SRCDIR)infback.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c + + inffast.o: $(SRCDIR)inffast.c +- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)inffast.c + +-inflate.o: $(SRCDIR)inflate.c +- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c ++arminffast.o: $(SRCDIR)contrib/arm/inffast_chunk.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)contrib/arm/inffast_chunk.c ++ ++inflate.o: $(SRCDIR)contrib/arm/inflate.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)contrib/arm/inflate.c ++ ++inflate_chunk.o: $(SRCDIR)contrib/arm/inffast_chunk.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)contrib/arm/inffast_chunk.c + + inftrees.o: $(SRCDIR)inftrees.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c +@@ -214,7 +220,7 @@ crc32.lo: $(SRCDIR)crc32.c + + deflate.lo: $(SRCDIR)deflate.c + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c + -@mv objs/deflate.o $@ + + infback.lo: $(SRCDIR)infback.c +@@ -222,16 +228,27 @@ infback.lo: $(SRCDIR)infback.c + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c + -@mv objs/infback.o $@ + ++arminffast.lo: $(SRCDIR)contrib/arm/inffast_chunk.c $(SRCDIR)inffast.c ++ -@mkdir objs 2>/dev/null || test -d objs ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/arminffast.o $(SRCDIR)contrib/arm/inffast_chunk.c ++ -@mv objs/arminffast.o $@ ++ + inffast.lo: $(SRCDIR)inffast.c + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c + -@mv objs/inffast.o $@ + +-inflate.lo: $(SRCDIR)inflate.c ++inflate.lo: $(SRCDIR)contrib/arm/inflate.c + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/inflate.o $(SRCDIR)contrib/arm/inflate.c + -@mv objs/inflate.o $@ + ++inflate_chunk.lo: $(SRCDIR)contrib/arm/inffast_chunk.c ++ -@mkdir objs 2>/dev/null || test -d objs ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/inflate_chunk.o $(SRCDIR)contrib/arm/inffast_chunk.c ++ -@mv objs/inflate_chunk.o $@ ++ ++ + inftrees.lo: $(SRCDIR)inftrees.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c +diff --git a/configure b/configure +index e974d1f..0c5f837 100755 +--- a/configure ++++ b/configure +@@ -23,7 +23,7 @@ SRCDIR=`dirname $0` + if test $SRCDIR = "."; then + ZINC="" + ZINCOUT="-I." +- SRCDIR="" ++ SRCDIR="./" + else + ZINC='-include zconf.h' + ZINCOUT='-I. -I$(SRCDIR)' +diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c +index 44e88a9..0517930 100644 +--- a/contrib/minizip/zip.c ++++ b/contrib/minizip/zip.c +@@ -519,15 +519,17 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f + break; + + for (i=(int)uReadSize-3; (i--)>0;) ++ { + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) + { + uPosFound = uReadPos+i; + break; + } ++ } + +- if (uPosFound!=0) +- break; ++ if (uPosFound!=0) ++ break; + } + TRYFREE(buf); + return uPosFound; +-- +2.14.3 + diff --git a/zlib.spec b/zlib.spec index 0e67f2b..9087e98 100644 --- a/zlib.spec +++ b/zlib.spec @@ -12,6 +12,12 @@ Source:
http://www.zlib.net/zlib-%{version}.tar.xz
Patch0: zlib-1.2.5-minizip-fixuncrypt.patch # resolves: #805113 Patch1: zlib-1.2.11-optimized-s390.patch +# general aarch64 optimizations +Patch2: 0001-Porting-inflate-using-wider-loads-and-stores.patch +Patch3: 0002-Port-Fix-InflateBack-corner-case.patch +Patch4: 0001-Neon-Optimized-hash-chain-rebase.patch +Patch5: 0002-Porting-optimized-longest_match.patch +Patch6: 0003-arm64-specific-build-patch.patch BuildRequires: automake, autoconf, libtool @@ -64,6 +70,14 @@ developing applications which use minizip. %ifarch s390 s390x %patch1 -p1 -b .optimized-deflate %endif +%ifarch aarch64 +%patch2 -p1 -b .optimize-aarch64 +%patch3 -p1 -b .optimize-aarch64 +%patch4 -p1 -b .optimize-aarch64 +%patch5 -p1 -b .optimize-aarch64 +%patch6 -p1 -b .optimize-aarch64 +%endif + iconv -f iso-8859-2 -t utf-8 < ChangeLog > ChangeLog.tmp mv ChangeLog.tmp ChangeLog @@ -73,6 +87,10 @@ export CFLAGS="$RPM_OPT_FLAGS" %ifarch ppc64 CFLAGS+=" -O3" %endif +%ifarch aarch64 +CFLAGS+=" -DARM_NEON -O3" +%endif + export LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now" ./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} make %{?_smp_mflags} commit 4d2785ec3116947872f6f32dc4104e6d36d8a7a4 Author: Pavel Raiskup <praiskup(a)redhat.com> Date: Thu Mar 15 16:08:24 2018 +0100 don't mask /usr/include/crypt.h with minizip's internal header Resolves: rhbz#1556438 Version: 1.2.11-7 diff --git a/zlib.spec b/zlib.spec index 2c2662f..0e67f2b 100644 --- a/zlib.spec +++ b/zlib.spec @@ -1,7 +1,7 @@ Summary: The compression and decompression library Name: zlib Version: 1.2.11 -Release: 6%{?dist} +Release: 7%{?dist} # /contrib/dotzlib/ have Boost license License: zlib and Boost Group: System Environment/Libraries @@ -92,6 +92,8 @@ cd contrib/minizip make install DESTDIR=$RPM_BUILD_ROOT rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +#
https://github.com/madler/zlib/pull/229
+rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %ldconfig_scriptlets %ldconfig_scriptlets -n minizip @@ -128,6 +130,9 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.la %{_libdir}/pkgconfig/minizip.pc %changelog +* Thu Mar 15 2018 Pavel Raiskup <praiskup(a)redhat.com> - 1.2.11-7 +- don't install crypt.h (rhbz#1424609) + * Fri Feb 09 2018 Fedora Release Engineering <releng(a)fedoraproject.org> - 1.2.11-6 - Rebuilt for
https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
1
0
0
0
Architecture specific change in rpms/zlib.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/zlib.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/zlib.git/commit/?id=25e980271348488…
. Change: +%ifarch aarch64 Thanks. Full change: ============ commit 3c07ec781440addcf412da061e5a28c8ec1cf381 Author: Peter Robinson <pbrobinson(a)gmail.com> Date: Mon Apr 30 17:27:26 2018 +0100 Optimisations for aarch64, Minor spec cleanups diff --git a/zlib.spec b/zlib.spec index 9087e98..72deb74 100644 --- a/zlib.spec +++ b/zlib.spec @@ -1,13 +1,12 @@ -Summary: The compression and decompression library -Name: zlib +Name: zlib Version: 1.2.11 -Release: 7%{?dist} +Release: 8%{?dist} +Summary: The compression and decompression library # /contrib/dotzlib/ have Boost license License: zlib and Boost -Group: System Environment/Libraries URL:
http://www.zlib.net/
-Source:
http://www.zlib.net/zlib-%{version}.tar.xz
+Source:
http://www.zlib.net/zlib-%{version}.tar.xz
#
https://github.com/madler/zlib/pull/210
Patch0: zlib-1.2.5-minizip-fixuncrypt.patch # resolves: #805113 @@ -27,7 +26,6 @@ library which is used by many different programs. %package devel Summary: Header files and libraries for Zlib development -Group: Development/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description devel @@ -37,7 +35,6 @@ library. %package static Summary: Static libraries for Zlib development -Group: Development/Libraries Requires: %{name}-devel%{?_isa} = %{version}-%{release} %description static @@ -47,7 +44,6 @@ decompression library. %package -n minizip Summary: Library for manipulation with .zip archives -Group: System Environment/Libraries Requires: %{name}%{?_isa} = %{version}-%{release} %description -n minizip @@ -55,10 +51,8 @@ Minizip is a library for manipulation with files from .zip archives. %package -n minizip-devel Summary: Development files for the minizip library -Group: Development/Libraries Requires: minizip%{?_isa} = %{version}-%{release} Requires: %{name}-devel%{?_isa} = %{version}-%{release} -Requires: pkgconfig %description -n minizip-devel This package contains the libraries and header files needed for @@ -117,14 +111,11 @@ rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %ldconfig_scriptlets -n minizip %files -%{!?_licensedir:%global license %%doc} %license README %doc ChangeLog FAQ %{_libdir}/libz.so.* %files devel -%{!?_licensedir:%global license %%doc} -%license README %doc doc/algorithm.txt test/example.c %{_libdir}/libz.so %{_libdir}/pkgconfig/zlib.pc @@ -133,7 +124,6 @@ rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %{_mandir}/man3/zlib.3* %files static -%{!?_licensedir:%global license %%doc} %license README %{_libdir}/libz.a @@ -148,6 +138,10 @@ rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h %{_libdir}/pkgconfig/minizip.pc %changelog +* Mon Apr 30 2018 Peter Robinson <pbrobinson(a)fedoraproject.org> 1.2.11-8 +- Optimisations for aarch64 +- Minor spec cleanups + * Thu Mar 15 2018 Pavel Raiskup <praiskup(a)redhat.com> - 1.2.11-7 - don't install crypt.h (rhbz#1424609) commit 25e9802713484882c27c1f979a6610a42414ee13 Author: Jeremy Linton <jeremy.linton(a)arm.com> Date: Thu Apr 5 16:20:56 2018 -0500 aarch64 optimizations diff --git a/0001-Neon-Optimized-hash-chain-rebase.patch b/0001-Neon-Optimized-hash-chain-rebase.patch new file mode 100644 index 0000000..bebec86 --- /dev/null +++ b/0001-Neon-Optimized-hash-chain-rebase.patch @@ -0,0 +1,157 @@ +From f849a23e0afc8b8a670fda64eec8b573fe62daa7 Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Mon, 9 Apr 2018 13:52:17 -0700 +Subject: [PATCH 1/3] Neon-Optimized hash chain rebase + +This should help with compression of data, using NEON instructions +(therefore useful for ARMv7/ARMv8). + +Original patch by Jun He. +--- + CMakeLists.txt | 5 ++- + contrib/arm/neon_slide_hash.h | 84 +++++++++++++++++++++++++++++++++++++++++++ + deflate.c | 7 ++++ + 3 files changed, 95 insertions(+), 1 deletion(-) + create mode 100644 contrib/arm/neon_slide_hash.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 98ee4dd..230ca6d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -139,7 +139,10 @@ if(CMAKE_COMPILER_IS_GNUCC) + + if(ARM_NEON) + list(REMOVE_ITEM ZLIB_SRCS inflate.c) +- set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h contrib/arm/inffast_chunk.h) ++ set(ZLIB_ARM_NEON_HDRS ++ contrib/arm/chunkcopy.h ++ contrib/arm/inffast_chunk.h ++ contrib/arm/neon_slide_hash.h) + set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast_chunk.c) + add_definitions(-DARM_NEON) + set(COMPILER ${CMAKE_C_COMPILER}) +diff --git a/contrib/arm/neon_slide_hash.h b/contrib/arm/neon_slide_hash.h +new file mode 100644 +index 0000000..0daffa1 +--- /dev/null ++++ b/contrib/arm/neon_slide_hash.h +@@ -0,0 +1,84 @@ ++/* Copyright (C) 1995-2011, 2016 Mark Adler ++ * Copyright (C) 2017 ARM Holdings Inc. ++ * Authors: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> ++ * Jun He <jun.he(a)arm.com> ++ * This software is provided 'as-is', without any express or implied ++ * warranty. In no event will the authors be held liable for any damages ++ * arising from the use of this software. ++ * Permission is granted to anyone to use this software for any purpose, ++ * including commercial applications, and to alter it and redistribute it ++ * freely, subject to the following restrictions: ++ * 1. The origin of this software must not be misrepresented; you must not ++ * claim that you wrote the original software. If you use this software ++ * in a product, an acknowledgment in the product documentation would be ++ * appreciated but is not required. ++ * 2. Altered source versions must be plainly marked as such, and must not be ++ * misrepresented as being the original software. ++ * 3. This notice may not be removed or altered from any source distribution. ++ */ ++#ifndef __NEON_SLIDE_HASH__ ++#define __NEON_SLIDE_HASH__ ++ ++#if (defined(__ARM_NEON__) || defined(__ARM_NEON)) ++#include "deflate.h" ++#include <arm_neon.h> ++ ++inline static void neon_slide_hash(deflate_state *s) ++{ ++ /* ++ * This is ASIMD implementation for hash table rebase ++ * it assumes: ++ * 1. hash chain offset (Pos) is 2 bytes ++ * 2. hash table size is multiple*128 bytes ++ * #1 should be true as Pos is defined as "ush" ++ * #2 should be true as hash_bits are greater that 7 ++ */ ++ unsigned n, m; ++ unsigned short wsize = s->w_size; ++ uint16x8_t v, *p; ++ size_t size; ++ ++ size = s->hash_size*sizeof(s->head[0]); ++ Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); ++ ++ Assert(sizeof(Pos) == 2, "Wrong Pos size"); ++ ++ /* slide s->head */ ++ v = vdupq_n_u16(wsize); ++ p = (uint16x8_t *)(s->head); ++ n = size / (sizeof(uint16x8_t) * 8); ++ do { ++ p[0] = vqsubq_u16(p[0], v); ++ p[1] = vqsubq_u16(p[1], v); ++ p[2] = vqsubq_u16(p[2], v); ++ p[3] = vqsubq_u16(p[3], v); ++ p[4] = vqsubq_u16(p[4], v); ++ p[5] = vqsubq_u16(p[5], v); ++ p[6] = vqsubq_u16(p[6], v); ++ p[7] = vqsubq_u16(p[7], v); ++ p += 8; ++ } while (--n); ++#ifndef FASTEST ++ /* slide s->prev */ ++ size = wsize*sizeof(s->prev[0]); ++ ++ Assert((size % sizeof(uint16x8_t) * 8 == 0), "hash table size err"); ++ ++ p = (uint16x8_t *)(s->prev); ++ n = size / (sizeof(uint16x8_t) * 8); ++ do { ++ p[0] = vqsubq_u16(p[0], v); ++ p[1] = vqsubq_u16(p[1], v); ++ p[2] = vqsubq_u16(p[2], v); ++ p[3] = vqsubq_u16(p[3], v); ++ p[4] = vqsubq_u16(p[4], v); ++ p[5] = vqsubq_u16(p[5], v); ++ p[6] = vqsubq_u16(p[6], v); ++ p[7] = vqsubq_u16(p[7], v); ++ p += 8; ++ } while (--n); ++#endif ++} ++ ++#endif ++#endif +diff --git a/deflate.c b/deflate.c +index 1ec7614..36f99ac 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -50,6 +50,9 @@ + /* @(#) $Id$ */ + + #include "deflate.h" ++#if __ARM_NEON ++#include "contrib/arm/neon_slide_hash.h" ++#endif + + const char deflate_copyright[] = + " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; +@@ -201,6 +204,9 @@ local const config configuration_table[10] = { + local void slide_hash(s) + deflate_state *s; + { ++#if ARM_NEON ++ return neon_slide_hash(s); ++#else + unsigned n, m; + Posf *p; + uInt wsize = s->w_size; +@@ -222,6 +228,7 @@ local void slide_hash(s) + */ + } while (--n); + #endif ++#endif + } + + /* ========================================================================= */ +-- +2.14.3 + diff --git a/0001-Porting-inflate-using-wider-loads-and-stores.patch b/0001-Porting-inflate-using-wider-loads-and-stores.patch new file mode 100644 index 0000000..17c3e7c --- /dev/null +++ b/0001-Porting-inflate-using-wider-loads-and-stores.patch @@ -0,0 +1,2268 @@ +From 390b2713be0c7f682861264a74b202439caf9460 Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Wed, 4 Apr 2018 12:10:35 -0700 +Subject: [PATCH 1/2] Porting inflate using wider loads and stores + +In inflate_fast() the output pointer always has plenty of room to write. This +means that so long as the target is capable, wide un-aligned loads and stores +can be used to transfer several bytes at once. When the reference distance is +too short simply unroll the data a little to increase the distance. + +For reference, please see: +https://chromium.googlesource.com/chromium/src/+/78104f4d73e3bbb4155fa804d00ed66682180556 +ps: this is still missing the fix for inflate_back corner case. + +Change-Id: I5216424ab584e069b77ddf04000a313d5ca99839 +--- + CMakeLists.txt | 21 +- + contrib/arm/chunkcopy.h | 297 +++++++++ + contrib/arm/inffast.c | 307 +++++++++ + contrib/arm/inflate.c | 1572 +++++++++++++++++++++++++++++++++++++++++++++++ + 4 files changed, 2195 insertions(+), 2 deletions(-) + create mode 100644 contrib/arm/chunkcopy.h + create mode 100644 contrib/arm/inffast.c + create mode 100644 contrib/arm/inflate.c + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0fe939d..09bb3db 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,6 +7,7 @@ set(VERSION "1.2.11") + + option(ASM686 "Enable building i686 assembly implementation") + option(AMD64 "Enable building amd64 assembly implementation") ++option(ARM_NEON "Enable building ARM NEON intrinsics implementation") + + set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables") + set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries") +@@ -136,6 +137,22 @@ if(CMAKE_COMPILER_IS_GNUCC) + set(ZLIB_ASMS contrib/amd64/amd64-match.S) + endif () + ++ if(ARM_NEON) ++ list(REMOVE_ITEM ZLIB_SRCS inflate.c) ++ list(REMOVE_ITEM ZLIB_SRCS inffast.c) ++ set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h) ++ set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast.c) ++ add_definitions(-DARM_NEON) ++ set(COMPILER ${CMAKE_C_COMPILER}) ++ # NEON is mandatory in ARMv8. ++ if(${COMPILER} MATCHES "aarch64") ++ set_source_files_properties(${ZLIB_ARM_NEON} PROPERTIES LANGUAGE C COMPILE_FLAGS -march=armv8-a) ++ # But it was optional for ARMv7. ++ elseif(${COMPILER} MATCHES "arm") ++ set_source_files_properties(${ZLIB_ARM_NEON} PROPERTIES LANGUAGE C COMPILE_FLAGS -mfpu=neon) ++ endif() ++ endif() ++ + if(ZLIB_ASMS) + add_definitions(-DASMV) + set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE) +@@ -183,8 +200,8 @@ if(MINGW) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) + endif(MINGW) + +-add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_ARM_NEON} ${ZLIB_ARM_NEON_HDRS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_ARM_NEON} ${ZLIB_ARM_NEON_HDRS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + set_target_properties(zlib PROPERTIES SOVERSION 1) + +diff --git a/contrib/arm/chunkcopy.h b/contrib/arm/chunkcopy.h +new file mode 100644 +index 0000000..d42995c +--- /dev/null ++++ b/contrib/arm/chunkcopy.h +@@ -0,0 +1,297 @@ ++/* chunkcopy.h -- fast copies and sets ++ * Copyright (C) 2017 ARM, Inc. ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++#ifndef CHUNKCOPY_H ++#define CHUNKCOPY_H ++ ++#include <arm_neon.h> ++#include "zutil.h" ++ ++#if __STDC_VERSION__ >= 199901L ++#define Z_RESTRICT restrict ++#else ++#define Z_RESTRICT ++#endif ++ ++typedef uint8x16_t chunkcopy_chunk_t; ++#define CHUNKCOPY_CHUNK_SIZE sizeof(chunkcopy_chunk_t) ++ ++/* ++ Ask the compiler to perform a wide, unaligned load with an machine ++ instruction appropriate for the chunkcopy_chunk_t type. ++ */ ++static inline chunkcopy_chunk_t loadchunk(const unsigned char FAR* s) { ++ chunkcopy_chunk_t c; ++ __builtin_memcpy(&c, s, sizeof(c)); ++ return c; ++} ++ ++/* ++ Ask the compiler to perform a wide, unaligned store with an machine ++ instruction appropriate for the chunkcopy_chunk_t type. ++ */ ++static inline void storechunk(unsigned char FAR* d, chunkcopy_chunk_t c) { ++ __builtin_memcpy(d, &c, sizeof(c)); ++} ++ ++/* ++ Perform a memcpy-like operation, but assume that length is non-zero and that ++ it's OK to overwrite at least CHUNKCOPY_CHUNK_SIZE bytes of output even if ++ the length is shorter than this. ++ ++ It also guarantees that it will properly unroll the data if the distance ++ between `out` and `from` is at least CHUNKCOPY_CHUNK_SIZE, which we rely on ++ in chunkcopy_relaxed(). ++ ++ Aside from better memory bus utilisation, this means that short copies ++ (CHUNKCOPY_CHUNK_SIZE bytes or fewer) will fall straight through the loop ++ without iteration, which will hopefully make the branch prediction more ++ reliable. ++ */ ++static inline unsigned char FAR* chunkcopy_core(unsigned char FAR* out, ++ const unsigned char FAR* from, ++ unsigned len) { ++ int bump = (--len % CHUNKCOPY_CHUNK_SIZE) + 1; ++ storechunk(out, loadchunk(from)); ++ out += bump; ++ from += bump; ++ len /= CHUNKCOPY_CHUNK_SIZE; ++ while (len-- > 0) { ++ storechunk(out, loadchunk(from)); ++ out += CHUNKCOPY_CHUNK_SIZE; ++ from += CHUNKCOPY_CHUNK_SIZE; ++ } ++ return out; ++} ++ ++/* ++ Like chunkcopy_core, but avoid writing beyond of legal output. ++ ++ Accepts an additional pointer to the end of safe output. A generic safe ++ copy would use (out + len), but it's normally the case that the end of the ++ output buffer is beyond the end of the current copy, and this can still be ++ exploited. ++ */ ++static inline unsigned char FAR* chunkcopy_core_safe( ++ unsigned char FAR* out, ++ const unsigned char FAR* from, ++ unsigned len, ++ unsigned char FAR* limit) { ++ Assert(out + len <= limit, "chunk copy exceeds safety limit"); ++ if (limit - out < CHUNKCOPY_CHUNK_SIZE) { ++ const unsigned char FAR* Z_RESTRICT rfrom = from; ++ if (len & 8) { ++ __builtin_memcpy(out, rfrom, 8); ++ out += 8; ++ rfrom += 8; ++ } ++ if (len & 4) { ++ __builtin_memcpy(out, rfrom, 4); ++ out += 4; ++ rfrom += 4; ++ } ++ if (len & 2) { ++ __builtin_memcpy(out, rfrom, 2); ++ out += 2; ++ rfrom += 2; ++ } ++ if (len & 1) { ++ *out++ = *rfrom++; ++ } ++ return out; ++ } ++ return chunkcopy_core(out, from, len); ++} ++ ++/* ++ Perform short copies until distance can be rewritten as being at least ++ CHUNKCOPY_CHUNK_SIZE. ++ ++ This assumes that it's OK to overwrite at least the first ++ 2*CHUNKCOPY_CHUNK_SIZE bytes of output even if the copy is shorter than ++ this. This assumption holds within inflate_fast() which starts every ++ iteration with at least 258 bytes of output space available (258 being the ++ maximum length output from a single token; see inffast.c). ++ */ ++static inline unsigned char FAR* chunkunroll_relaxed(unsigned char FAR* out, ++ unsigned FAR* dist, ++ unsigned FAR* len) { ++ const unsigned char FAR* from = out - *dist; ++ while (*dist < *len && *dist < CHUNKCOPY_CHUNK_SIZE) { ++ storechunk(out, loadchunk(from)); ++ out += *dist; ++ *len -= *dist; ++ *dist += *dist; ++ } ++ return out; ++} ++ ++static inline uint8x16_t chunkset_vld1q_dup_u8x8( ++ const unsigned char FAR* Z_RESTRICT from) { ++#if defined(__clang__) || defined(__aarch64__) ++ return vreinterpretq_u8_u64(vld1q_dup_u64((void*)from)); ++#else ++ /* 32-bit GCC uses an alignment hint for vld1q_dup_u64, even when given a ++ * void pointer, so here's an alternate implementation. ++ */ ++ uint8x8_t h = vld1_u8(from); ++ return vcombine_u8(h, h); ++#endif ++} ++ ++/* ++ Perform an overlapping copy which behaves as a memset() operation, but ++ supporting periods other than one, and assume that length is non-zero and ++ that it's OK to overwrite at least CHUNKCOPY_CHUNK_SIZE*3 bytes of output ++ even if the length is shorter than this. ++ */ ++static inline unsigned char FAR* chunkset_core(unsigned char FAR* out, ++ unsigned period, ++ unsigned len) { ++ uint8x16_t f; ++ int bump = ((len - 1) % sizeof(f)) + 1; ++ ++ switch (period) { ++ case 1: ++ f = vld1q_dup_u8(out - 1); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ while (len > 0) { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } ++ return out; ++ case 2: ++ f = vreinterpretq_u8_u16(vld1q_dup_u16((void*)(out - 2))); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ if (len > 0) { ++ f = vreinterpretq_u8_u16(vld1q_dup_u16((void*)(out - 2))); ++ do { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } while (len > 0); ++ } ++ return out; ++ case 4: ++ f = vreinterpretq_u8_u32(vld1q_dup_u32((void*)(out - 4))); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ if (len > 0) { ++ f = vreinterpretq_u8_u32(vld1q_dup_u32((void*)(out - 4))); ++ do { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } while (len > 0); ++ } ++ return out; ++ case 8: ++ f = chunkset_vld1q_dup_u8x8(out - 8); ++ vst1q_u8(out, f); ++ out += bump; ++ len -= bump; ++ if (len > 0) { ++ f = chunkset_vld1q_dup_u8x8(out - 8); ++ do { ++ vst1q_u8(out, f); ++ out += sizeof(f); ++ len -= sizeof(f); ++ } while (len > 0); ++ } ++ return out; ++ } ++ out = chunkunroll_relaxed(out, &period, &len); ++ return chunkcopy_core(out, out - period, len); ++} ++ ++/* ++ Perform a memcpy-like operation, but assume that length is non-zero and that ++ it's OK to overwrite at least CHUNKCOPY_CHUNK_SIZE bytes of output even if ++ the length is shorter than this. ++ ++ Unlike chunkcopy_core() above, no guarantee is made regarding the behaviour ++ of overlapping buffers, regardless of the distance between the pointers. ++ This is reflected in the `restrict`-qualified pointers, allowing the ++ compiler to reorder loads and stores. ++ */ ++static inline unsigned char FAR* chunkcopy_relaxed( ++ unsigned char FAR* Z_RESTRICT out, ++ const unsigned char FAR* Z_RESTRICT from, ++ unsigned len) { ++ return chunkcopy_core(out, from, len); ++} ++ ++/* ++ Like chunkcopy_relaxed, but avoid writing beyond of legal output. ++ ++ Unlike chunkcopy_core_safe() above, no guarantee is made regarding the ++ behaviour of overlapping buffers, regardless of the distance between the ++ pointers. This is reflected in the `restrict`-qualified pointers, allowing ++ the compiler to reorder loads and stores. ++ ++ Accepts an additional pointer to the end of safe output. A generic safe ++ copy would use (out + len), but it's normally the case that the end of the ++ output buffer is beyond the end of the current copy, and this can still be ++ exploited. ++ */ ++static inline unsigned char FAR* chunkcopy_safe( ++ unsigned char FAR* out, ++ const unsigned char FAR* Z_RESTRICT from, ++ unsigned len, ++ unsigned char FAR* limit) { ++ Assert(out + len <= limit, "chunk copy exceeds safety limit"); ++ return chunkcopy_core_safe(out, from, len, limit); ++} ++ ++/* ++ Perform chunky copy within the same buffer, where the source and destination ++ may potentially overlap. ++ ++ Assumes that len > 0 on entry, and that it's safe to write at least ++ CHUNKCOPY_CHUNK_SIZE*3 bytes to the output. ++ */ ++static inline unsigned char FAR* ++chunkcopy_lapped_relaxed(unsigned char FAR* out, unsigned dist, unsigned len) { ++ if (dist < len && dist < CHUNKCOPY_CHUNK_SIZE) { ++ return chunkset_core(out, dist, len); ++ } ++ return chunkcopy_core(out, out - dist, len); ++} ++ ++/* ++ Behave like chunkcopy_lapped_relaxed, but avoid writing beyond of legal ++ output. ++ ++ Accepts an additional pointer to the end of safe output. A generic safe ++ copy would use (out + len), but it's normally the case that the end of the ++ output buffer is beyond the end of the current copy, and this can still be ++ exploited. ++ */ ++static inline unsigned char FAR* chunkcopy_lapped_safe( ++ unsigned char FAR* out, ++ unsigned dist, ++ unsigned len, ++ unsigned char FAR* limit) { ++ Assert(out + len <= limit, "chunk copy exceeds safety limit"); ++ if (limit - out < CHUNKCOPY_CHUNK_SIZE * 3) { ++ /* TODO(cavalcantii): try harder to optimise this */ ++ while (len-- > 0) { ++ *out = *(out - dist); ++ out++; ++ } ++ return out; ++ } ++ return chunkcopy_lapped_relaxed(out, dist, len); ++} ++ ++#undef Z_RESTRICT ++ ++#endif /* CHUNKCOPY_H */ +diff --git a/contrib/arm/inffast.c b/contrib/arm/inffast.c +new file mode 100644 +index 0000000..f7f5007 +--- /dev/null ++++ b/contrib/arm/inffast.c +@@ -0,0 +1,307 @@ ++/* inffast.c -- fast decoding ++ * Copyright (C) 1995-2017 Mark Adler ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++#include "zutil.h" ++#include "inftrees.h" ++#include "inflate.h" ++#include "inffast.h" ++#include "chunkcopy.h" ++ ++#ifdef ASMINF ++# pragma message("Assembler code may have bugs -- use at your own risk") ++#else ++ ++/* ++ Decode literal, length, and distance codes and write out the resulting ++ literal and match bytes until either not enough input or output is ++ available, an end-of-block is encountered, or a data error is encountered. ++ When large enough input and output buffers are supplied to inflate(), for ++ example, a 16K input buffer and a 64K output buffer, more than 95% of the ++ inflate execution time is spent in this routine. ++ ++ Entry assumptions: ++ ++ state->mode == LEN ++ strm->avail_in >= 6 ++ strm->avail_out >= 258 ++ start >= strm->avail_out ++ state->bits < 8 ++ ++ On return, state->mode is one of: ++ ++ LEN -- ran out of enough output space or enough available input ++ TYPE -- reached end of block code, inflate() to interpret next block ++ BAD -- error in block data ++ ++ Notes: ++ ++ - The maximum input bits used by a length/distance pair is 15 bits for the ++ length code, 5 bits for the length extra, 15 bits for the distance code, ++ and 13 bits for the distance extra. This totals 48 bits, or six bytes. ++ Therefore if strm->avail_in >= 6, then there is enough input to avoid ++ checking for available input while decoding. ++ ++ - The maximum bytes that a single length/distance pair can output is 258 ++ bytes, which is the maximum length that can be coded. inflate_fast() ++ requires strm->avail_out >= 258 for each loop to avoid checking for ++ output space. ++ */ ++void ZLIB_INTERNAL inflate_fast(strm, start) ++z_streamp strm; ++unsigned start; /* inflate()'s starting value for strm->avail_out */ ++{ ++ struct inflate_state FAR *state; ++ z_const unsigned char FAR *in; /* local strm->next_in */ ++ z_const unsigned char FAR *last; /* have enough input while in < last */ ++ unsigned char FAR *out; /* local strm->next_out */ ++ unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ ++ unsigned char FAR *end; /* while out < end, enough space available */ ++ unsigned char FAR *limit; /* safety limit for chunky copies */ ++#ifdef INFLATE_STRICT ++ unsigned dmax; /* maximum distance from zlib header */ ++#endif ++ unsigned wsize; /* window size or zero if not using window */ ++ unsigned whave; /* valid bytes in the window */ ++ unsigned wnext; /* window write index */ ++ unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ ++ unsigned long hold; /* local strm->hold */ ++ unsigned bits; /* local strm->bits */ ++ code const FAR *lcode; /* local strm->lencode */ ++ code const FAR *dcode; /* local strm->distcode */ ++ unsigned lmask; /* mask for first level of length codes */ ++ unsigned dmask; /* mask for first level of distance codes */ ++ code here; /* retrieved table entry */ ++ unsigned op; /* code bits, operation, extra bits, or */ ++ /* window position, window bytes to copy */ ++ unsigned len; /* match length, unused bytes */ ++ unsigned dist; /* match distance */ ++ unsigned char FAR *from; /* where to copy match from */ ++ ++ /* copy state to local variables */ ++ state = (struct inflate_state FAR *)strm->state; ++ in = strm->next_in; ++ last = in + (strm->avail_in - 5); ++ out = strm->next_out; ++ beg = out - (start - strm->avail_out); ++ end = out + (strm->avail_out - 257); ++ limit = out + strm->avail_out; ++#ifdef INFLATE_STRICT ++ dmax = state->dmax; ++#endif ++ wsize = state->wsize; ++ whave = state->whave; ++ wnext = (state->wnext == 0 && whave >= wsize) ? wsize : state->wnext; ++ window = state->window; ++ hold = state->hold; ++ bits = state->bits; ++ lcode = state->lencode; ++ dcode = state->distcode; ++ lmask = (1U << state->lenbits) - 1; ++ dmask = (1U << state->distbits) - 1; ++ ++ /* decode literals and length/distances until end-of-block or not enough ++ input data or output space */ ++ do { ++ if (bits < 15) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ here = lcode[hold & lmask]; ++ dolen: ++ op = (unsigned)(here.bits); ++ hold >>= op; ++ bits -= op; ++ op = (unsigned)(here.op); ++ if (op == 0) { /* literal */ ++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? ++ "inflate: literal '%c'\n" : ++ "inflate: literal 0x%02x\n", here.val)); ++ *out++ = (unsigned char)(here.val); ++ } ++ else if (op & 16) { /* length base */ ++ len = (unsigned)(here.val); ++ op &= 15; /* number of extra bits */ ++ if (op) { ++ if (bits < op) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ len += (unsigned)hold & ((1U << op) - 1); ++ hold >>= op; ++ bits -= op; ++ } ++ Tracevv((stderr, "inflate: length %u\n", len)); ++ if (bits < 15) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ here = dcode[hold & dmask]; ++ dodist: ++ op = (unsigned)(here.bits); ++ hold >>= op; ++ bits -= op; ++ op = (unsigned)(here.op); ++ if (op & 16) { /* distance base */ ++ dist = (unsigned)(here.val); ++ op &= 15; /* number of extra bits */ ++ if (bits < op) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ if (bits < op) { ++ hold += (unsigned long)(*in++) << bits; ++ bits += 8; ++ } ++ } ++ dist += (unsigned)hold & ((1U << op) - 1); ++#ifdef INFLATE_STRICT ++ if (dist > dmax) { ++ strm->msg = (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#endif ++ hold >>= op; ++ bits -= op; ++ Tracevv((stderr, "inflate: distance %u\n", dist)); ++ op = (unsigned)(out - beg); /* max distance in output */ ++ if (dist > op) { /* see if copy from window */ ++ op = dist - op; /* distance back in window */ ++ if (op > whave) { ++ if (state->sane) { ++ strm->msg = ++ (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR ++ if (len <= op - whave) { ++ do { ++ *out++ = 0; ++ } while (--len); ++ continue; ++ } ++ len -= op - whave; ++ do { ++ *out++ = 0; ++ } while (--op > whave); ++ if (op == 0) { ++ from = out - dist; ++ do { ++ *out++ = *from++; ++ } while (--len); ++ continue; ++ } ++#endif ++ } ++ from = window; ++ if (wnext >= op) { /* contiguous in window */ ++ from += wnext - op; ++ } ++ else { /* wrap around window */ ++ op -= wnext; ++ from += wsize - op; ++ if (op < len) { /* some from end of window */ ++ len -= op; ++ out = chunkcopy_safe(out, from, op, limit); ++ from = window; /* more from start of window */ ++ op = wnext; ++ /* This (rare) case can create a situation where ++ the first chunkcopy below must be checked. ++ */ ++ } ++ } ++ if (op < len) { /* still need some from output */ ++ out = chunkcopy_safe(out, from, op, limit); ++ len -= op; ++ /* When dist is small the amount of data that can be ++ copied from the window is also small, and progress ++ towards the dangerous end of the output buffer is ++ also small. This means that for trivial memsets and ++ for chunkunroll_relaxed() a safety check is ++ unnecessary. However, these conditions may not be ++ entered at all, and in that case it's possible that ++ the main copy is near the end. ++ */ ++ out = chunkunroll_relaxed(out, &dist, &len); ++ out = chunkcopy_safe(out, out - dist, len, limit); ++ } else { ++ /* from points to window, so there is no risk of ++ overlapping pointers requiring memset-like behaviour ++ */ ++ out = chunkcopy_safe(out, from, len, limit); ++ } ++ } ++ else { ++ /* Whole reference is in range of current output. No ++ range checks are necessary because we start with room ++ for at least 258 bytes of output, so unroll and roundoff ++ operations can write beyond `out+len` so long as they ++ stay within 258 bytes of `out`. ++ */ ++ out = chunkcopy_lapped_relaxed(out, dist, len); ++ } ++ } ++ else if ((op & 64) == 0) { /* 2nd level distance code */ ++ here = dcode[here.val + (hold & ((1U << op) - 1))]; ++ goto dodist; ++ } ++ else { ++ strm->msg = (char *)"invalid distance code"; ++ state->mode = BAD; ++ break; ++ } ++ } ++ else if ((op & 64) == 0) { /* 2nd level length code */ ++ here = lcode[here.val + (hold & ((1U << op) - 1))]; ++ goto dolen; ++ } ++ else if (op & 32) { /* end-of-block */ ++ Tracevv((stderr, "inflate: end of block\n")); ++ state->mode = TYPE; ++ break; ++ } ++ else { ++ strm->msg = (char *)"invalid literal/length code"; ++ state->mode = BAD; ++ break; ++ } ++ } while (in < last && out < end); ++ ++ /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ ++ len = bits >> 3; ++ in -= len; ++ bits -= len << 3; ++ hold &= (1U << bits) - 1; ++ ++ /* update state and return */ ++ strm->next_in = in; ++ strm->next_out = out; ++ strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); ++ strm->avail_out = (unsigned)(out < end ? ++ 257 + (end - out) : 257 - (out - end)); ++ state->hold = hold; ++ state->bits = bits; ++ return; ++} ++ ++/* ++ inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): ++ - Using bit fields for code structure ++ - Different op definition to avoid & for extra bits (do & for table bits) ++ - Three separate decoding do-loops for direct, window, and wnext == 0 ++ - Special case for distance > 1 copies to do overlapped load and store copy ++ - Explicit branch predictions (based on measured branch probabilities) ++ - Deferring match copy and interspersed it with decoding subsequent codes ++ - Swapping literal/length else ++ - Swapping window/direct else ++ - Larger unrolled copy loops (three is about right) ++ - Moving len -= 3 statement into middle of loop ++ */ ++ ++#endif /* !ASMINF */ +diff --git a/contrib/arm/inflate.c b/contrib/arm/inflate.c +new file mode 100644 +index 0000000..23e95f1 +--- /dev/null ++++ b/contrib/arm/inflate.c +@@ -0,0 +1,1572 @@ ++/* inflate.c -- zlib decompression ++ * Copyright (C) 1995-2016 Mark Adler ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++/* ++ * Change history: ++ * ++ * 1.2.beta0 24 Nov 2002 ++ * - First version -- complete rewrite of inflate to simplify code, avoid ++ * creation of window when not needed, minimize use of window when it is ++ * needed, make inffast.c even faster, implement gzip decoding, and to ++ * improve code readability and style over the previous zlib inflate code ++ * ++ * 1.2.beta1 25 Nov 2002 ++ * - Use pointers for available input and output checking in inffast.c ++ * - Remove input and output counters in inffast.c ++ * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 ++ * - Remove unnecessary second byte pull from length extra in inffast.c ++ * - Unroll direct copy to three copies per loop in inffast.c ++ * ++ * 1.2.beta2 4 Dec 2002 ++ * - Change external routine names to reduce potential conflicts ++ * - Correct filename to inffixed.h for fixed tables in inflate.c ++ * - Make hbuf[] unsigned char to match parameter type in inflate.c ++ * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) ++ * to avoid negation problem on Alphas (64 bit) in inflate.c ++ * ++ * 1.2.beta3 22 Dec 2002 ++ * - Add comments on state->bits assertion in inffast.c ++ * - Add comments on op field in inftrees.h ++ * - Fix bug in reuse of allocated window after inflateReset() ++ * - Remove bit fields--back to byte structure for speed ++ * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths ++ * - Change post-increments to pre-increments in inflate_fast(), PPC biased? ++ * - Add compile time option, POSTINC, to use post-increments instead (Intel?) ++ * - Make MATCH copy in inflate() much faster for when inflate_fast() not used ++ * - Use local copies of stream next and avail values, as well as local bit ++ * buffer and bit count in inflate()--for speed when inflate_fast() not used ++ * ++ * 1.2.beta4 1 Jan 2003 ++ * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings ++ * - Move a comment on output buffer sizes from inffast.c to inflate.c ++ * - Add comments in inffast.c to introduce the inflate_fast() routine ++ * - Rearrange window copies in inflate_fast() for speed and simplification ++ * - Unroll last copy for window match in inflate_fast() ++ * - Use local copies of window variables in inflate_fast() for speed ++ * - Pull out common wnext == 0 case for speed in inflate_fast() ++ * - Make op and len in inflate_fast() unsigned for consistency ++ * - Add FAR to lcode and dcode declarations in inflate_fast() ++ * - Simplified bad distance check in inflate_fast() ++ * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new ++ * source file infback.c to provide a call-back interface to inflate for ++ * programs like gzip and unzip -- uses window as output buffer to avoid ++ * window copying ++ * ++ * 1.2.beta5 1 Jan 2003 ++ * - Improved inflateBack() interface to allow the caller to provide initial ++ * input in strm. ++ * - Fixed stored blocks bug in inflateBack() ++ * ++ * 1.2.beta6 4 Jan 2003 ++ * - Added comments in inffast.c on effectiveness of POSTINC ++ * - Typecasting all around to reduce compiler warnings ++ * - Changed loops from while (1) or do {} while (1) to for (;;), again to ++ * make compilers happy ++ * - Changed type of window in inflateBackInit() to unsigned char * ++ * ++ * 1.2.beta7 27 Jan 2003 ++ * - Changed many types to unsigned or unsigned short to avoid warnings ++ * - Added inflateCopy() function ++ * ++ * 1.2.0 9 Mar 2003 ++ * - Changed inflateBack() interface to provide separate opaque descriptors ++ * for the in() and out() functions ++ * - Changed inflateBack() argument and in_func typedef to swap the length ++ * and buffer address return values for the input function ++ * - Check next_in and next_out for Z_NULL on entry to inflate() ++ * ++ * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. ++ */ ++ ++#include "zutil.h" ++#include "inftrees.h" ++#include "inflate.h" ++#include "inffast.h" ++#include "contrib/arm/chunkcopy.h" ++ ++#ifdef MAKEFIXED ++# ifndef BUILDFIXED ++# define BUILDFIXED ++# endif ++#endif ++ ++/* function prototypes */ ++local int inflateStateCheck OF((z_streamp strm)); ++local void fixedtables OF((struct inflate_state FAR *state)); ++local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, ++ unsigned copy)); ++#ifdef BUILDFIXED ++ void makefixed OF((void)); ++#endif ++local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, ++ unsigned len)); ++ ++local int inflateStateCheck(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ if (strm == Z_NULL || ++ strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) ++ return 1; ++ state = (struct inflate_state FAR *)strm->state; ++ if (state == Z_NULL || state->strm != strm || ++ state->mode < HEAD || state->mode > SYNC) ++ return 1; ++ return 0; ++} ++ ++int ZEXPORT inflateResetKeep(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ strm->total_in = strm->total_out = state->total = 0; ++ strm->msg = Z_NULL; ++ if (state->wrap) /* to support ill-conceived Java test suite */ ++ strm->adler = state->wrap & 1; ++ state->mode = HEAD; ++ state->last = 0; ++ state->havedict = 0; ++ state->dmax = 32768U; ++ state->head = Z_NULL; ++ state->hold = 0; ++ state->bits = 0; ++ state->lencode = state->distcode = state->next = state->codes; ++ state->sane = 1; ++ state->back = -1; ++ Tracev((stderr, "inflate: reset\n")); ++ return Z_OK; ++} ++ ++int ZEXPORT inflateReset(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ state->wsize = 0; ++ state->whave = 0; ++ state->wnext = 0; ++ return inflateResetKeep(strm); ++} ++ ++int ZEXPORT inflateReset2(strm, windowBits) ++z_streamp strm; ++int windowBits; ++{ ++ int wrap; ++ struct inflate_state FAR *state; ++ ++ /* get the state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ ++ /* extract wrap request from windowBits parameter */ ++ if (windowBits < 0) { ++ wrap = 0; ++ windowBits = -windowBits; ++ } ++ else { ++ wrap = (windowBits >> 4) + 5; ++#ifdef GUNZIP ++ if (windowBits < 48) ++ windowBits &= 15; ++#endif ++ } ++ ++ /* set number of window bits, free window if different */ ++ if (windowBits && (windowBits < 8 || windowBits > 15)) ++ return Z_STREAM_ERROR; ++ if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { ++ ZFREE(strm, state->window); ++ state->window = Z_NULL; ++ } ++ ++ /* update state and reset the rest of it */ ++ state->wrap = wrap; ++ state->wbits = (unsigned)windowBits; ++ return inflateReset(strm); ++} ++ ++int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) ++z_streamp strm; ++int windowBits; ++const char *version; ++int stream_size; ++{ ++ int ret; ++ struct inflate_state FAR *state; ++ ++ if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || ++ stream_size != (int)(sizeof(z_stream))) ++ return Z_VERSION_ERROR; ++ if (strm == Z_NULL) return Z_STREAM_ERROR; ++ strm->msg = Z_NULL; /* in case we return an error */ ++ if (strm->zalloc == (alloc_func)0) { ++#ifdef Z_SOLO ++ return Z_STREAM_ERROR; ++#else ++ strm->zalloc = zcalloc; ++ strm->opaque = (voidpf)0; ++#endif ++ } ++ if (strm->zfree == (free_func)0) ++#ifdef Z_SOLO ++ return Z_STREAM_ERROR; ++#else ++ strm->zfree = zcfree; ++#endif ++ state = (struct inflate_state FAR *) ++ ZALLOC(strm, 1, sizeof(struct inflate_state)); ++ if (state == Z_NULL) return Z_MEM_ERROR; ++ Tracev((stderr, "inflate: allocated\n")); ++ strm->state = (struct internal_state FAR *)state; ++ state->strm = strm; ++ state->window = Z_NULL; ++ state->mode = HEAD; /* to pass state test in inflateReset2() */ ++ state->check = 1L; /* 1L is the result of adler32() zero length data */ ++ ret = inflateReset2(strm, windowBits); ++ if (ret != Z_OK) { ++ ZFREE(strm, state); ++ strm->state = Z_NULL; ++ } ++ return ret; ++} ++ ++int ZEXPORT inflateInit_(strm, version, stream_size) ++z_streamp strm; ++const char *version; ++int stream_size; ++{ ++ return inflateInit2_(strm, DEF_WBITS, version, stream_size); ++} ++ ++int ZEXPORT inflatePrime(strm, bits, value) ++z_streamp strm; ++int bits; ++int value; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (bits < 0) { ++ state->hold = 0; ++ state->bits = 0; ++ return Z_OK; ++ } ++ if (bits > 16 || state->bits + (uInt)bits > 32) return Z_STREAM_ERROR; ++ value &= (1L << bits) - 1; ++ state->hold += (unsigned)value << state->bits; ++ state->bits += (uInt)bits; ++ return Z_OK; ++} ++ ++/* ++ Return state with length and distance decoding tables and index sizes set to ++ fixed code decoding. Normally this returns fixed tables from inffixed.h. ++ If BUILDFIXED is defined, then instead this routine builds the tables the ++ first time it's called, and returns those tables the first time and ++ thereafter. This reduces the size of the code by about 2K bytes, in ++ exchange for a little execution time. However, BUILDFIXED should not be ++ used for threaded applications, since the rewriting of the tables and virgin ++ may not be thread-safe. ++ */ ++local void fixedtables(state) ++struct inflate_state FAR *state; ++{ ++#ifdef BUILDFIXED ++ static int virgin = 1; ++ static code *lenfix, *distfix; ++ static code fixed[544]; ++ ++ /* build fixed huffman tables if first call (may not be thread safe) */ ++ if (virgin) { ++ unsigned sym, bits; ++ static code *next; ++ ++ /* literal/length table */ ++ sym = 0; ++ while (sym < 144) state->lens[sym++] = 8; ++ while (sym < 256) state->lens[sym++] = 9; ++ while (sym < 280) state->lens[sym++] = 7; ++ while (sym < 288) state->lens[sym++] = 8; ++ next = fixed; ++ lenfix = next; ++ bits = 9; ++ inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); ++ ++ /* distance table */ ++ sym = 0; ++ while (sym < 32) state->lens[sym++] = 5; ++ distfix = next; ++ bits = 5; ++ inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); ++ ++ /* do this just once */ ++ virgin = 0; ++ } ++#else /* !BUILDFIXED */ ++# include "inffixed.h" ++#endif /* BUILDFIXED */ ++ state->lencode = lenfix; ++ state->lenbits = 9; ++ state->distcode = distfix; ++ state->distbits = 5; ++} ++ ++#ifdef MAKEFIXED ++#include <stdio.h> ++ ++/* ++ Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also ++ defines BUILDFIXED, so the tables are built on the fly. makefixed() writes ++ those tables to stdout, which would be piped to inffixed.h. A small program ++ can simply call makefixed to do this: ++ ++ void makefixed(void); ++ ++ int main(void) ++ { ++ makefixed(); ++ return 0; ++ } ++ ++ Then that can be linked with zlib built with MAKEFIXED defined and run: ++ ++ a.out > inffixed.h ++ */ ++void makefixed() ++{ ++ unsigned low, size; ++ struct inflate_state state; ++ ++ fixedtables(&state); ++ puts(" /* inffixed.h -- table for decoding fixed codes"); ++ puts(" * Generated automatically by makefixed()."); ++ puts(" */"); ++ puts(""); ++ puts(" /* WARNING: this file should *not* be used by applications."); ++ puts(" It is part of the implementation of this library and is"); ++ puts(" subject to change. Applications should only use zlib.h."); ++ puts(" */"); ++ puts(""); ++ size = 1U << 9; ++ printf(" static const code lenfix[%u] = {", size); ++ low = 0; ++ for (;;) { ++ if ((low % 7) == 0) printf("\n "); ++ printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, ++ state.lencode[low].bits, state.lencode[low].val); ++ if (++low == size) break; ++ putchar(','); ++ } ++ puts("\n };"); ++ size = 1U << 5; ++ printf("\n static const code distfix[%u] = {", size); ++ low = 0; ++ for (;;) { ++ if ((low % 6) == 0) printf("\n "); ++ printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, ++ state.distcode[low].val); ++ if (++low == size) break; ++ putchar(','); ++ } ++ puts("\n };"); ++} ++#endif /* MAKEFIXED */ ++ ++/* ++ Update the window with the last wsize (normally 32K) bytes written before ++ returning. If window does not exist yet, create it. This is only called ++ when a window is already in use, or when output has been written during this ++ inflate call, but the end of the deflate stream has not been reached yet. ++ It is also called to create a window for dictionary data when a dictionary ++ is loaded. ++ ++ Providing output buffers larger than 32K to inflate() should provide a speed ++ advantage, since only the last 32K of output is copied to the sliding window ++ upon return from inflate(), and since all distances after the first 32K of ++ output will fall in the output data, making match copies simpler and faster. ++ The advantage may be dependent on the size of the processor's data caches. ++ */ ++local int updatewindow(strm, end, copy) ++z_streamp strm; ++const Bytef *end; ++unsigned copy; ++{ ++ struct inflate_state FAR *state; ++ unsigned dist; ++ ++ state = (struct inflate_state FAR *)strm->state; ++ ++ /* if it hasn't been done already, allocate space for the window */ ++ if (state->window == Z_NULL) { ++ unsigned wsize = 1U << state->wbits; ++ state->window = (unsigned char FAR *) ++ ZALLOC(strm, wsize + CHUNKCOPY_CHUNK_SIZE, ++ sizeof(unsigned char)); ++ if (state->window == Z_NULL) return 1; ++#ifdef INFLATE_CLEAR_UNUSED_UNDEFINED ++ /* Copies from the overflow portion of this buffer are undefined and ++ may cause analysis tools to raise a warning if we don't initialize ++ it. However, this undefined data overwrites other undefined data ++ and is subsequently either overwritten or left deliberately ++ undefined at the end of decode; so there's really no point. ++ */ ++ memset(state->window + wsize, 0, CHUNKCOPY_CHUNK_SIZE); ++#endif ++ } ++ ++ /* if window not in use yet, initialize */ ++ if (state->wsize == 0) { ++ state->wsize = 1U << state->wbits; ++ state->wnext = 0; ++ state->whave = 0; ++ } ++ ++ /* copy state->wsize or less output bytes into the circular window */ ++ if (copy >= state->wsize) { ++ zmemcpy(state->window, end - state->wsize, state->wsize); ++ state->wnext = 0; ++ state->whave = state->wsize; ++ } ++ else { ++ dist = state->wsize - state->wnext; ++ if (dist > copy) dist = copy; ++ zmemcpy(state->window + state->wnext, end - copy, dist); ++ copy -= dist; ++ if (copy) { ++ zmemcpy(state->window, end - copy, copy); ++ state->wnext = copy; ++ state->whave = state->wsize; ++ } ++ else { ++ state->wnext += dist; ++ if (state->wnext == state->wsize) state->wnext = 0; ++ if (state->whave < state->wsize) state->whave += dist; ++ } ++ } ++ return 0; ++} ++ ++/* Macros for inflate(): */ ++ ++/* check function to use adler32() for zlib or crc32() for gzip */ ++#ifdef GUNZIP ++# define UPDATE(check, buf, len) \ ++ (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) ++#else ++# define UPDATE(check, buf, len) adler32(check, buf, len) ++#endif ++ ++/* check macros for header crc */ ++#ifdef GUNZIP ++# define CRC2(check, word) \ ++ do { \ ++ hbuf[0] = (unsigned char)(word); \ ++ hbuf[1] = (unsigned char)((word) >> 8); \ ++ check = crc32(check, hbuf, 2); \ ++ } while (0) ++ ++# define CRC4(check, word) \ ++ do { \ ++ hbuf[0] = (unsigned char)(word); \ ++ hbuf[1] = (unsigned char)((word) >> 8); \ ++ hbuf[2] = (unsigned char)((word) >> 16); \ ++ hbuf[3] = (unsigned char)((word) >> 24); \ ++ check = crc32(check, hbuf, 4); \ ++ } while (0) ++#endif ++ ++/* Load registers with state in inflate() for speed */ ++#define LOAD() \ ++ do { \ ++ put = strm->next_out; \ ++ left = strm->avail_out; \ ++ next = strm->next_in; \ ++ have = strm->avail_in; \ ++ hold = state->hold; \ ++ bits = state->bits; \ ++ } while (0) ++ ++/* Restore state from registers in inflate() */ ++#define RESTORE() \ ++ do { \ ++ strm->next_out = put; \ ++ strm->avail_out = left; \ ++ strm->next_in = next; \ ++ strm->avail_in = have; \ ++ state->hold = hold; \ ++ state->bits = bits; \ ++ } while (0) ++ ++/* Clear the input bit accumulator */ ++#define INITBITS() \ ++ do { \ ++ hold = 0; \ ++ bits = 0; \ ++ } while (0) ++ ++/* Get a byte of input into the bit accumulator, or return from inflate() ++ if there is no input available. */ ++#define PULLBYTE() \ ++ do { \ ++ if (have == 0) goto inf_leave; \ ++ have--; \ ++ hold += (unsigned long)(*next++) << bits; \ ++ bits += 8; \ ++ } while (0) ++ ++/* Assure that there are at least n bits in the bit accumulator. If there is ++ not enough available input to do that, then return from inflate(). */ ++#define NEEDBITS(n) \ ++ do { \ ++ while (bits < (unsigned)(n)) \ ++ PULLBYTE(); \ ++ } while (0) ++ ++/* Return the low n bits of the bit accumulator (n < 16) */ ++#define BITS(n) \ ++ ((unsigned)hold & ((1U << (n)) - 1)) ++ ++/* Remove n bits from the bit accumulator */ ++#define DROPBITS(n) \ ++ do { \ ++ hold >>= (n); \ ++ bits -= (unsigned)(n); \ ++ } while (0) ++ ++/* Remove zero to seven bits as needed to go to a byte boundary */ ++#define BYTEBITS() \ ++ do { \ ++ hold >>= bits & 7; \ ++ bits -= bits & 7; \ ++ } while (0) ++ ++/* ++ inflate() uses a state machine to process as much input data and generate as ++ much output data as possible before returning. The state machine is ++ structured roughly as follows: ++ ++ for (;;) switch (state) { ++ ... ++ case STATEn: ++ if (not enough input data or output space to make progress) ++ return; ++ ... make progress ... ++ state = STATEm; ++ break; ++ ... ++ } ++ ++ so when inflate() is called again, the same case is attempted again, and ++ if the appropriate resources are provided, the machine proceeds to the ++ next state. The NEEDBITS() macro is usually the way the state evaluates ++ whether it can proceed or should return. NEEDBITS() does the return if ++ the requested bits are not available. The typical use of the BITS macros ++ is: ++ ++ NEEDBITS(n); ++ ... do something with BITS(n) ... ++ DROPBITS(n); ++ ++ where NEEDBITS(n) either returns from inflate() if there isn't enough ++ input left to load n bits into the accumulator, or it continues. BITS(n) ++ gives the low n bits in the accumulator. When done, DROPBITS(n) drops ++ the low n bits off the accumulator. INITBITS() clears the accumulator ++ and sets the number of available bits to zero. BYTEBITS() discards just ++ enough bits to put the accumulator on a byte boundary. After BYTEBITS() ++ and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. ++ ++ NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return ++ if there is no input available. The decoding of variable length codes uses ++ PULLBYTE() directly in order to pull just enough bytes to decode the next ++ code, and no more. ++ ++ Some states loop until they get enough input, making sure that enough ++ state information is maintained to continue the loop where it left off ++ if NEEDBITS() returns in the loop. For example, want, need, and keep ++ would all have to actually be part of the saved state in case NEEDBITS() ++ returns: ++ ++ case STATEw: ++ while (want < need) { ++ NEEDBITS(n); ++ keep[want++] = BITS(n); ++ DROPBITS(n); ++ } ++ state = STATEx; ++ case STATEx: ++ ++ As shown above, if the next state is also the next case, then the break ++ is omitted. ++ ++ A state may also return if there is not enough output space available to ++ complete that state. Those states are copying stored data, writing a ++ literal byte, and copying a matching string. ++ ++ When returning, a "goto inf_leave" is used to update the total counters, ++ update the check value, and determine whether any progress has been made ++ during that inflate() call in order to return the proper return code. ++ Progress is defined as a change in either strm->avail_in or strm->avail_out. ++ When there is a window, goto inf_leave will update the window with the last ++ output written. If a goto inf_leave occurs in the middle of decompression ++ and there is no window currently, goto inf_leave will create one and copy ++ output to the window for the next call of inflate(). ++ ++ In this implementation, the flush parameter of inflate() only affects the ++ return code (per zlib.h). inflate() always writes as much as possible to ++ strm->next_out, given the space available and the provided input--the effect ++ documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers ++ the allocation of and copying into a sliding window until necessary, which ++ provides the effect documented in zlib.h for Z_FINISH when the entire input ++ stream available. So the only thing the flush parameter actually does is: ++ when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it ++ will return Z_BUF_ERROR if it has not reached the end of the stream. ++ */ ++ ++int ZEXPORT inflate(strm, flush) ++z_streamp strm; ++int flush; ++{ ++ struct inflate_state FAR *state; ++ z_const unsigned char FAR *next; /* next input */ ++ unsigned char FAR *put; /* next output */ ++ unsigned have, left; /* available input and output */ ++ unsigned long hold; /* bit buffer */ ++ unsigned bits; /* bits in bit buffer */ ++ unsigned in, out; /* save starting available input and output */ ++ unsigned copy; /* number of stored or match bytes to copy */ ++ unsigned char FAR *from; /* where to copy match bytes from */ ++ code here; /* current decoding table entry */ ++ code last; /* parent table entry */ ++ unsigned len; /* length to copy for repeats, bits to drop */ ++ int ret; /* return code */ ++#ifdef GUNZIP ++ unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ ++#endif ++ static const unsigned short order[19] = /* permutation of code lengths */ ++ {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; ++ ++ if (inflateStateCheck(strm) || strm->next_out == Z_NULL || ++ (strm->next_in == Z_NULL && strm->avail_in != 0)) ++ return Z_STREAM_ERROR; ++ ++ state = (struct inflate_state FAR *)strm->state; ++ if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ ++ LOAD(); ++ in = have; ++ out = left; ++ ret = Z_OK; ++ for (;;) ++ switch (state->mode) { ++ case HEAD: ++ if (state->wrap == 0) { ++ state->mode = TYPEDO; ++ break; ++ } ++ NEEDBITS(16); ++#ifdef GUNZIP ++ if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ ++ if (state->wbits == 0) ++ state->wbits = 15; ++ state->check = crc32(0L, Z_NULL, 0); ++ CRC2(state->check, hold); ++ INITBITS(); ++ state->mode = FLAGS; ++ break; ++ } ++ state->flags = 0; /* expect zlib header */ ++ if (state->head != Z_NULL) ++ state->head->done = -1; ++ if (!(state->wrap & 1) || /* check if zlib header allowed */ ++#else ++ if ( ++#endif ++ ((BITS(8) << 8) + (hold >> 8)) % 31) { ++ strm->msg = (char *)"incorrect header check"; ++ state->mode = BAD; ++ break; ++ } ++ if (BITS(4) != Z_DEFLATED) { ++ strm->msg = (char *)"unknown compression method"; ++ state->mode = BAD; ++ break; ++ } ++ DROPBITS(4); ++ len = BITS(4) + 8; ++ if (state->wbits == 0) ++ state->wbits = len; ++ if (len > 15 || len > state->wbits) { ++ strm->msg = (char *)"invalid window size"; ++ state->mode = BAD; ++ break; ++ } ++ state->dmax = 1U << len; ++ Tracev((stderr, "inflate: zlib header ok\n")); ++ strm->adler = state->check = adler32(0L, Z_NULL, 0); ++ state->mode = hold & 0x200 ? DICTID : TYPE; ++ INITBITS(); ++ break; ++#ifdef GUNZIP ++ case FLAGS: ++ NEEDBITS(16); ++ state->flags = (int)(hold); ++ if ((state->flags & 0xff) != Z_DEFLATED) { ++ strm->msg = (char *)"unknown compression method"; ++ state->mode = BAD; ++ break; ++ } ++ if (state->flags & 0xe000) { ++ strm->msg = (char *)"unknown header flags set"; ++ state->mode = BAD; ++ break; ++ } ++ if (state->head != Z_NULL) ++ state->head->text = (int)((hold >> 8) & 1); ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC2(state->check, hold); ++ INITBITS(); ++ state->mode = TIME; ++ case TIME: ++ NEEDBITS(32); ++ if (state->head != Z_NULL) ++ state->head->time = hold; ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC4(state->check, hold); ++ INITBITS(); ++ state->mode = OS; ++ case OS: ++ NEEDBITS(16); ++ if (state->head != Z_NULL) { ++ state->head->xflags = (int)(hold & 0xff); ++ state->head->os = (int)(hold >> 8); ++ } ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC2(state->check, hold); ++ INITBITS(); ++ state->mode = EXLEN; ++ case EXLEN: ++ if (state->flags & 0x0400) { ++ NEEDBITS(16); ++ state->length = (unsigned)(hold); ++ if (state->head != Z_NULL) ++ state->head->extra_len = (unsigned)hold; ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ CRC2(state->check, hold); ++ INITBITS(); ++ } ++ else if (state->head != Z_NULL) ++ state->head->extra = Z_NULL; ++ state->mode = EXTRA; ++ case EXTRA: ++ if (state->flags & 0x0400) { ++ copy = state->length; ++ if (copy > have) copy = have; ++ if (copy) { ++ if (state->head != Z_NULL && ++ state->head->extra != Z_NULL) { ++ len = state->head->extra_len - state->length; ++ zmemcpy(state->head->extra + len, next, ++ len + copy > state->head->extra_max ? ++ state->head->extra_max - len : copy); ++ } ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ state->check = crc32(state->check, next, copy); ++ have -= copy; ++ next += copy; ++ state->length -= copy; ++ } ++ if (state->length) goto inf_leave; ++ } ++ state->length = 0; ++ state->mode = NAME; ++ case NAME: ++ if (state->flags & 0x0800) { ++ if (have == 0) goto inf_leave; ++ copy = 0; ++ do { ++ len = (unsigned)(next[copy++]); ++ if (state->head != Z_NULL && ++ state->head->name != Z_NULL && ++ state->length < state->head->name_max) ++ state->head->name[state->length++] = (Bytef)len; ++ } while (len && copy < have); ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ state->check = crc32(state->check, next, copy); ++ have -= copy; ++ next += copy; ++ if (len) goto inf_leave; ++ } ++ else if (state->head != Z_NULL) ++ state->head->name = Z_NULL; ++ state->length = 0; ++ state->mode = COMMENT; ++ case COMMENT: ++ if (state->flags & 0x1000) { ++ if (have == 0) goto inf_leave; ++ copy = 0; ++ do { ++ len = (unsigned)(next[copy++]); ++ if (state->head != Z_NULL && ++ state->head->comment != Z_NULL && ++ state->length < state->head->comm_max) ++ state->head->comment[state->length++] = (Bytef)len; ++ } while (len && copy < have); ++ if ((state->flags & 0x0200) && (state->wrap & 4)) ++ state->check = crc32(state->check, next, copy); ++ have -= copy; ++ next += copy; ++ if (len) goto inf_leave; ++ } ++ else if (state->head != Z_NULL) ++ state->head->comment = Z_NULL; ++ state->mode = HCRC; ++ case HCRC: ++ if (state->flags & 0x0200) { ++ NEEDBITS(16); ++ if ((state->wrap & 4) && hold != (state->check & 0xffff)) { ++ strm->msg = (char *)"header crc mismatch"; ++ state->mode = BAD; ++ break; ++ } ++ INITBITS(); ++ } ++ if (state->head != Z_NULL) { ++ state->head->hcrc = (int)((state->flags >> 9) & 1); ++ state->head->done = 1; ++ } ++ strm->adler = state->check = crc32(0L, Z_NULL, 0); ++ state->mode = TYPE; ++ break; ++#endif ++ case DICTID: ++ NEEDBITS(32); ++ strm->adler = state->check = ZSWAP32(hold); ++ INITBITS(); ++ state->mode = DICT; ++ case DICT: ++ if (state->havedict == 0) { ++ RESTORE(); ++ return Z_NEED_DICT; ++ } ++ strm->adler = state->check = adler32(0L, Z_NULL, 0); ++ state->mode = TYPE; ++ case TYPE: ++ if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; ++ case TYPEDO: ++ if (state->last) { ++ BYTEBITS(); ++ state->mode = CHECK; ++ break; ++ } ++ NEEDBITS(3); ++ state->last = BITS(1); ++ DROPBITS(1); ++ switch (BITS(2)) { ++ case 0: /* stored block */ ++ Tracev((stderr, "inflate: stored block%s\n", ++ state->last ? " (last)" : "")); ++ state->mode = STORED; ++ break; ++ case 1: /* fixed block */ ++ fixedtables(state); ++ Tracev((stderr, "inflate: fixed codes block%s\n", ++ state->last ? " (last)" : "")); ++ state->mode = LEN_; /* decode codes */ ++ if (flush == Z_TREES) { ++ DROPBITS(2); ++ goto inf_leave; ++ } ++ break; ++ case 2: /* dynamic block */ ++ Tracev((stderr, "inflate: dynamic codes block%s\n", ++ state->last ? " (last)" : "")); ++ state->mode = TABLE; ++ break; ++ case 3: ++ strm->msg = (char *)"invalid block type"; ++ state->mode = BAD; ++ } ++ DROPBITS(2); ++ break; ++ case STORED: ++ BYTEBITS(); /* go to byte boundary */ ++ NEEDBITS(32); ++ if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { ++ strm->msg = (char *)"invalid stored block lengths"; ++ state->mode = BAD; ++ break; ++ } ++ state->length = (unsigned)hold & 0xffff; ++ Tracev((stderr, "inflate: stored length %u\n", ++ state->length)); ++ INITBITS(); ++ state->mode = COPY_; ++ if (flush == Z_TREES) goto inf_leave; ++ case COPY_: ++ state->mode = COPY; ++ case COPY: ++ copy = state->length; ++ if (copy) { ++ if (copy > have) copy = have; ++ if (copy > left) copy = left; ++ if (copy == 0) goto inf_leave; ++ zmemcpy(put, next, copy); ++ have -= copy; ++ next += copy; ++ left -= copy; ++ put += copy; ++ state->length -= copy; ++ break; ++ } ++ Tracev((stderr, "inflate: stored end\n")); ++ state->mode = TYPE; ++ break; ++ case TABLE: ++ NEEDBITS(14); ++ state->nlen = BITS(5) + 257; ++ DROPBITS(5); ++ state->ndist = BITS(5) + 1; ++ DROPBITS(5); ++ state->ncode = BITS(4) + 4; ++ DROPBITS(4); ++#ifndef PKZIP_BUG_WORKAROUND ++ if (state->nlen > 286 || state->ndist > 30) { ++ strm->msg = (char *)"too many length or distance symbols"; ++ state->mode = BAD; ++ break; ++ } ++#endif ++ Tracev((stderr, "inflate: table sizes ok\n")); ++ state->have = 0; ++ state->mode = LENLENS; ++ case LENLENS: ++ while (state->have < state->ncode) { ++ NEEDBITS(3); ++ state->lens[order[state->have++]] = (unsigned short)BITS(3); ++ DROPBITS(3); ++ } ++ while (state->have < 19) ++ state->lens[order[state->have++]] = 0; ++ state->next = state->codes; ++ state->lencode = (const code FAR *)(state->next); ++ state->lenbits = 7; ++ ret = inflate_table(CODES, state->lens, 19, &(state->next), ++ &(state->lenbits), state->work); ++ if (ret) { ++ strm->msg = (char *)"invalid code lengths set"; ++ state->mode = BAD; ++ break; ++ } ++ Tracev((stderr, "inflate: code lengths ok\n")); ++ state->have = 0; ++ state->mode = CODELENS; ++ case CODELENS: ++ while (state->have < state->nlen + state->ndist) { ++ for (;;) { ++ here = state->lencode[BITS(state->lenbits)]; ++ if ((unsigned)(here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ if (here.val < 16) { ++ DROPBITS(here.bits); ++ state->lens[state->have++] = here.val; ++ } ++ else { ++ if (here.val == 16) { ++ NEEDBITS(here.bits + 2); ++ DROPBITS(here.bits); ++ if (state->have == 0) { ++ strm->msg = (char *)"invalid bit length repeat"; ++ state->mode = BAD; ++ break; ++ } ++ len = state->lens[state->have - 1]; ++ copy = 3 + BITS(2); ++ DROPBITS(2); ++ } ++ else if (here.val == 17) { ++ NEEDBITS(here.bits + 3); ++ DROPBITS(here.bits); ++ len = 0; ++ copy = 3 + BITS(3); ++ DROPBITS(3); ++ } ++ else { ++ NEEDBITS(here.bits + 7); ++ DROPBITS(here.bits); ++ len = 0; ++ copy = 11 + BITS(7); ++ DROPBITS(7); ++ } ++ if (state->have + copy > state->nlen + state->ndist) { ++ strm->msg = (char *)"invalid bit length repeat"; ++ state->mode = BAD; ++ break; ++ } ++ while (copy--) ++ state->lens[state->have++] = (unsigned short)len; ++ } ++ } ++ ++ /* handle error breaks in while */ ++ if (state->mode == BAD) break; ++ ++ /* check for end-of-block code (better have one) */ ++ if (state->lens[256] == 0) { ++ strm->msg = (char *)"invalid code -- missing end-of-block"; ++ state->mode = BAD; ++ break; ++ } ++ ++ /* build code tables -- note: do not change the lenbits or distbits ++ values here (9 and 6) without reading the comments in inftrees.h ++ concerning the ENOUGH constants, which depend on those values */ ++ state->next = state->codes; ++ state->lencode = (const code FAR *)(state->next); ++ state->lenbits = 9; ++ ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), ++ &(state->lenbits), state->work); ++ if (ret) { ++ strm->msg = (char *)"invalid literal/lengths set"; ++ state->mode = BAD; ++ break; ++ } ++ state->distcode = (const code FAR *)(state->next); ++ state->distbits = 6; ++ ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, ++ &(state->next), &(state->distbits), state->work); ++ if (ret) { ++ strm->msg = (char *)"invalid distances set"; ++ state->mode = BAD; ++ break; ++ } ++ Tracev((stderr, "inflate: codes ok\n")); ++ state->mode = LEN_; ++ if (flush == Z_TREES) goto inf_leave; ++ case LEN_: ++ state->mode = LEN; ++ case LEN: ++ if (have >= 6 && left >= 258) { ++ RESTORE(); ++ inflate_fast(strm, out); ++ LOAD(); ++ if (state->mode == TYPE) ++ state->back = -1; ++ break; ++ } ++ state->back = 0; ++ for (;;) { ++ here = state->lencode[BITS(state->lenbits)]; ++ if ((unsigned)(here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ if (here.op && (here.op & 0xf0) == 0) { ++ last = here; ++ for (;;) { ++ here = state->lencode[last.val + ++ (BITS(last.bits + last.op) >> last.bits)]; ++ if ((unsigned)(last.bits + here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ DROPBITS(last.bits); ++ state->back += last.bits; ++ } ++ DROPBITS(here.bits); ++ state->back += here.bits; ++ state->length = (unsigned)here.val; ++ if ((int)(here.op) == 0) { ++ Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? ++ "inflate: literal '%c'\n" : ++ "inflate: literal 0x%02x\n", here.val)); ++ state->mode = LIT; ++ break; ++ } ++ if (here.op & 32) { ++ Tracevv((stderr, "inflate: end of block\n")); ++ state->back = -1; ++ state->mode = TYPE; ++ break; ++ } ++ if (here.op & 64) { ++ strm->msg = (char *)"invalid literal/length code"; ++ state->mode = BAD; ++ break; ++ } ++ state->extra = (unsigned)(here.op) & 15; ++ state->mode = LENEXT; ++ case LENEXT: ++ if (state->extra) { ++ NEEDBITS(state->extra); ++ state->length += BITS(state->extra); ++ DROPBITS(state->extra); ++ state->back += state->extra; ++ } ++ Tracevv((stderr, "inflate: length %u\n", state->length)); ++ state->was = state->length; ++ state->mode = DIST; ++ case DIST: ++ for (;;) { ++ here = state->distcode[BITS(state->distbits)]; ++ if ((unsigned)(here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ if ((here.op & 0xf0) == 0) { ++ last = here; ++ for (;;) { ++ here = state->distcode[last.val + ++ (BITS(last.bits + last.op) >> last.bits)]; ++ if ((unsigned)(last.bits + here.bits) <= bits) break; ++ PULLBYTE(); ++ } ++ DROPBITS(last.bits); ++ state->back += last.bits; ++ } ++ DROPBITS(here.bits); ++ state->back += here.bits; ++ if (here.op & 64) { ++ strm->msg = (char *)"invalid distance code"; ++ state->mode = BAD; ++ break; ++ } ++ state->offset = (unsigned)here.val; ++ state->extra = (unsigned)(here.op) & 15; ++ state->mode = DISTEXT; ++ case DISTEXT: ++ if (state->extra) { ++ NEEDBITS(state->extra); ++ state->offset += BITS(state->extra); ++ DROPBITS(state->extra); ++ state->back += state->extra; ++ } ++#ifdef INFLATE_STRICT ++ if (state->offset > state->dmax) { ++ strm->msg = (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#endif ++ Tracevv((stderr, "inflate: distance %u\n", state->offset)); ++ state->mode = MATCH; ++ case MATCH: ++ if (left == 0) goto inf_leave; ++ copy = out - left; ++ if (state->offset > copy) { /* copy from window */ ++ copy = state->offset - copy; ++ if (copy > state->whave) { ++ if (state->sane) { ++ strm->msg = (char *)"invalid distance too far back"; ++ state->mode = BAD; ++ break; ++ } ++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR ++ Trace((stderr, "inflate.c too far\n")); ++ copy -= state->whave; ++ if (copy > state->length) copy = state->length; ++ if (copy > left) copy = left; ++ left -= copy; ++ state->length -= copy; ++ do { ++ *put++ = 0; ++ } while (--copy); ++ if (state->length == 0) state->mode = LEN; ++ break; ++#endif ++ } ++ if (copy > state->wnext) { ++ copy -= state->wnext; ++ from = state->window + (state->wsize - copy); ++ } ++ else ++ from = state->window + (state->wnext - copy); ++ if (copy > state->length) copy = state->length; ++ if (copy > left) copy = left; ++ put = chunkcopy_safe(put, from, copy, put + left); ++ } ++ else { /* copy from output */ ++ copy = state->length; ++ if (copy > left) copy = left; ++ put = chunkcopy_lapped_safe(put, state->offset, copy, put + left); ++ } ++ left -= copy; ++ state->length -= copy; ++ if (state->length == 0) state->mode = LEN; ++ break; ++ case LIT: ++ if (left == 0) goto inf_leave; ++ *put++ = (unsigned char)(state->length); ++ left--; ++ state->mode = LEN; ++ break; ++ case CHECK: ++ if (state->wrap) { ++ NEEDBITS(32); ++ out -= left; ++ strm->total_out += out; ++ state->total += out; ++ if ((state->wrap & 4) && out) ++ strm->adler = state->check = ++ UPDATE(state->check, put - out, out); ++ out = left; ++ if ((state->wrap & 4) && ( ++#ifdef GUNZIP ++ state->flags ? hold : ++#endif ++ ZSWAP32(hold)) != state->check) { ++ strm->msg = (char *)"incorrect data check"; ++ state->mode = BAD; ++ break; ++ } ++ INITBITS(); ++ Tracev((stderr, "inflate: check matches trailer\n")); ++ } ++#ifdef GUNZIP ++ state->mode = LENGTH; ++ case LENGTH: ++ if (state->wrap && state->flags) { ++ NEEDBITS(32); ++ if (hold != (state->total & 0xffffffffUL)) { ++ strm->msg = (char *)"incorrect length check"; ++ state->mode = BAD; ++ break; ++ } ++ INITBITS(); ++ Tracev((stderr, "inflate: length matches trailer\n")); ++ } ++#endif ++ state->mode = DONE; ++ case DONE: ++ ret = Z_STREAM_END; ++ goto inf_leave; ++ case BAD: ++ ret = Z_DATA_ERROR; ++ goto inf_leave; ++ case MEM: ++ return Z_MEM_ERROR; ++ case SYNC: ++ default: ++ return Z_STREAM_ERROR; ++ } ++ ++ /* ++ Return from inflate(), updating the total counts and the check value. ++ If there was no progress during the inflate() call, return a buffer ++ error. Call updatewindow() to create and/or update the window state. ++ Note: a memory error from inflate() is non-recoverable. ++ */ ++ inf_leave: ++ RESTORE(); ++ if (state->wsize || (out != strm->avail_out && state->mode < BAD && ++ (state->mode < CHECK || flush != Z_FINISH))) ++ if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { ++ state->mode = MEM; ++ return Z_MEM_ERROR; ++ } ++ in -= strm->avail_in; ++ out -= strm->avail_out; ++ strm->total_in += in; ++ strm->total_out += out; ++ state->total += out; ++ if ((state->wrap & 4) && out) ++ strm->adler = state->check = ++ UPDATE(state->check, strm->next_out - out, out); ++ strm->data_type = (int)state->bits + (state->last ? 64 : 0) + ++ (state->mode == TYPE ? 128 : 0) + ++ (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); ++ if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) ++ ret = Z_BUF_ERROR; ++ return ret; ++} ++ ++int ZEXPORT inflateEnd(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ if (inflateStateCheck(strm)) ++ return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (state->window != Z_NULL) ZFREE(strm, state->window); ++ ZFREE(strm, strm->state); ++ strm->state = Z_NULL; ++ Tracev((stderr, "inflate: end\n")); ++ return Z_OK; ++} ++ ++int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) ++z_streamp strm; ++Bytef *dictionary; ++uInt *dictLength; ++{ ++ struct inflate_state FAR *state; ++ ++ /* check state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ ++ /* copy dictionary */ ++ if (state->whave && dictionary != Z_NULL) { ++ zmemcpy(dictionary, state->window + state->wnext, ++ state->whave - state->wnext); ++ zmemcpy(dictionary + state->whave - state->wnext, ++ state->window, state->wnext); ++ } ++ if (dictLength != Z_NULL) ++ *dictLength = state->whave; ++ return Z_OK; ++} ++ ++int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) ++z_streamp strm; ++const Bytef *dictionary; ++uInt dictLength; ++{ ++ struct inflate_state FAR *state; ++ unsigned long dictid; ++ int ret; ++ ++ /* check state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (state->wrap != 0 && state->mode != DICT) ++ return Z_STREAM_ERROR; ++ ++ /* check for correct dictionary identifier */ ++ if (state->mode == DICT) { ++ dictid = adler32(0L, Z_NULL, 0); ++ dictid = adler32(dictid, dictionary, dictLength); ++ if (dictid != state->check) ++ return Z_DATA_ERROR; ++ } ++ ++ /* copy dictionary to window using updatewindow(), which will amend the ++ existing dictionary if appropriate */ ++ ret = updatewindow(strm, dictionary + dictLength, dictLength); ++ if (ret) { ++ state->mode = MEM; ++ return Z_MEM_ERROR; ++ } ++ state->havedict = 1; ++ Tracev((stderr, "inflate: dictionary set\n")); ++ return Z_OK; ++} ++ ++int ZEXPORT inflateGetHeader(strm, head) ++z_streamp strm; ++gz_headerp head; ++{ ++ struct inflate_state FAR *state; ++ ++ /* check state */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; ++ ++ /* save header structure */ ++ state->head = head; ++ head->done = 0; ++ return Z_OK; ++} ++ ++/* ++ Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found ++ or when out of input. When called, *have is the number of pattern bytes ++ found in order so far, in 0..3. On return *have is updated to the new ++ state. If on return *have equals four, then the pattern was found and the ++ return value is how many bytes were read including the last byte of the ++ pattern. If *have is less than four, then the pattern has not been found ++ yet and the return value is len. In the latter case, syncsearch() can be ++ called again with more data and the *have state. *have is initialized to ++ zero for the first call. ++ */ ++local unsigned syncsearch(have, buf, len) ++unsigned FAR *have; ++const unsigned char FAR *buf; ++unsigned len; ++{ ++ unsigned got; ++ unsigned next; ++ ++ got = *have; ++ next = 0; ++ while (next < len && got < 4) { ++ if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) ++ got++; ++ else if (buf[next]) ++ got = 0; ++ else ++ got = 4 - got; ++ next++; ++ } ++ *have = got; ++ return next; ++} ++ ++int ZEXPORT inflateSync(strm) ++z_streamp strm; ++{ ++ unsigned len; /* number of bytes to look at or looked at */ ++ unsigned long in, out; /* temporary to save total_in and total_out */ ++ unsigned char buf[4]; /* to restore bit buffer to byte string */ ++ struct inflate_state FAR *state; ++ ++ /* check parameters */ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; ++ ++ /* if first time, start search in bit buffer */ ++ if (state->mode != SYNC) { ++ state->mode = SYNC; ++ state->hold <<= state->bits & 7; ++ state->bits -= state->bits & 7; ++ len = 0; ++ while (state->bits >= 8) { ++ buf[len++] = (unsigned char)(state->hold); ++ state->hold >>= 8; ++ state->bits -= 8; ++ } ++ state->have = 0; ++ syncsearch(&(state->have), buf, len); ++ } ++ ++ /* search available input */ ++ len = syncsearch(&(state->have), strm->next_in, strm->avail_in); ++ strm->avail_in -= len; ++ strm->next_in += len; ++ strm->total_in += len; ++ ++ /* return no joy or set up to restart inflate() on a new block */ ++ if (state->have != 4) return Z_DATA_ERROR; ++ in = strm->total_in; out = strm->total_out; ++ inflateReset(strm); ++ strm->total_in = in; strm->total_out = out; ++ state->mode = TYPE; ++ return Z_OK; ++} ++ ++/* ++ Returns true if inflate is currently at the end of a block generated by ++ Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP ++ implementation to provide an additional safety check. PPP uses ++ Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored ++ block. When decompressing, PPP checks that at the end of input packet, ++ inflate is waiting for these length bytes. ++ */ ++int ZEXPORT inflateSyncPoint(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ return state->mode == STORED && state->bits == 0; ++} ++ ++int ZEXPORT inflateCopy(dest, source) ++z_streamp dest; ++z_streamp source; ++{ ++ struct inflate_state FAR *state; ++ struct inflate_state FAR *copy; ++ unsigned char FAR *window; ++ unsigned wsize; ++ ++ /* check input */ ++ if (inflateStateCheck(source) || dest == Z_NULL) ++ return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)source->state; ++ ++ /* allocate space */ ++ copy = (struct inflate_state FAR *) ++ ZALLOC(source, 1, sizeof(struct inflate_state)); ++ if (copy == Z_NULL) return Z_MEM_ERROR; ++ window = Z_NULL; ++ if (state->window != Z_NULL) { ++ window = (unsigned char FAR *) ++ ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); ++ if (window == Z_NULL) { ++ ZFREE(source, copy); ++ return Z_MEM_ERROR; ++ } ++ } ++ ++ /* copy state */ ++ zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); ++ zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); ++ copy->strm = dest; ++ if (state->lencode >= state->codes && ++ state->lencode <= state->codes + ENOUGH - 1) { ++ copy->lencode = copy->codes + (state->lencode - state->codes); ++ copy->distcode = copy->codes + (state->distcode - state->codes); ++ } ++ copy->next = copy->codes + (state->next - state->codes); ++ if (window != Z_NULL) { ++ wsize = 1U << state->wbits; ++ zmemcpy(window, state->window, wsize); ++ } ++ copy->window = window; ++ dest->state = (struct internal_state FAR *)copy; ++ return Z_OK; ++} ++ ++int ZEXPORT inflateUndermine(strm, subvert) ++z_streamp strm; ++int subvert; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR ++ state->sane = !subvert; ++ return Z_OK; ++#else ++ (void)subvert; ++ state->sane = 1; ++ return Z_DATA_ERROR; ++#endif ++} ++ ++int ZEXPORT inflateValidate(strm, check) ++z_streamp strm; ++int check; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) return Z_STREAM_ERROR; ++ state = (struct inflate_state FAR *)strm->state; ++ if (check) ++ state->wrap |= 4; ++ else ++ state->wrap &= ~4; ++ return Z_OK; ++} ++ ++long ZEXPORT inflateMark(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ ++ if (inflateStateCheck(strm)) ++ return -(1L << 16); ++ state = (struct inflate_state FAR *)strm->state; ++ return (long)(((unsigned long)((long)state->back)) << 16) + ++ (state->mode == COPY ? state->length : ++ (state->mode == MATCH ? state->was - state->length : 0)); ++} ++ ++unsigned long ZEXPORT inflateCodesUsed(strm) ++z_streamp strm; ++{ ++ struct inflate_state FAR *state; ++ if (inflateStateCheck(strm)) return (unsigned long)-1; ++ state = (struct inflate_state FAR *)strm->state; ++ return (unsigned long)(state->next - state->codes); ++} +-- +2.14.3 + diff --git a/0002-Port-Fix-InflateBack-corner-case.patch b/0002-Port-Fix-InflateBack-corner-case.patch new file mode 100644 index 0000000..6673d9d --- /dev/null +++ b/0002-Port-Fix-InflateBack-corner-case.patch @@ -0,0 +1,147 @@ +From 267e6f20170edb9a00b11fc3a2ca7649ea1c4464 Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Wed, 4 Apr 2018 15:14:57 -0700 +Subject: [PATCH 2/2] Port Fix InflateBack corner case + +This handles the case where a zlib user could rely on InflateBack +API to decompress content. + +The NEON optimization assumes that it can perform wide stores, sometimes +overwriting data on the output pointer (but never overflowing the buffer +end as it has enough room for the write). + +For infback there is no such guarantees (i.e. no extra wiggle room), +which can result in illegal operations. This patch fixes the potential +issue by falling back to the non-optimized code for such cases. + +Also it adds some comments about the entry assumptions in inflate and +writes out a defined value at the write buffer to identify where +the real data has ended (helpful while debugging). + +For reference, please see: +https://chromium.googlesource.com/chromium/src/+/0bb11040792edc5b28fcb710fc4c01fedd98c97c + +Change-Id: Iffbda9eb5e08a661aa15c6e3d1c59b678cc23b2c +--- + CMakeLists.txt | 5 ++--- + contrib/arm/{inffast.c => inffast_chunk.c} | 10 +++++++--- + contrib/arm/inffast_chunk.h | 12 ++++++++++++ + contrib/arm/inflate.c | 14 ++++++++++++-- + 4 files changed, 33 insertions(+), 8 deletions(-) + rename contrib/arm/{inffast.c => inffast_chunk.c} (97%) + create mode 100644 contrib/arm/inffast_chunk.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 09bb3db..98ee4dd 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -139,9 +139,8 @@ if(CMAKE_COMPILER_IS_GNUCC) + + if(ARM_NEON) + list(REMOVE_ITEM ZLIB_SRCS inflate.c) +- list(REMOVE_ITEM ZLIB_SRCS inffast.c) +- set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h) +- set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast.c) ++ set(ZLIB_ARM_NEON_HDRS contrib/arm/chunkcopy.h contrib/arm/inffast_chunk.h) ++ set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast_chunk.c) + add_definitions(-DARM_NEON) + set(COMPILER ${CMAKE_C_COMPILER}) + # NEON is mandatory in ARMv8. +diff --git a/contrib/arm/inffast.c b/contrib/arm/inffast_chunk.c +similarity index 97% +rename from contrib/arm/inffast.c +rename to contrib/arm/inffast_chunk.c +index f7f5007..0c5c583 100644 +--- a/contrib/arm/inffast.c ++++ b/contrib/arm/inffast_chunk.c +@@ -6,8 +6,8 @@ + #include "zutil.h" + #include "inftrees.h" + #include "inflate.h" +-#include "inffast.h" +-#include "chunkcopy.h" ++#include "contrib/arm/inffast_chunk.h" ++#include "contrib/arm/chunkcopy.h" + + #ifdef ASMINF + # pragma message("Assembler code may have bugs -- use at your own risk") +@@ -28,6 +28,10 @@ + strm->avail_out >= 258 + start >= strm->avail_out + state->bits < 8 ++ strm->next_out[0..strm->avail_out] does not overlap with ++ strm->next_in[0..strm->avail_in] ++ strm->state->window is allocated with an additional ++ CHUNKCOPY_CHUNK_SIZE-1 bytes of padding beyond strm->state->wsize + + On return, state->mode is one of: + +@@ -48,7 +52,7 @@ + requires strm->avail_out >= 258 for each loop to avoid checking for + output space. + */ +-void ZLIB_INTERNAL inflate_fast(strm, start) ++void ZLIB_INTERNAL inflate_fast_chunk(strm, start) + z_streamp strm; + unsigned start; /* inflate()'s starting value for strm->avail_out */ + { +diff --git a/contrib/arm/inffast_chunk.h b/contrib/arm/inffast_chunk.h +new file mode 100644 +index 0000000..7839e1d +--- /dev/null ++++ b/contrib/arm/inffast_chunk.h +@@ -0,0 +1,12 @@ ++/* inffast.h -- header to use inffast.c ++ * Copyright (C) 1995-2003, 2010 Mark Adler ++ * Copyright (C) 2017 ARM, Inc. ++ * For conditions of distribution and use, see copyright notice in zlib.h ++ */ ++ ++/* WARNING: this file should *not* be used by applications. It is ++ part of the implementation of the compression library and is ++ subject to change. Applications should only use zlib.h. ++ */ ++ ++void ZLIB_INTERNAL inflate_fast_chunk OF((z_streamp strm, unsigned start)); +diff --git a/contrib/arm/inflate.c b/contrib/arm/inflate.c +index 23e95f1..d860542 100644 +--- a/contrib/arm/inflate.c ++++ b/contrib/arm/inflate.c +@@ -83,7 +83,7 @@ + #include "zutil.h" + #include "inftrees.h" + #include "inflate.h" +-#include "inffast.h" ++#include "contrib/arm/inffast_chunk.h" + #include "contrib/arm/chunkcopy.h" + + #ifdef MAKEFIXED +@@ -1056,7 +1056,7 @@ int flush; + case LEN: + if (have >= 6 && left >= 258) { + RESTORE(); +- inflate_fast(strm, out); ++ inflate_fast_chunk(strm, out); + LOAD(); + if (state->mode == TYPE) + state->back = -1; +@@ -1262,6 +1262,16 @@ int flush; + Note: a memory error from inflate() is non-recoverable. + */ + inf_leave: ++ /* We write a defined value in the unused space to help mark ++ * where the stream has ended. We don't use zeros as that can ++ * mislead clients relying on undefined behavior (i.e. assuming ++ * that the data is over when the buffer has a zero/null value). ++ */ ++ if (left >= CHUNKCOPY_CHUNK_SIZE) ++ memset(put, 0x55, CHUNKCOPY_CHUNK_SIZE); ++ else ++ memset(put, 0x55, left); ++ + RESTORE(); + if (state->wsize || (out != strm->avail_out && state->mode < BAD && + (state->mode < CHECK || flush != Z_FINISH))) +-- +2.14.3 + diff --git a/0002-Porting-optimized-longest_match.patch b/0002-Porting-optimized-longest_match.patch new file mode 100644 index 0000000..790ae2a --- /dev/null +++ b/0002-Porting-optimized-longest_match.patch @@ -0,0 +1,218 @@ +From 0ad56061ade1afe2896af1acffa5e15fbe5c98ed Mon Sep 17 00:00:00 2001 +From: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> +Date: Mon, 9 Apr 2018 15:14:19 -0700 +Subject: [PATCH 2/3] Porting optimized longest_match + +This patch was contributed to zlib-ng and features an improved longest_match +function using the most distant hash code to reduce number of checks +(see:
http://www.gildor.org/en/projects/zlib
) + +Original patch by Jun He. +--- + CMakeLists.txt | 3 +- + contrib/arm/arm_longest_match.h | 142 ++++++++++++++++++++++++++++++++++++++++ + deflate.c | 11 +++- + 3 files changed, 152 insertions(+), 4 deletions(-) + create mode 100644 contrib/arm/arm_longest_match.h + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 230ca6d..c330093 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -142,7 +142,8 @@ if(CMAKE_COMPILER_IS_GNUCC) + set(ZLIB_ARM_NEON_HDRS + contrib/arm/chunkcopy.h + contrib/arm/inffast_chunk.h +- contrib/arm/neon_slide_hash.h) ++ contrib/arm/neon_slide_hash.h ++ contrib/arm/arm_longest_match.h) + set(ZLIB_ARM_NEON contrib/arm/inflate.c contrib/arm/inffast_chunk.c) + add_definitions(-DARM_NEON) + set(COMPILER ${CMAKE_C_COMPILER}) +diff --git a/contrib/arm/arm_longest_match.h b/contrib/arm/arm_longest_match.h +new file mode 100644 +index 0000000..9e7083f +--- /dev/null ++++ b/contrib/arm/arm_longest_match.h +@@ -0,0 +1,142 @@ ++/* Copyright (C) 1995-2011, 2016 Mark Adler ++ * Copyright (C) 2017 ARM Holdings Inc. ++ * Authors: Adenilson Cavalcanti <adenilson.cavalcanti(a)arm.com> ++ * Jun He <jun.he(a)arm.com> ++ * This software is provided 'as-is', without any express or implied ++ * warranty. In no event will the authors be held liable for any damages ++ * arising from the use of this software. ++ * Permission is granted to anyone to use this software for any purpose, ++ * including commercial applications, and to alter it and redistribute it ++ * freely, subject to the following restrictions: ++ * 1. The origin of this software must not be misrepresented; you must not ++ * claim that you wrote the original software. If you use this software ++ * in a product, an acknowledgment in the product documentation would be ++ * appreciated but is not required. ++ * 2. Altered source versions must be plainly marked as such, and must not be ++ * misrepresented as being the original software. ++ * 3. This notice may not be removed or altered from any source distribution. ++ */ ++#ifndef __ARM_LONGEST__MATCH__ ++#define __ARM_LONGEST__MATCH__ ++ ++#if defined(ARM_NEON) ++#include "deflate.h" ++#include <stdint.h> ++static inline long get_match_len(const unsigned char *a, const unsigned char *b, long max) ++{ ++ register int len = 0; ++ register unsigned long xor = 0; ++ register int check_loops = max/sizeof(unsigned long); ++ while(check_loops-- > 0) { ++ xor = (*(unsigned long *)(a+len)) ^ (*(unsigned long *)(b+len)); ++ if (xor) break; ++ len += sizeof(unsigned long); ++ } ++ if (0 == xor) { ++ while (len < max) { ++ if (a[len] != b[len]) break; ++ len++; ++ } ++ return len; ++ } ++ xor = __builtin_ctzl(xor)>>3; ++ return len + xor; ++} ++ ++/* ++ * This implementation is based on algorithm described at: ++ *
http://www.gildor.org/en/projects/zlib
++ * It uses the hash chain indexed by the most distant hash code to ++ * reduce number of checks. ++ * This also eliminates the those unnecessary check loops in legacy ++ * longest_match's do..while loop if the "most distant code" is out ++ * of search buffer ++ * ++ */ ++static inline unsigned arm_longest_match(deflate_state *const s, IPos cur_match) { ++ unsigned chain_length = s->max_chain_length;/* max hash chain length */ ++ unsigned char *scan = s->window + s->strstart; /* current string */ ++ unsigned char *match; /* matched string */ ++ unsigned int len; /* length of current match */ ++ unsigned int best_len = s->prev_length; /* best match length so far */ ++ unsigned int nice_match = s->nice_match; /* stop if match long enough */ ++ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? ++ s->strstart - (IPos)MAX_DIST(s) : 0; ++ /* Stop when cur_match becomes <= limit. To simplify the code, ++ * we prevent matches with the string of window index 0. ++ */ ++ int offset = 0; /* offset of the head[most_distant_hash] from IN cur_match */ ++ Pos *prev = s->prev; ++ unsigned int wmask = s->w_mask; ++ unsigned char *scan_buf_base = s->window; ++ ++ /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. ++ * It is easy to get rid of this optimization if necessary. ++ */ ++ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); ++ ++ /* Do not look for matches beyond the end of the input. This is necessary ++ * to make deflate deterministic. ++ */ ++ if ((unsigned int)nice_match > s->lookahead) nice_match = s->lookahead; ++ ++ Assert((unsigned long)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); ++ ++ /* find most distant hash code for lazy_match */ ++ if (best_len > MIN_MATCH) { ++ /* search for most distant hash code */ ++ int i; ++ uint16_t hash = 0; ++ IPos pos; ++ ++ UPDATE_HASH(s, hash, scan[1]); ++ UPDATE_HASH(s, hash, scan[2]); ++ for (i = 3; i <= best_len; i++) { ++ UPDATE_HASH(s, hash, scan[i]); ++ /* get head IPos of hash calced by scan[i-2..i] */ ++ pos = s->head[hash]; ++ /* compare it to current "farthest hash" IPos */ ++ if (pos <= cur_match) { ++ /* we have a new "farthest hash" now */ ++ offset = i - 2; ++ cur_match = pos; ++ } ++ } ++ ++ /* update variables to correspond offset */ ++ limit += offset; ++ /* ++ * check if the most distant code's offset is out of search buffer ++ * if it is true, then this means scan[offset..offset+2] are not ++ * presented in the search buffer. So we just return best_len ++ * we've found. ++ */ ++ if (cur_match < limit) return best_len; ++ ++ scan_buf_base -= offset; ++ /* reduce hash search depth based on best_len */ ++ chain_length /= best_len - MIN_MATCH; ++ } ++ ++ do { ++ Assert(cur_match < s->strstart, "no future"); ++ ++ /* Determine matched length at current pos */ ++ match = scan_buf_base + cur_match; ++ len = get_match_len(match, scan, MAX_MATCH); ++ ++ if (len > best_len) { ++ /* found longer string */ ++ s->match_start = cur_match - offset; ++ best_len = len; ++ /* good enough? */ ++ if (len >= nice_match) break; ++ } ++ /* move to prev pos in this hash chain */ ++ } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0); ++ ++ return (best_len <= s->lookahead)? best_len : s->lookahead; ++} ++ ++#endif ++#endif +diff --git a/deflate.c b/deflate.c +index 36f99ac..4c42259 100644 +--- a/deflate.c ++++ b/deflate.c +@@ -50,9 +50,6 @@ + /* @(#) $Id$ */ + + #include "deflate.h" +-#if __ARM_NEON +-#include "contrib/arm/neon_slide_hash.h" +-#endif + + const char deflate_copyright[] = + " deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler "; +@@ -196,6 +193,11 @@ local const config configuration_table[10] = { + s->head[s->hash_size-1] = NIL; \ + zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); + ++#if defined(ARM_NEON) ++#include "contrib/arm/arm_longest_match.h" ++#include "contrib/arm/neon_slide_hash.h" ++#endif ++ + /* =========================================================================== + * Slide the hash table when sliding the window down (could be avoided with 32 + * bit values at the expense of memory usage). We slide even when level == 0 to +@@ -1244,6 +1246,9 @@ local uInt longest_match(s, cur_match) + deflate_state *s; + IPos cur_match; /* current match */ + { ++#if defined(ARM_NEON) ++ return arm_longest_match(s, cur_match); ++#endif + unsigned chain_length = s->max_chain_length;/* max hash chain length */ + register Bytef *scan = s->window + s->strstart; /* current string */ + register Bytef *match; /* matched string */ +-- +2.14.3 + diff --git a/0003-arm64-specific-build-patch.patch b/0003-arm64-specific-build-patch.patch new file mode 100644 index 0000000..74502d9 --- /dev/null +++ b/0003-arm64-specific-build-patch.patch @@ -0,0 +1,136 @@ +From bd30e5ff76aab2668ebfd46e5dbadc44322960c1 Mon Sep 17 00:00:00 2001 +From: Jeremy Linton <jeremy.linton(a)arm.com> +Date: Fri, 6 Apr 2018 11:46:42 -0500 +Subject: [PATCH 3/3] arm64 specific build patch + +--- + Makefile.in | 37 +++++++++++++++++++++++++++---------- + configure | 2 +- + contrib/minizip/zip.c | 6 ++++-- + 3 files changed, 32 insertions(+), 13 deletions(-) + +diff --git a/Makefile.in b/Makefile.in +index 5a77949..1a1e452 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -57,11 +57,11 @@ SRCDIR= + ZINC= + ZINCOUT=-I. + +-OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o ++OBJZ = adler32.o crc32.o deflate.o infback.o arminffast.o inffast.o inflate.o inflate_chunk.o inftrees.o trees.o zutil.o + OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o + OBJC = $(OBJZ) $(OBJG) + +-PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo ++PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inflate_chunk.lo inftrees.lo trees.lo zutil.lo + PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo + PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG) + +@@ -163,16 +163,22 @@ crc32.o: $(SRCDIR)crc32.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)crc32.c + + deflate.o: $(SRCDIR)deflate.c +- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)deflate.c + + infback.o: $(SRCDIR)infback.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)infback.c + + inffast.o: $(SRCDIR)inffast.c +- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inffast.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)inffast.c + +-inflate.o: $(SRCDIR)inflate.c +- $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inflate.c ++arminffast.o: $(SRCDIR)contrib/arm/inffast_chunk.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)contrib/arm/inffast_chunk.c ++ ++inflate.o: $(SRCDIR)contrib/arm/inflate.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)contrib/arm/inflate.c ++ ++inflate_chunk.o: $(SRCDIR)contrib/arm/inffast_chunk.c ++ $(CC) $(CFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -c -o $@ $(SRCDIR)contrib/arm/inffast_chunk.c + + inftrees.o: $(SRCDIR)inftrees.c + $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)inftrees.c +@@ -214,7 +220,7 @@ crc32.lo: $(SRCDIR)crc32.c + + deflate.lo: $(SRCDIR)deflate.c + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/deflate.o $(SRCDIR)deflate.c + -@mv objs/deflate.o $@ + + infback.lo: $(SRCDIR)infback.c +@@ -222,16 +228,27 @@ infback.lo: $(SRCDIR)infback.c + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/infback.o $(SRCDIR)infback.c + -@mv objs/infback.o $@ + ++arminffast.lo: $(SRCDIR)contrib/arm/inffast_chunk.c $(SRCDIR)inffast.c ++ -@mkdir objs 2>/dev/null || test -d objs ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/arminffast.o $(SRCDIR)contrib/arm/inffast_chunk.c ++ -@mv objs/arminffast.o $@ ++ + inffast.lo: $(SRCDIR)inffast.c + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/inffast.o $(SRCDIR)inffast.c + -@mv objs/inffast.o $@ + +-inflate.lo: $(SRCDIR)inflate.c ++inflate.lo: $(SRCDIR)contrib/arm/inflate.c + -@mkdir objs 2>/dev/null || test -d objs +- $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inflate.o $(SRCDIR)inflate.c ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/inflate.o $(SRCDIR)contrib/arm/inflate.c + -@mv objs/inflate.o $@ + ++inflate_chunk.lo: $(SRCDIR)contrib/arm/inffast_chunk.c ++ -@mkdir objs 2>/dev/null || test -d objs ++ $(CC) $(SFLAGS) $(ZINC) -I$(SRCDIR) -I$(SRCDIR)contrib/arm -DPIC -c -o objs/inflate_chunk.o $(SRCDIR)contrib/arm/inffast_chunk.c ++ -@mv objs/inflate_chunk.o $@ ++ ++ + inftrees.lo: $(SRCDIR)inftrees.c + -@mkdir objs 2>/dev/null || test -d objs + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/inftrees.o $(SRCDIR)inftrees.c +diff --git a/configure b/configure +index e974d1f..0c5f837 100755 +--- a/configure ++++ b/configure +@@ -23,7 +23,7 @@ SRCDIR=`dirname $0` + if test $SRCDIR = "."; then + ZINC="" + ZINCOUT="-I." +- SRCDIR="" ++ SRCDIR="./" + else + ZINC='-include zconf.h' + ZINCOUT='-I. -I$(SRCDIR)' +diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c +index 44e88a9..0517930 100644 +--- a/contrib/minizip/zip.c ++++ b/contrib/minizip/zip.c +@@ -519,15 +519,17 @@ local ZPOS64_T zip64local_SearchCentralDir(const zlib_filefunc64_32_def* pzlib_f + break; + + for (i=(int)uReadSize-3; (i--)>0;) ++ { + if (((*(buf+i))==0x50) && ((*(buf+i+1))==0x4b) && + ((*(buf+i+2))==0x05) && ((*(buf+i+3))==0x06)) + { + uPosFound = uReadPos+i; + break; + } ++ } + +- if (uPosFound!=0) +- break; ++ if (uPosFound!=0) ++ break; + } + TRYFREE(buf); + return uPosFound; +-- +2.14.3 + diff --git a/zlib.spec b/zlib.spec index 0e67f2b..9087e98 100644 --- a/zlib.spec +++ b/zlib.spec @@ -12,6 +12,12 @@ Source:
http://www.zlib.net/zlib-%{version}.tar.xz
Patch0: zlib-1.2.5-minizip-fixuncrypt.patch # resolves: #805113 Patch1: zlib-1.2.11-optimized-s390.patch +# general aarch64 optimizations +Patch2: 0001-Porting-inflate-using-wider-loads-and-stores.patch +Patch3: 0002-Port-Fix-InflateBack-corner-case.patch +Patch4: 0001-Neon-Optimized-hash-chain-rebase.patch +Patch5: 0002-Porting-optimized-longest_match.patch +Patch6: 0003-arm64-specific-build-patch.patch BuildRequires: automake, autoconf, libtool @@ -64,6 +70,14 @@ developing applications which use minizip. %ifarch s390 s390x %patch1 -p1 -b .optimized-deflate %endif +%ifarch aarch64 +%patch2 -p1 -b .optimize-aarch64 +%patch3 -p1 -b .optimize-aarch64 +%patch4 -p1 -b .optimize-aarch64 +%patch5 -p1 -b .optimize-aarch64 +%patch6 -p1 -b .optimize-aarch64 +%endif + iconv -f iso-8859-2 -t utf-8 < ChangeLog > ChangeLog.tmp mv ChangeLog.tmp ChangeLog @@ -73,6 +87,10 @@ export CFLAGS="$RPM_OPT_FLAGS" %ifarch ppc64 CFLAGS+=" -O3" %endif +%ifarch aarch64 +CFLAGS+=" -DARM_NEON -O3" +%endif + export LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now" ./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} make %{?_smp_mflags}
1
0
0
0
Architecture specific change in rpms/nodejs-async-arrays.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/nodejs-async-arrays.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/nodejs-async-arrays.git/commit/?id=…
. Change: +ExclusiveArch: %{nodejs_arches} noarch Thanks. Full change: ============ commit 77b8307a769d322b9466890893e3f0a1f419b9c5 Author: Jared Smith <jsmith(a)fedoraproject.org> Date: Mon Apr 30 12:21:12 2018 -0400 Initial packaging diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..63930f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/async-arrays-1.0.1.tgz diff --git a/README.md b/README.md deleted file mode 100644 index 6328c6f..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nodejs-async-arrays - -'Async control for arrays' \ No newline at end of file diff --git a/nodejs-async-arrays.spec b/nodejs-async-arrays.spec new file mode 100644 index 0000000..ed40dd7 --- /dev/null +++ b/nodejs-async-arrays.spec @@ -0,0 +1,61 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename async-arrays +%global enable_tests 1 + +Name: nodejs-async-arrays +Version: 1.0.1 +Release: 1%{?dist} +Summary: Async control for arrays + +License: MIT +URL:
https://github.com/khrome/async-arrays.git
+Source0:
https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
+ + +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: nodejs-packaging +BuildRequires: npm(sift) + +%if 0%{?enable_tests} +BuildRequires: mocha +BuildRequires: npm(should) +%endif + +%description +Async control for arrays + + +%prep +%autosetup -n package + + +%build +# nothing to do + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json %{packagename}.js \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +NODE_ENV=test %{_bindir}/mocha -R spec +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc *.md +%license LICENSE +%{nodejs_sitelib}/%{packagename} + +%changelog +* Mon Apr 23 2018 Jared K. Smith <jsmith(a)fedoraproject.org> - 1.0.1-1 +- Initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..53554c9 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (async-arrays-1.0.1.tgz) = c45c0b86cb288bc3258797d2308658378804c61e798afcb7c2f76438bdb9a63903a44571e4c17221ce323b384d4bb14478156734437770ea56d34ecb0d760ce3
1
0
0
0
Architecture specific change in rpms/nodejs-extended-emitter.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/nodejs-extended-emitter.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/nodejs-extended-emitter.git/commit/…
. Change: +ExclusiveArch: %{nodejs_arches} noarch Thanks. Full change: ============ commit cd069603c33ae5bd196476442e2b1e60d44c69f6 Author: Jared Smith <jsmith(a)fedoraproject.org> Date: Mon Apr 30 12:14:06 2018 -0400 Initial packaging diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ec90d56 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/extended-emitter-1.0.2.tgz diff --git a/README.md b/README.md deleted file mode 100644 index ad32bce..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nodejs-extended-emitter - -'An emitter with expanded utility, UMD with dependencies for node and the browser' \ No newline at end of file diff --git a/nodejs-extended-emitter.spec b/nodejs-extended-emitter.spec new file mode 100644 index 0000000..446fbf6 --- /dev/null +++ b/nodejs-extended-emitter.spec @@ -0,0 +1,63 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename extended-emitter +%global enable_tests 1 + +Name: nodejs-extended-emitter +Version: 1.0.2 +Release: 1%{?dist} +Summary: An emitter with expanded utility, UMD with dependencies for node and the browser + +License: MIT +URL:
https://github.com/khrome/extended-emitter.git
+Source0:
https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
+ + +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: nodejs-packaging +BuildRequires: npm(sift) +BuildRequires: npm(wolfy87-eventemitter) + +%if 0%{?enable_tests} +BuildRequires: mocha +BuildRequires: npm(should) +BuildRequires: npm(vow) +%endif + +%description +An emitter with expanded utility, UMD with dependencies for node and the browser + + +%prep +%autosetup -n package + + +%build +# nothing to do + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json %{packagename}.js \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +NODE_ENV=test %{_bindir}/mocha -R spec +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc *.md +%license LICENSE +%{nodejs_sitelib}/%{packagename} + +%changelog +* Mon Apr 23 2018 Jared K. Smith <jsmith(a)fedoraproject.org> - 1.0.2-1 +- Initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..1c18802 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (extended-emitter-1.0.2.tgz) = 09cec9fb49f5f024cef66f03647f15e8836ad8b4f0421d4785c1bd15e188f24154d5d5412977492db4761b91c33d167bf4a0fb3e6b331590f9a44bf3611af898
1
0
0
0
Architecture specific change in rpms/nodejs-wolfy87-eventemitter.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/nodejs-wolfy87-eventemitter.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/nodejs-wolfy87-eventemitter.git/com…
. Change: +ExclusiveArch: %{nodejs_arches} noarch Thanks. Full change: ============ commit 274255f5aabbf1cea1c65a6b5b9b0d76c1e457b4 Author: Jared Smith <jsmith(a)fedoraproject.org> Date: Mon Apr 30 12:07:22 2018 -0400 Initial packaging diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..72cd027 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/wolfy87-eventemitter-5.2.4.tgz diff --git a/README.md b/README.md deleted file mode 100644 index b18f7e7..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nodejs-wolfy87-eventemitter - -'Event based JavaScript for the browser' \ No newline at end of file diff --git a/nodejs-wolfy87-eventemitter.spec b/nodejs-wolfy87-eventemitter.spec new file mode 100644 index 0000000..c921b64 --- /dev/null +++ b/nodejs-wolfy87-eventemitter.spec @@ -0,0 +1,60 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename wolfy87-eventemitter +%global enable_tests 0 + +Name: nodejs-wolfy87-eventemitter +Version: 5.2.4 +Release: 1%{?dist} +Summary: Event based JavaScript for the browser + +License: Unlicense +URL:
https://github.com/Olical/EventEmitter.git
+Source0:
https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
+ + +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: nodejs-packaging + +%if 0%{?enable_tests} +BuildRequires: mocha +BuildRequires: npm(chai) +%endif + +%description +Event based JavaScript for the browser + + +%prep +%autosetup -n package + + +%build +# nothing to do + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json *.js \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +NODE_ENV=test %{_bindir}/mocha -R spec +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc *.md docs/ +%license UNLICENSE +%{nodejs_sitelib}/%{packagename} + +%changelog +* Mon Apr 23 2018 Jared K. Smith <jsmith(a)fedoraproject.org> - 5.2.4-1 +- Initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..798b42e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (wolfy87-eventemitter-5.2.4.tgz) = c94394488cd9c6a05ebba55d9e282a607c308f2e4ddc2457e5748787f61c569cbe42cc7e1e41da11676677202bdcdbf20580eb68e6b911f3486eee3b4f943320
1
0
0
0
Architecture specific change in rpms/nqp.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/nqp.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/nqp.git/commit/?id=eb0e62e17ff0cd0c…
. Change: -%ifarch %{ix86} Thanks. Full change: ============ commit eb0e62e17ff0cd0ca745d43e0cd5960517ebea12 Author: gerd <gp(a)zimt.uni-siegen.de> Date: Mon Apr 30 18:03:33 2018 +0200 update to 2018.04.1 diff --git a/.gitignore b/.gitignore index f86b9bf..098afe4 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ /nqp-2018.02.tar.gz /nqp-2018.03.tar.gz /nqp-2018.04.tar.gz +/nqp-2018.04.1.tar.gz diff --git a/nqp.spec b/nqp.spec index 96be03c..46bc8bf 100644 --- a/nqp.spec +++ b/nqp.spec @@ -2,7 +2,7 @@ %global year 2018 -%global month 04 +%global month 04.1 Name: nqp @@ -12,7 +12,7 @@ Summary: Not Quite Perl (6) License: Artistic 2.0 and ISC and WTFPL URL:
https://github.com/perl6/nqp
-Source0:
http://rakudo.org/downloads/nqp/nqp-%{year}.%{month}.tar.gz
+Source0:
http://rakudo.org/dl/nqp/nqp-%{year}.%{month}.tar.gz
BuildRequires: perl(Test::Harness) BuildRequires: perl(ExtUtils::Command) @@ -86,10 +86,6 @@ ln -s %{_libdir}/nqp/profiler/template.html $RPM_BUILD_ROOT%{_datadir}/nqp/lib/p %check # fails at prove -r --exec "./nqp-m" ... -%ifarch %{ix86} -rm -f t/hll/06-sprintf.t -%endif - %{?!_without_tests: make test} @@ -107,6 +103,10 @@ rm -f t/hll/06-sprintf.t %changelog +* Mon Apr 30 2018 Gerd Pokorra <gp(a)zimt.uni-siegen.de> 0.0.2018.04.1-1 +- follow the change of the source URL from upstream +- all tests passes + * Wed Apr 25 2018 Gerd Pokorra <gp(a)zimt.uni-siegen.de> 0.0.2018.04-1 - nqp builds again on all primary architectures - add BuildRequires for perl-Digest-SHA diff --git a/sources b/sources index 884554f..2676ae0 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (nqp-2018.04.tar.gz) = 9ab122cfa2f34f0f07ede8a8de9da7dc8f26a8069816d80a2ea00a2091e09e15042eb3385776da306dcdc4047846d9f802a33fa98032463532e0a6d1894edfe6 +SHA512 (nqp-2018.04.1.tar.gz) = efd85822af091c5aebdfcdd60731f1830f6eb9c449d4c362392c087c3f1dd198a98d66061723db047440988e563d8931894f8ee285d2207c6d7d88bd9fb62be4
1
0
0
0
Architecture specific change in rpms/nodejs-sift.git
by githook-noreply@fedoraproject.org
30 Apr '18
30 Apr '18
The package rpms/nodejs-sift.git has added or updated architecture specific content in its spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/nodejs-sift.git/commit/?id=e3f325e9…
. Change: +ExclusiveArch: %{nodejs_arches} noarch Thanks. Full change: ============ commit e3f325e9aec1c7f951dc02bdf06245393990e0fe Author: Jared Smith <jsmith(a)fedoraproject.org> Date: Mon Apr 30 11:54:33 2018 -0400 Initial packaging diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..89ca748 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/sift-5.1.0.tgz diff --git a/README.md b/README.md deleted file mode 100644 index b9aad3b..0000000 --- a/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# nodejs-sift - -'Function for mongodb query style array filtering' \ No newline at end of file diff --git a/nodejs-sift.spec b/nodejs-sift.spec new file mode 100644 index 0000000..50299f3 --- /dev/null +++ b/nodejs-sift.spec @@ -0,0 +1,63 @@ +%{?nodejs_find_provides_and_requires} + +%global packagename sift +%global enable_tests 1 + +Name: nodejs-sift +Version: 5.1.0 +Release: 1%{?dist} +Summary: Function for mongodb query style array filtering + +License: MIT +URL:
https://github.com/crcn/sift.js.git
+Source0:
https://registry.npmjs.org/%{packagename}/-/%{packagename}-%{version}.tgz
+ + +BuildArch: noarch +ExclusiveArch: %{nodejs_arches} noarch + +BuildRequires: nodejs-packaging + +%if 0%{?enable_tests} +BuildRequires: mocha +BuildRequires: npm(bson) +BuildRequires: npm(immutable) +%endif + +%description +Function for mongodb query style array filtering + + +%prep +%autosetup -n package + +chmod -x README.md + + +%build +# nothing to do + +%install +mkdir -p %{buildroot}%{nodejs_sitelib}/%{packagename} +cp -pr package.json sift*.js \ + %{buildroot}%{nodejs_sitelib}/%{packagename} + +%nodejs_symlink_deps + +%check +%nodejs_symlink_deps --check +%{__nodejs} -e 'require("./")' +%if 0%{?enable_tests} +NODE_ENV=test %{_bindir}/mocha -R spec +%else +%{_bindir}/echo -e "\e[101m -=#=- Tests disabled -=#=- \e[0m" +%endif + +%files +%doc *.md +%license MIT-LICENSE.txt +%{nodejs_sitelib}/%{packagename} + +%changelog +* Mon Apr 23 2018 Jared K. Smith <jsmith(a)fedoraproject.org> - 5.1.0-1 +- Initial packaging diff --git a/sources b/sources new file mode 100644 index 0000000..36fc5b9 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (sift-5.1.0.tgz) = b503956f467ca49679d1005a2c8ff2471188e296958a7107701c5edab6d5dc89bc6dbb1ae3bc63ea5b963f0d9e906c21aecbb2cc409b432bb5a65b4095fb33f6
1
0
0
0
← Newer
1
2
3
4
...
24
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Results per page:
10
25
50
100
200