Upgrade xz from 5.2.2 to 5.2.4 on the vendor branch. vendor/XZ
authorzrj <rimvydas.jasinskas@gmail.com>
Sun, 14 Apr 2019 15:58:31 +0000 (18:58 +0300)
committerzrj <zrj@dragonflybsd.org>
Wed, 24 Apr 2019 16:37:33 +0000 (19:37 +0300)
Remove not needed sources.

73 files changed:
contrib/xz/COPYING
contrib/xz/COPYING.GPLv3 [deleted file]
contrib/xz/COPYING.LGPLv2.1 [deleted file]
contrib/xz/NEWS
contrib/xz/README
contrib/xz/src/common/tuklib_cpucores.c
contrib/xz/src/common/tuklib_integer.h
contrib/xz/src/common/tuklib_physmem.c
contrib/xz/src/liblzma/api/lzma.h
contrib/xz/src/liblzma/api/lzma/base.h
contrib/xz/src/liblzma/api/lzma/container.h
contrib/xz/src/liblzma/api/lzma/index.h
contrib/xz/src/liblzma/api/lzma/version.h
contrib/xz/src/liblzma/check/check.h
contrib/xz/src/liblzma/check/crc32_small.c [deleted file]
contrib/xz/src/liblzma/check/crc32_table_be.h [deleted file]
contrib/xz/src/liblzma/check/crc32_tablegen.c [deleted file]
contrib/xz/src/liblzma/check/crc32_x86.S [deleted file]
contrib/xz/src/liblzma/check/crc64_small.c [deleted file]
contrib/xz/src/liblzma/check/crc64_table_be.h [deleted file]
contrib/xz/src/liblzma/check/crc64_tablegen.c [deleted file]
contrib/xz/src/liblzma/check/crc64_x86.S [deleted file]
contrib/xz/src/liblzma/common/alone_decoder.c
contrib/xz/src/liblzma/common/alone_encoder.c
contrib/xz/src/liblzma/common/auto_decoder.c
contrib/xz/src/liblzma/common/block_decoder.c
contrib/xz/src/liblzma/common/block_encoder.c
contrib/xz/src/liblzma/common/common.c
contrib/xz/src/liblzma/common/common.h
contrib/xz/src/liblzma/common/index.c
contrib/xz/src/liblzma/common/index_decoder.c
contrib/xz/src/liblzma/common/index_encoder.c
contrib/xz/src/liblzma/common/stream_decoder.c
contrib/xz/src/liblzma/common/stream_encoder.c
contrib/xz/src/liblzma/common/stream_encoder_mt.c
contrib/xz/src/liblzma/delta/delta_common.c
contrib/xz/src/liblzma/delta/delta_decoder.c
contrib/xz/src/liblzma/delta/delta_encoder.c
contrib/xz/src/liblzma/delta/delta_private.h
contrib/xz/src/liblzma/lz/lz_decoder.c
contrib/xz/src/liblzma/lz/lz_decoder.h
contrib/xz/src/liblzma/lz/lz_encoder.c
contrib/xz/src/liblzma/lz/lz_encoder.h
contrib/xz/src/liblzma/lz/lz_encoder_hash_table.h [deleted file]
contrib/xz/src/liblzma/lzma/fastpos_tablegen.c [deleted file]
contrib/xz/src/liblzma/lzma/lzma2_decoder.c
contrib/xz/src/liblzma/lzma/lzma2_encoder.c
contrib/xz/src/liblzma/lzma/lzma_decoder.c
contrib/xz/src/liblzma/lzma/lzma_encoder.c
contrib/xz/src/liblzma/lzma/lzma_encoder.h
contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_fast.c
contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c
contrib/xz/src/liblzma/lzma/lzma_encoder_presets.c
contrib/xz/src/liblzma/lzma/lzma_encoder_private.h
contrib/xz/src/liblzma/rangecoder/price_tablegen.c [deleted file]
contrib/xz/src/liblzma/rangecoder/range_common.h
contrib/xz/src/liblzma/simple/arm.c
contrib/xz/src/liblzma/simple/armthumb.c
contrib/xz/src/liblzma/simple/ia64.c
contrib/xz/src/liblzma/simple/powerpc.c
contrib/xz/src/liblzma/simple/simple_coder.c
contrib/xz/src/liblzma/simple/simple_private.h
contrib/xz/src/liblzma/simple/sparc.c
contrib/xz/src/liblzma/simple/x86.c
contrib/xz/src/xz/args.c
contrib/xz/src/xz/coder.c
contrib/xz/src/xz/file_io.c
contrib/xz/src/xz/file_io.h
contrib/xz/src/xz/list.c
contrib/xz/src/xz/main.c
contrib/xz/src/xz/private.h
contrib/xz/src/xz/xz.1
contrib/xz/src/xzdec/xzdec.1

index 43c90d0..20e60d5 100644 (file)
@@ -47,7 +47,7 @@ XZ Utils Licensing
     naturally it is not legally required. Here is an example of a good
     notice to put into "about box" or into documentation:
 
-        This software includes code from XZ Utils <http://tukaani.org/xz/>.
+        This software includes code from XZ Utils <https://tukaani.org/xz/>.
 
     The following license texts are included in the following files:
       - COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
diff --git a/contrib/xz/COPYING.GPLv3 b/contrib/xz/COPYING.GPLv3
deleted file mode 100644 (file)
index 94a9ed0..0000000
+++ /dev/null
@@ -1,674 +0,0 @@
-                    GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    <program>  Copyright (C) <year>  <name of author>
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/contrib/xz/COPYING.LGPLv2.1 b/contrib/xz/COPYING.LGPLv2.1
deleted file mode 100644 (file)
index 4362b49..0000000
+++ /dev/null
@@ -1,502 +0,0 @@
-                  GNU LESSER GENERAL PUBLIC LICENSE
-                       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                            Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
-                  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-\f
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                            NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-                     END OF TERMS AND CONDITIONS
-\f
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
index 24166e4..f2a1ad3 100644 (file)
@@ -2,6 +2,72 @@
 XZ Utils Release Notes
 ======================
 
+5.2.4 (2018-04-29)
+
+    * liblzma:
+
+        - Allow 0 as memory usage limit instead of returning
+          LZMA_PROG_ERROR. Now 0 is treated as if 1 byte was specified,
+          which effectively is the same as 0.
+
+        - Use "noexcept" keyword instead of "throw()" in the public
+          headers when a C++11 (or newer standard) compiler is used.
+
+        - Added a portability fix for recent Intel C Compilers.
+
+        - Microsoft Visual Studio build files have been moved under
+          windows/vs2013 and windows/vs2017.
+
+    * xz:
+
+        - Fix "xz --list --robot missing_or_bad_file.xz" which would
+          try to print an unitialized string and thus produce garbage
+          output. Since the exit status is non-zero, most uses of such
+          a command won't try to interpret the garbage output.
+
+        - "xz --list foo.xz" could print "Internal error (bug)" in a
+          corner case where a specific memory usage limit had been set.
+
+
+5.2.3 (2016-12-30)
+
+    * xz:
+
+        - Always close a file before trying to delete it to avoid
+          problems on some operating system and file system combinations.
+
+        - Fixed copying of file timestamps on Windows.
+
+        - Added experimental (disabled by default) sandbox support using
+          Capsicum (FreeBSD >= 10). See --enable-sandbox in INSTALL.
+
+    * C99/C11 conformance fixes to liblzma. The issues affected at least
+      some builds using link-time optimizations.
+
+    * Fixed bugs in the rarely-used function lzma_index_dup().
+
+    * Use of external SHA-256 code is now disabled by default.
+      It can still be enabled by passing --enable-external-sha256
+      to configure. The reasons to disable it by default (see INSTALL
+      for more details):
+
+        - Some OS-specific SHA-256 implementations conflict with
+          OpenSSL and cause problems in programs that link against both
+          liblzma and libcrypto. At least FreeBSD 10 and MINIX 3.3.0
+          are affected.
+
+        - The internal SHA-256 is faster than the SHA-256 code in
+          some operating systems.
+
+    * Changed CPU core count detection to use sched_getaffinity() on
+      GNU/Linux and GNU/kFreeBSD.
+
+    * Fixes to the build-system and xz to make xz buildable even when
+      encoders, decoders, or threading have been disabled from libilzma
+      using configure options. These fixes added two new #defines to
+      config.h: HAVE_ENCODERS and HAVE_DECODERS.
+
+
 5.2.2 (2015-09-29)
 
     * Fixed bugs in QNX-specific code.
index ab8aadf..720a1a5 100644 (file)
@@ -291,7 +291,7 @@ XZ Utils
     XZ Embedded is a limited implementation written for use in the Linux
     kernel, but it is also suitable for other embedded use.
 
-        http://tukaani.org/xz/embedded.html
+        https://tukaani.org/xz/embedded.html
 
 
 6. Contact information
index e235fd1..c16e188 100644 (file)
 #      endif
 #      include <windows.h>
 
+// glibc >= 2.9
+#elif defined(TUKLIB_CPUCORES_SCHED_GETAFFINITY)
+#      include <sched.h>
+
 // FreeBSD
 #elif defined(TUKLIB_CPUCORES_CPUSET)
 #      include <sys/param.h>
@@ -49,6 +53,11 @@ tuklib_cpucores(void)
        GetSystemInfo(&sysinfo);
        ret = sysinfo.dwNumberOfProcessors;
 
+#elif defined(TUKLIB_CPUCORES_SCHED_GETAFFINITY)
+       cpu_set_t cpu_mask;
+       if (sched_getaffinity(0, sizeof(cpu_mask), &cpu_mask) == 0)
+               ret = CPU_COUNT(&cpu_mask);
+
 #elif defined(TUKLIB_CPUCORES_CPUSET)
        cpuset_t set;
        if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
index a7fda67..b1e84d5 100644 (file)
 #endif
 
 
+////////////////////////////////
+// Compiler-specific features //
+////////////////////////////////
+
+// Newer Intel C compilers require immintrin.h for _bit_scan_reverse()
+// and such functions.
+#if defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1500)
+#      include <immintrin.h>
+#endif
+
+
 ///////////////////
 // Byte swapping //
 ///////////////////
index cd2437d..4053ad0 100644 (file)
@@ -86,7 +86,8 @@ tuklib_physmem(void)
                // GlobalMemoryStatusEx() conditionally.
                HMODULE kernel32 = GetModuleHandle("kernel32.dll");
                if (kernel32 != NULL) {
-                       BOOL (WINAPI *gmse)(LPMEMORYSTATUSEX) = GetProcAddress(
+                       typedef BOOL (WINAPI *gmse_type)(LPMEMORYSTATUSEX);
+                       gmse_type gmse = (gmse_type)GetProcAddress(
                                        kernel32, "GlobalMemoryStatusEx");
                        if (gmse != NULL) {
                                MEMORYSTATUSEX meminfo;
index ce675a7..aa88e42 100644 (file)
  */
 #ifndef lzma_nothrow
 #      if defined(__cplusplus)
-#              define lzma_nothrow throw()
+#              if __cplusplus >= 201103L
+#                      define lzma_nothrow noexcept
+#              else
+#                      define lzma_nothrow throw()
+#              endif
 #      elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
 #              define lzma_nothrow __attribute__((__nothrow__))
 #      else
index 7a31a42..a6005ac 100644 (file)
@@ -644,11 +644,16 @@ extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
  * This function is supported only when *strm has been initialized with
  * a function that takes a memlimit argument.
  *
+ * liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes
+ * this function to do nothing (leaving the limit unchanged) and still
+ * return LZMA_OK. Later versions treat 0 as if 1 had been specified (so
+ * lzma_memlimit_get() will return 1 even if you specify 0 here).
+ *
  * \return      - LZMA_OK: New memory usage limit successfully set.
  *              - LZMA_MEMLIMIT_ERROR: The new limit is too small.
  *                The limit was not changed.
  *              - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
- *                support memory usage limit or memlimit was zero.
+ *                support memory usage limit.
  */
 extern LZMA_API(lzma_ret) lzma_memlimit_set(
                lzma_stream *strm, uint64_t memlimit) lzma_nothrow;
index 86991ad..9fbf4df 100644 (file)
@@ -520,7 +520,10 @@ extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
  *
  * \param       strm        Pointer to properly prepared lzma_stream
  * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
- *                          to effectively disable the limiter.
+ *                          to effectively disable the limiter. liblzma
+ *                          5.2.3 and earlier don't allow 0 here and return
+ *                          LZMA_PROG_ERROR; later versions treat 0 as if 1
+ *                          had been specified.
  * \param       flags       Bitwise-or of zero or more of the decoder flags:
  *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
  *                          LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
@@ -544,7 +547,10 @@ extern LZMA_API(lzma_ret) lzma_stream_decoder(
  *
  * \param       strm        Pointer to properly prepared lzma_stream
  * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
- *                          to effectively disable the limiter.
+ *                          to effectively disable the limiter. liblzma
+ *                          5.2.3 and earlier don't allow 0 here and return
+ *                          LZMA_PROG_ERROR; later versions treat 0 as if 1
+ *                          had been specified.
  * \param       flags       Bitwise-or of flags, or zero for no flags.
  *
  * \return      - LZMA_OK: Initialization was successful.
@@ -560,9 +566,16 @@ extern LZMA_API(lzma_ret) lzma_auto_decoder(
 /**
  * \brief       Initialize .lzma decoder (legacy file format)
  *
+ * \param       strm        Pointer to properly prepared lzma_stream
+ * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
+ *                          to effectively disable the limiter. liblzma
+ *                          5.2.3 and earlier don't allow 0 here and return
+ *                          LZMA_PROG_ERROR; later versions treat 0 as if 1
+ *                          had been specified.
+ *
  * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
- * There is no need to use LZMA_FINISH, but allowing it may simplify
- * certain types of applications.
+ * There is no need to use LZMA_FINISH, but it's allowed because it may
+ * simplify certain types of applications.
  *
  * \return      - LZMA_OK
  *              - LZMA_MEM_ERROR
index dda60ec..3dac6fb 100644 (file)
@@ -586,8 +586,7 @@ extern LZMA_API(lzma_index *) lzma_index_dup(
  * \param       i           Pointer to lzma_index which should be encoded.
  *
  * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
- * It is enough to use only one of them (you can choose freely; use LZMA_RUN
- * to support liblzma versions older than 5.0.0).
+ * It is enough to use only one of them (you can choose freely).
  *
  * \return      - LZMA_OK: Initialization succeeded, continue with lzma_code().
  *              - LZMA_MEM_ERROR
@@ -610,16 +609,21 @@ extern LZMA_API(lzma_ret) lzma_index_encoder(
  *                          to a new lzma_index, which the application
  *                          has to later free with lzma_index_end().
  * \param       memlimit    How much memory the resulting lzma_index is
- *                          allowed to require.
+ *                          allowed to require. liblzma 5.2.3 and earlier
+ *                          don't allow 0 here and return LZMA_PROG_ERROR;
+ *                          later versions treat 0 as if 1 had been specified.
  *
- * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
- * It is enough to use only one of them (you can choose freely; use LZMA_RUN
- * to support liblzma versions older than 5.0.0).
+ * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
+ * There is no need to use LZMA_FINISH, but it's allowed because it may
+ * simplify certain types of applications.
  *
  * \return      - LZMA_OK: Initialization succeeded, continue with lzma_code().
  *              - LZMA_MEM_ERROR
- *              - LZMA_MEMLIMIT_ERROR
  *              - LZMA_PROG_ERROR
+ *
+ *              liblzma 5.2.3 and older list also LZMA_MEMLIMIT_ERROR here
+ *              but that error code has never been possible from this
+ *              initialization function.
  */
 extern LZMA_API(lzma_ret) lzma_index_decoder(
                lzma_stream *strm, lzma_index **i, uint64_t memlimit)
index 8bdc7f0..143c7de 100644 (file)
@@ -22,7 +22,7 @@
  */
 #define LZMA_VERSION_MAJOR 5
 #define LZMA_VERSION_MINOR 2
-#define LZMA_VERSION_PATCH 2
+#define LZMA_VERSION_PATCH 4
 #define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
 
 #ifndef LZMA_VERSION_COMMIT
index 0f96f65..3007d88 100644 (file)
 
 #include "common.h"
 
-#if defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
+// If the function for external SHA-256 is missing, use the internal SHA-256
+// code. Due to how configure works, these defines can only get defined when
+// both a usable header and a type have already been found.
+#if !(defined(HAVE_CC_SHA256_INIT) \
+               || defined(HAVE_SHA256_INIT) \
+               || defined(HAVE_SHA256INIT))
+#      define HAVE_INTERNAL_SHA256 1
+#endif
+
+#if defined(HAVE_INTERNAL_SHA256)
+// Nothing
+#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
 #      include <CommonCrypto/CommonDigest.h>
 #elif defined(HAVE_SHA256_H)
 #      include <sys/types.h>
 #elif defined(HAVE_SHA2_H)
 #      include <sys/types.h>
 #      include <sha2.h>
-#elif defined(HAVE_MINIX_SHA2_H)
-#      include <sys/types.h>
-#      include <minix/sha2.h>
 #endif
 
-#if defined(HAVE_CC_SHA256_CTX)
-typedef CC_SHA256_CTX lzma_sha256_state;
-#elif defined(HAVE_SHA256_CTX)
-typedef SHA256_CTX lzma_sha256_state;
-#elif defined(HAVE_SHA2_CTX)
-typedef SHA2_CTX lzma_sha256_state;
-#else
+#if defined(HAVE_INTERNAL_SHA256)
 /// State for the internal SHA-256 implementation
 typedef struct {
        /// Internal state
@@ -43,9 +45,17 @@ typedef struct {
        /// Size of the message excluding padding
        uint64_t size;
 } lzma_sha256_state;
+#elif defined(HAVE_CC_SHA256_CTX)
+typedef CC_SHA256_CTX lzma_sha256_state;
+#elif defined(HAVE_SHA256_CTX)
+typedef SHA256_CTX lzma_sha256_state;
+#elif defined(HAVE_SHA2_CTX)
+typedef SHA2_CTX lzma_sha256_state;
 #endif
 
-#if defined(HAVE_CC_SHA256_INIT)
+#if defined(HAVE_INTERNAL_SHA256)
+// Nothing
+#elif defined(HAVE_CC_SHA256_INIT)
 #      define LZMA_SHA256FUNC(x) CC_SHA256_ ## x
 #elif defined(HAVE_SHA256_INIT)
 #      define LZMA_SHA256FUNC(x) SHA256_ ## x
diff --git a/contrib/xz/src/liblzma/check/crc32_small.c b/contrib/xz/src/liblzma/check/crc32_small.c
deleted file mode 100644 (file)
index 5f8a328..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file       crc32_small.c
-/// \brief      CRC32 calculation (size-optimized)
-//
-//  Author:     Lasse Collin
-//
-//  This file has been put into the public domain.
-//  You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include "check.h"
-
-
-uint32_t lzma_crc32_table[1][256];
-
-
-static void
-crc32_init(void)
-{
-       static const uint32_t poly32 = UINT32_C(0xEDB88320);
-
-       for (size_t b = 0; b < 256; ++b) {
-               uint32_t r = b;
-               for (size_t i = 0; i < 8; ++i) {
-                       if (r & 1)
-                               r = (r >> 1) ^ poly32;
-                       else
-                               r >>= 1;
-               }
-
-               lzma_crc32_table[0][b] = r;
-       }
-
-       return;
-}
-
-
-extern void
-lzma_crc32_init(void)
-{
-       mythread_once(crc32_init);
-       return;
-}
-
-
-extern LZMA_API(uint32_t)
-lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
-{
-       lzma_crc32_init();
-
-       crc = ~crc;
-
-       while (size != 0) {
-               crc = lzma_crc32_table[0][*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
-               --size;
-       }
-
-       return ~crc;
-}
diff --git a/contrib/xz/src/liblzma/check/crc32_table_be.h b/contrib/xz/src/liblzma/check/crc32_table_be.h
deleted file mode 100644 (file)
index c483cb6..0000000
+++ /dev/null
@@ -1,525 +0,0 @@
-/* This file has been automatically generated by crc32_tablegen.c. */
-
-const uint32_t lzma_crc32_table[8][256] = {
-       {
-               0x00000000, 0x96300777, 0x2C610EEE, 0xBA510999,
-               0x19C46D07, 0x8FF46A70, 0x35A563E9, 0xA395649E,
-               0x3288DB0E, 0xA4B8DC79, 0x1EE9D5E0, 0x88D9D297,
-               0x2B4CB609, 0xBD7CB17E, 0x072DB8E7, 0x911DBF90,
-               0x6410B71D, 0xF220B06A, 0x4871B9F3, 0xDE41BE84,
-               0x7DD4DA1A, 0xEBE4DD6D, 0x51B5D4F4, 0xC785D383,
-               0x56986C13, 0xC0A86B64, 0x7AF962FD, 0xECC9658A,
-               0x4F5C0114, 0xD96C0663, 0x633D0FFA, 0xF50D088D,
-               0xC8206E3B, 0x5E10694C, 0xE44160D5, 0x727167A2,
-               0xD1E4033C, 0x47D4044B, 0xFD850DD2, 0x6BB50AA5,
-               0xFAA8B535, 0x6C98B242, 0xD6C9BBDB, 0x40F9BCAC,
-               0xE36CD832, 0x755CDF45, 0xCF0DD6DC, 0x593DD1AB,
-               0xAC30D926, 0x3A00DE51, 0x8051D7C8, 0x1661D0BF,
-               0xB5F4B421, 0x23C4B356, 0x9995BACF, 0x0FA5BDB8,
-               0x9EB80228, 0x0888055F, 0xB2D90CC6, 0x24E90BB1,
-               0x877C6F2F, 0x114C6858, 0xAB1D61C1, 0x3D2D66B6,
-               0x9041DC76, 0x0671DB01, 0xBC20D298, 0x2A10D5EF,
-               0x8985B171, 0x1FB5B606, 0xA5E4BF9F, 0x33D4B8E8,
-               0xA2C90778, 0x34F9000F, 0x8EA80996, 0x18980EE1,
-               0xBB0D6A7F, 0x2D3D6D08, 0x976C6491, 0x015C63E6,
-               0xF4516B6B, 0x62616C1C, 0xD8306585, 0x4E0062F2,
-               0xED95066C, 0x7BA5011B, 0xC1F40882, 0x57C40FF5,
-               0xC6D9B065, 0x50E9B712, 0xEAB8BE8B, 0x7C88B9FC,
-               0xDF1DDD62, 0x492DDA15, 0xF37CD38C, 0x654CD4FB,
-               0x5861B24D, 0xCE51B53A, 0x7400BCA3, 0xE230BBD4,
-               0x41A5DF4A, 0xD795D83D, 0x6DC4D1A4, 0xFBF4D6D3,
-               0x6AE96943, 0xFCD96E34, 0x468867AD, 0xD0B860DA,
-               0x732D0444, 0xE51D0333, 0x5F4C0AAA, 0xC97C0DDD,
-               0x3C710550, 0xAA410227, 0x10100BBE, 0x86200CC9,
-               0x25B56857, 0xB3856F20, 0x09D466B9, 0x9FE461CE,
-               0x0EF9DE5E, 0x98C9D929, 0x2298D0B0, 0xB4A8D7C7,
-               0x173DB359, 0x810DB42E, 0x3B5CBDB7, 0xAD6CBAC0,
-               0x2083B8ED, 0xB6B3BF9A, 0x0CE2B603, 0x9AD2B174,
-               0x3947D5EA, 0xAF77D29D, 0x1526DB04, 0x8316DC73,
-               0x120B63E3, 0x843B6494, 0x3E6A6D0D, 0xA85A6A7A,
-               0x0BCF0EE4, 0x9DFF0993, 0x27AE000A, 0xB19E077D,
-               0x44930FF0, 0xD2A30887, 0x68F2011E, 0xFEC20669,
-               0x5D5762F7, 0xCB676580, 0x71366C19, 0xE7066B6E,
-               0x761BD4FE, 0xE02BD389, 0x5A7ADA10, 0xCC4ADD67,
-               0x6FDFB9F9, 0xF9EFBE8E, 0x43BEB717, 0xD58EB060,
-               0xE8A3D6D6, 0x7E93D1A1, 0xC4C2D838, 0x52F2DF4F,
-               0xF167BBD1, 0x6757BCA6, 0xDD06B53F, 0x4B36B248,
-               0xDA2B0DD8, 0x4C1B0AAF, 0xF64A0336, 0x607A0441,
-               0xC3EF60DF, 0x55DF67A8, 0xEF8E6E31, 0x79BE6946,
-               0x8CB361CB, 0x1A8366BC, 0xA0D26F25, 0x36E26852,
-               0x95770CCC, 0x03470BBB, 0xB9160222, 0x2F260555,
-               0xBE3BBAC5, 0x280BBDB2, 0x925AB42B, 0x046AB35C,
-               0xA7FFD7C2, 0x31CFD0B5, 0x8B9ED92C, 0x1DAEDE5B,
-               0xB0C2649B, 0x26F263EC, 0x9CA36A75, 0x0A936D02,
-               0xA906099C, 0x3F360EEB, 0x85670772, 0x13570005,
-               0x824ABF95, 0x147AB8E2, 0xAE2BB17B, 0x381BB60C,
-               0x9B8ED292, 0x0DBED5E5, 0xB7EFDC7C, 0x21DFDB0B,
-               0xD4D2D386, 0x42E2D4F1, 0xF8B3DD68, 0x6E83DA1F,
-               0xCD16BE81, 0x5B26B9F6, 0xE177B06F, 0x7747B718,
-               0xE65A0888, 0x706A0FFF, 0xCA3B0666, 0x5C0B0111,
-               0xFF9E658F, 0x69AE62F8, 0xD3FF6B61, 0x45CF6C16,
-               0x78E20AA0, 0xEED20DD7, 0x5483044E, 0xC2B30339,
-               0x612667A7, 0xF71660D0, 0x4D476949, 0xDB776E3E,
-               0x4A6AD1AE, 0xDC5AD6D9, 0x660BDF40, 0xF03BD837,
-               0x53AEBCA9, 0xC59EBBDE, 0x7FCFB247, 0xE9FFB530,
-               0x1CF2BDBD, 0x8AC2BACA, 0x3093B353, 0xA6A3B424,
-               0x0536D0BA, 0x9306D7CD, 0x2957DE54, 0xBF67D923,
-               0x2E7A66B3, 0xB84A61C4, 0x021B685D, 0x942B6F2A,
-               0x37BE0BB4, 0xA18E0CC3, 0x1BDF055A, 0x8DEF022D
-       }, {
-               0x00000000, 0x41311B19, 0x82623632, 0xC3532D2B,
-               0x04C56C64, 0x45F4777D, 0x86A75A56, 0xC796414F,
-               0x088AD9C8, 0x49BBC2D1, 0x8AE8EFFA, 0xCBD9F4E3,
-               0x0C4FB5AC, 0x4D7EAEB5, 0x8E2D839E, 0xCF1C9887,
-               0x5112C24A, 0x1023D953, 0xD370F478, 0x9241EF61,
-               0x55D7AE2E, 0x14E6B537, 0xD7B5981C, 0x96848305,
-               0x59981B82, 0x18A9009B, 0xDBFA2DB0, 0x9ACB36A9,
-               0x5D5D77E6, 0x1C6C6CFF, 0xDF3F41D4, 0x9E0E5ACD,
-               0xA2248495, 0xE3159F8C, 0x2046B2A7, 0x6177A9BE,
-               0xA6E1E8F1, 0xE7D0F3E8, 0x2483DEC3, 0x65B2C5DA,
-               0xAAAE5D5D, 0xEB9F4644, 0x28CC6B6F, 0x69FD7076,
-               0xAE6B3139, 0xEF5A2A20, 0x2C09070B, 0x6D381C12,
-               0xF33646DF, 0xB2075DC6, 0x715470ED, 0x30656BF4,
-               0xF7F32ABB, 0xB6C231A2, 0x75911C89, 0x34A00790,
-               0xFBBC9F17, 0xBA8D840E, 0x79DEA925, 0x38EFB23C,
-               0xFF79F373, 0xBE48E86A, 0x7D1BC541, 0x3C2ADE58,
-               0x054F79F0, 0x447E62E9, 0x872D4FC2, 0xC61C54DB,
-               0x018A1594, 0x40BB0E8D, 0x83E823A6, 0xC2D938BF,
-               0x0DC5A038, 0x4CF4BB21, 0x8FA7960A, 0xCE968D13,
-               0x0900CC5C, 0x4831D745, 0x8B62FA6E, 0xCA53E177,
-               0x545DBBBA, 0x156CA0A3, 0xD63F8D88, 0x970E9691,
-               0x5098D7DE, 0x11A9CCC7, 0xD2FAE1EC, 0x93CBFAF5,
-               0x5CD76272, 0x1DE6796B, 0xDEB55440, 0x9F844F59,
-               0x58120E16, 0x1923150F, 0xDA703824, 0x9B41233D,
-               0xA76BFD65, 0xE65AE67C, 0x2509CB57, 0x6438D04E,
-               0xA3AE9101, 0xE29F8A18, 0x21CCA733, 0x60FDBC2A,
-               0xAFE124AD, 0xEED03FB4, 0x2D83129F, 0x6CB20986,
-               0xAB2448C9, 0xEA1553D0, 0x29467EFB, 0x687765E2,
-               0xF6793F2F, 0xB7482436, 0x741B091D, 0x352A1204,
-               0xF2BC534B, 0xB38D4852, 0x70DE6579, 0x31EF7E60,
-               0xFEF3E6E7, 0xBFC2FDFE, 0x7C91D0D5, 0x3DA0CBCC,
-               0xFA368A83, 0xBB07919A, 0x7854BCB1, 0x3965A7A8,
-               0x4B98833B, 0x0AA99822, 0xC9FAB509, 0x88CBAE10,
-               0x4F5DEF5F, 0x0E6CF446, 0xCD3FD96D, 0x8C0EC274,
-               0x43125AF3, 0x022341EA, 0xC1706CC1, 0x804177D8,
-               0x47D73697, 0x06E62D8E, 0xC5B500A5, 0x84841BBC,
-               0x1A8A4171, 0x5BBB5A68, 0x98E87743, 0xD9D96C5A,
-               0x1E4F2D15, 0x5F7E360C, 0x9C2D1B27, 0xDD1C003E,
-               0x120098B9, 0x533183A0, 0x9062AE8B, 0xD153B592,
-               0x16C5F4DD, 0x57F4EFC4, 0x94A7C2EF, 0xD596D9F6,
-               0xE9BC07AE, 0xA88D1CB7, 0x6BDE319C, 0x2AEF2A85,
-               0xED796BCA, 0xAC4870D3, 0x6F1B5DF8, 0x2E2A46E1,
-               0xE136DE66, 0xA007C57F, 0x6354E854, 0x2265F34D,
-               0xE5F3B202, 0xA4C2A91B, 0x67918430, 0x26A09F29,
-               0xB8AEC5E4, 0xF99FDEFD, 0x3ACCF3D6, 0x7BFDE8CF,
-               0xBC6BA980, 0xFD5AB299, 0x3E099FB2, 0x7F3884AB,
-               0xB0241C2C, 0xF1150735, 0x32462A1E, 0x73773107,
-               0xB4E17048, 0xF5D06B51, 0x3683467A, 0x77B25D63,
-               0x4ED7FACB, 0x0FE6E1D2, 0xCCB5CCF9, 0x8D84D7E0,
-               0x4A1296AF, 0x0B238DB6, 0xC870A09D, 0x8941BB84,
-               0x465D2303, 0x076C381A, 0xC43F1531, 0x850E0E28,
-               0x42984F67, 0x03A9547E, 0xC0FA7955, 0x81CB624C,
-               0x1FC53881, 0x5EF42398, 0x9DA70EB3, 0xDC9615AA,
-               0x1B0054E5, 0x5A314FFC, 0x996262D7, 0xD85379CE,
-               0x174FE149, 0x567EFA50, 0x952DD77B, 0xD41CCC62,
-               0x138A8D2D, 0x52BB9634, 0x91E8BB1F, 0xD0D9A006,
-               0xECF37E5E, 0xADC26547, 0x6E91486C, 0x2FA05375,
-               0xE836123A, 0xA9070923, 0x6A542408, 0x2B653F11,
-               0xE479A796, 0xA548BC8F, 0x661B91A4, 0x272A8ABD,
-               0xE0BCCBF2, 0xA18DD0EB, 0x62DEFDC0, 0x23EFE6D9,
-               0xBDE1BC14, 0xFCD0A70D, 0x3F838A26, 0x7EB2913F,
-               0xB924D070, 0xF815CB69, 0x3B46E642, 0x7A77FD5B,
-               0xB56B65DC, 0xF45A7EC5, 0x370953EE, 0x763848F7,
-               0xB1AE09B8, 0xF09F12A1, 0x33CC3F8A, 0x72FD2493
-       }, {
-               0x00000000, 0x376AC201, 0x6ED48403, 0x59BE4602,
-               0xDCA80907, 0xEBC2CB06, 0xB27C8D04, 0x85164F05,
-               0xB851130E, 0x8F3BD10F, 0xD685970D, 0xE1EF550C,
-               0x64F91A09, 0x5393D808, 0x0A2D9E0A, 0x3D475C0B,
-               0x70A3261C, 0x47C9E41D, 0x1E77A21F, 0x291D601E,
-               0xAC0B2F1B, 0x9B61ED1A, 0xC2DFAB18, 0xF5B56919,
-               0xC8F23512, 0xFF98F713, 0xA626B111, 0x914C7310,
-               0x145A3C15, 0x2330FE14, 0x7A8EB816, 0x4DE47A17,
-               0xE0464D38, 0xD72C8F39, 0x8E92C93B, 0xB9F80B3A,
-               0x3CEE443F, 0x0B84863E, 0x523AC03C, 0x6550023D,
-               0x58175E36, 0x6F7D9C37, 0x36C3DA35, 0x01A91834,
-               0x84BF5731, 0xB3D59530, 0xEA6BD332, 0xDD011133,
-               0x90E56B24, 0xA78FA925, 0xFE31EF27, 0xC95B2D26,
-               0x4C4D6223, 0x7B27A022, 0x2299E620, 0x15F32421,
-               0x28B4782A, 0x1FDEBA2B, 0x4660FC29, 0x710A3E28,
-               0xF41C712D, 0xC376B32C, 0x9AC8F52E, 0xADA2372F,
-               0xC08D9A70, 0xF7E75871, 0xAE591E73, 0x9933DC72,
-               0x1C259377, 0x2B4F5176, 0x72F11774, 0x459BD575,
-               0x78DC897E, 0x4FB64B7F, 0x16080D7D, 0x2162CF7C,
-               0xA4748079, 0x931E4278, 0xCAA0047A, 0xFDCAC67B,
-               0xB02EBC6C, 0x87447E6D, 0xDEFA386F, 0xE990FA6E,
-               0x6C86B56B, 0x5BEC776A, 0x02523168, 0x3538F369,
-               0x087FAF62, 0x3F156D63, 0x66AB2B61, 0x51C1E960,
-               0xD4D7A665, 0xE3BD6464, 0xBA032266, 0x8D69E067,
-               0x20CBD748, 0x17A11549, 0x4E1F534B, 0x7975914A,
-               0xFC63DE4F, 0xCB091C4E, 0x92B75A4C, 0xA5DD984D,
-               0x989AC446, 0xAFF00647, 0xF64E4045, 0xC1248244,
-               0x4432CD41, 0x73580F40, 0x2AE64942, 0x1D8C8B43,
-               0x5068F154, 0x67023355, 0x3EBC7557, 0x09D6B756,
-               0x8CC0F853, 0xBBAA3A52, 0xE2147C50, 0xD57EBE51,
-               0xE839E25A, 0xDF53205B, 0x86ED6659, 0xB187A458,
-               0x3491EB5D, 0x03FB295C, 0x5A456F5E, 0x6D2FAD5F,
-               0x801B35E1, 0xB771F7E0, 0xEECFB1E2, 0xD9A573E3,
-               0x5CB33CE6, 0x6BD9FEE7, 0x3267B8E5, 0x050D7AE4,
-               0x384A26EF, 0x0F20E4EE, 0x569EA2EC, 0x61F460ED,
-               0xE4E22FE8, 0xD388EDE9, 0x8A36ABEB, 0xBD5C69EA,
-               0xF0B813FD, 0xC7D2D1FC, 0x9E6C97FE, 0xA90655FF,
-               0x2C101AFA, 0x1B7AD8FB, 0x42C49EF9, 0x75AE5CF8,
-               0x48E900F3, 0x7F83C2F2, 0x263D84F0, 0x115746F1,
-               0x944109F4, 0xA32BCBF5, 0xFA958DF7, 0xCDFF4FF6,
-               0x605D78D9, 0x5737BAD8, 0x0E89FCDA, 0x39E33EDB,
-               0xBCF571DE, 0x8B9FB3DF, 0xD221F5DD, 0xE54B37DC,
-               0xD80C6BD7, 0xEF66A9D6, 0xB6D8EFD4, 0x81B22DD5,
-               0x04A462D0, 0x33CEA0D1, 0x6A70E6D3, 0x5D1A24D2,
-               0x10FE5EC5, 0x27949CC4, 0x7E2ADAC6, 0x494018C7,
-               0xCC5657C2, 0xFB3C95C3, 0xA282D3C1, 0x95E811C0,
-               0xA8AF4DCB, 0x9FC58FCA, 0xC67BC9C8, 0xF1110BC9,
-               0x740744CC, 0x436D86CD, 0x1AD3C0CF, 0x2DB902CE,
-               0x4096AF91, 0x77FC6D90, 0x2E422B92, 0x1928E993,
-               0x9C3EA696, 0xAB546497, 0xF2EA2295, 0xC580E094,
-               0xF8C7BC9F, 0xCFAD7E9E, 0x9613389C, 0xA179FA9D,
-               0x246FB598, 0x13057799, 0x4ABB319B, 0x7DD1F39A,
-               0x3035898D, 0x075F4B8C, 0x5EE10D8E, 0x698BCF8F,
-               0xEC9D808A, 0xDBF7428B, 0x82490489, 0xB523C688,
-               0x88649A83, 0xBF0E5882, 0xE6B01E80, 0xD1DADC81,
-               0x54CC9384, 0x63A65185, 0x3A181787, 0x0D72D586,
-               0xA0D0E2A9, 0x97BA20A8, 0xCE0466AA, 0xF96EA4AB,
-               0x7C78EBAE, 0x4B1229AF, 0x12AC6FAD, 0x25C6ADAC,
-               0x1881F1A7, 0x2FEB33A6, 0x765575A4, 0x413FB7A5,
-               0xC429F8A0, 0xF3433AA1, 0xAAFD7CA3, 0x9D97BEA2,
-               0xD073C4B5, 0xE71906B4, 0xBEA740B6, 0x89CD82B7,
-               0x0CDBCDB2, 0x3BB10FB3, 0x620F49B1, 0x55658BB0,
-               0x6822D7BB, 0x5F4815BA, 0x06F653B8, 0x319C91B9,
-               0xB48ADEBC, 0x83E01CBD, 0xDA5E5ABF, 0xED3498BE
-       }, {
-               0x00000000, 0x6567BCB8, 0x8BC809AA, 0xEEAFB512,
-               0x5797628F, 0x32F0DE37, 0xDC5F6B25, 0xB938D79D,
-               0xEF28B4C5, 0x8A4F087D, 0x64E0BD6F, 0x018701D7,
-               0xB8BFD64A, 0xDDD86AF2, 0x3377DFE0, 0x56106358,
-               0x9F571950, 0xFA30A5E8, 0x149F10FA, 0x71F8AC42,
-               0xC8C07BDF, 0xADA7C767, 0x43087275, 0x266FCECD,
-               0x707FAD95, 0x1518112D, 0xFBB7A43F, 0x9ED01887,
-               0x27E8CF1A, 0x428F73A2, 0xAC20C6B0, 0xC9477A08,
-               0x3EAF32A0, 0x5BC88E18, 0xB5673B0A, 0xD00087B2,
-               0x6938502F, 0x0C5FEC97, 0xE2F05985, 0x8797E53D,
-               0xD1878665, 0xB4E03ADD, 0x5A4F8FCF, 0x3F283377,
-               0x8610E4EA, 0xE3775852, 0x0DD8ED40, 0x68BF51F8,
-               0xA1F82BF0, 0xC49F9748, 0x2A30225A, 0x4F579EE2,
-               0xF66F497F, 0x9308F5C7, 0x7DA740D5, 0x18C0FC6D,
-               0x4ED09F35, 0x2BB7238D, 0xC518969F, 0xA07F2A27,
-               0x1947FDBA, 0x7C204102, 0x928FF410, 0xF7E848A8,
-               0x3D58149B, 0x583FA823, 0xB6901D31, 0xD3F7A189,
-               0x6ACF7614, 0x0FA8CAAC, 0xE1077FBE, 0x8460C306,
-               0xD270A05E, 0xB7171CE6, 0x59B8A9F4, 0x3CDF154C,
-               0x85E7C2D1, 0xE0807E69, 0x0E2FCB7B, 0x6B4877C3,
-               0xA20F0DCB, 0xC768B173, 0x29C70461, 0x4CA0B8D9,
-               0xF5986F44, 0x90FFD3FC, 0x7E5066EE, 0x1B37DA56,
-               0x4D27B90E, 0x284005B6, 0xC6EFB0A4, 0xA3880C1C,
-               0x1AB0DB81, 0x7FD76739, 0x9178D22B, 0xF41F6E93,
-               0x03F7263B, 0x66909A83, 0x883F2F91, 0xED589329,
-               0x546044B4, 0x3107F80C, 0xDFA84D1E, 0xBACFF1A6,
-               0xECDF92FE, 0x89B82E46, 0x67179B54, 0x027027EC,
-               0xBB48F071, 0xDE2F4CC9, 0x3080F9DB, 0x55E74563,
-               0x9CA03F6B, 0xF9C783D3, 0x176836C1, 0x720F8A79,
-               0xCB375DE4, 0xAE50E15C, 0x40FF544E, 0x2598E8F6,
-               0x73888BAE, 0x16EF3716, 0xF8408204, 0x9D273EBC,
-               0x241FE921, 0x41785599, 0xAFD7E08B, 0xCAB05C33,
-               0x3BB659ED, 0x5ED1E555, 0xB07E5047, 0xD519ECFF,
-               0x6C213B62, 0x094687DA, 0xE7E932C8, 0x828E8E70,
-               0xD49EED28, 0xB1F95190, 0x5F56E482, 0x3A31583A,
-               0x83098FA7, 0xE66E331F, 0x08C1860D, 0x6DA63AB5,
-               0xA4E140BD, 0xC186FC05, 0x2F294917, 0x4A4EF5AF,
-               0xF3762232, 0x96119E8A, 0x78BE2B98, 0x1DD99720,
-               0x4BC9F478, 0x2EAE48C0, 0xC001FDD2, 0xA566416A,
-               0x1C5E96F7, 0x79392A4F, 0x97969F5D, 0xF2F123E5,
-               0x05196B4D, 0x607ED7F5, 0x8ED162E7, 0xEBB6DE5F,
-               0x528E09C2, 0x37E9B57A, 0xD9460068, 0xBC21BCD0,
-               0xEA31DF88, 0x8F566330, 0x61F9D622, 0x049E6A9A,
-               0xBDA6BD07, 0xD8C101BF, 0x366EB4AD, 0x53090815,
-               0x9A4E721D, 0xFF29CEA5, 0x11867BB7, 0x74E1C70F,
-               0xCDD91092, 0xA8BEAC2A, 0x46111938, 0x2376A580,
-               0x7566C6D8, 0x10017A60, 0xFEAECF72, 0x9BC973CA,
-               0x22F1A457, 0x479618EF, 0xA939ADFD, 0xCC5E1145,
-               0x06EE4D76, 0x6389F1CE, 0x8D2644DC, 0xE841F864,
-               0x51792FF9, 0x341E9341, 0xDAB12653, 0xBFD69AEB,
-               0xE9C6F9B3, 0x8CA1450B, 0x620EF019, 0x07694CA1,
-               0xBE519B3C, 0xDB362784, 0x35999296, 0x50FE2E2E,
-               0x99B95426, 0xFCDEE89E, 0x12715D8C, 0x7716E134,
-               0xCE2E36A9, 0xAB498A11, 0x45E63F03, 0x208183BB,
-               0x7691E0E3, 0x13F65C5B, 0xFD59E949, 0x983E55F1,
-               0x2106826C, 0x44613ED4, 0xAACE8BC6, 0xCFA9377E,
-               0x38417FD6, 0x5D26C36E, 0xB389767C, 0xD6EECAC4,
-               0x6FD61D59, 0x0AB1A1E1, 0xE41E14F3, 0x8179A84B,
-               0xD769CB13, 0xB20E77AB, 0x5CA1C2B9, 0x39C67E01,
-               0x80FEA99C, 0xE5991524, 0x0B36A036, 0x6E511C8E,
-               0xA7166686, 0xC271DA3E, 0x2CDE6F2C, 0x49B9D394,
-               0xF0810409, 0x95E6B8B1, 0x7B490DA3, 0x1E2EB11B,
-               0x483ED243, 0x2D596EFB, 0xC3F6DBE9, 0xA6916751,
-               0x1FA9B0CC, 0x7ACE0C74, 0x9461B966, 0xF10605DE
-       }, {
-               0x00000000, 0xB029603D, 0x6053C07A, 0xD07AA047,
-               0xC0A680F5, 0x708FE0C8, 0xA0F5408F, 0x10DC20B2,
-               0xC14B7030, 0x7162100D, 0xA118B04A, 0x1131D077,
-               0x01EDF0C5, 0xB1C490F8, 0x61BE30BF, 0xD1975082,
-               0x8297E060, 0x32BE805D, 0xE2C4201A, 0x52ED4027,
-               0x42316095, 0xF21800A8, 0x2262A0EF, 0x924BC0D2,
-               0x43DC9050, 0xF3F5F06D, 0x238F502A, 0x93A63017,
-               0x837A10A5, 0x33537098, 0xE329D0DF, 0x5300B0E2,
-               0x042FC1C1, 0xB406A1FC, 0x647C01BB, 0xD4556186,
-               0xC4894134, 0x74A02109, 0xA4DA814E, 0x14F3E173,
-               0xC564B1F1, 0x754DD1CC, 0xA537718B, 0x151E11B6,
-               0x05C23104, 0xB5EB5139, 0x6591F17E, 0xD5B89143,
-               0x86B821A1, 0x3691419C, 0xE6EBE1DB, 0x56C281E6,
-               0x461EA154, 0xF637C169, 0x264D612E, 0x96640113,
-               0x47F35191, 0xF7DA31AC, 0x27A091EB, 0x9789F1D6,
-               0x8755D164, 0x377CB159, 0xE706111E, 0x572F7123,
-               0x4958F358, 0xF9719365, 0x290B3322, 0x9922531F,
-               0x89FE73AD, 0x39D71390, 0xE9ADB3D7, 0x5984D3EA,
-               0x88138368, 0x383AE355, 0xE8404312, 0x5869232F,
-               0x48B5039D, 0xF89C63A0, 0x28E6C3E7, 0x98CFA3DA,
-               0xCBCF1338, 0x7BE67305, 0xAB9CD342, 0x1BB5B37F,
-               0x0B6993CD, 0xBB40F3F0, 0x6B3A53B7, 0xDB13338A,
-               0x0A846308, 0xBAAD0335, 0x6AD7A372, 0xDAFEC34F,
-               0xCA22E3FD, 0x7A0B83C0, 0xAA712387, 0x1A5843BA,
-               0x4D773299, 0xFD5E52A4, 0x2D24F2E3, 0x9D0D92DE,
-               0x8DD1B26C, 0x3DF8D251, 0xED827216, 0x5DAB122B,
-               0x8C3C42A9, 0x3C152294, 0xEC6F82D3, 0x5C46E2EE,
-               0x4C9AC25C, 0xFCB3A261, 0x2CC90226, 0x9CE0621B,
-               0xCFE0D2F9, 0x7FC9B2C4, 0xAFB31283, 0x1F9A72BE,
-               0x0F46520C, 0xBF6F3231, 0x6F159276, 0xDF3CF24B,
-               0x0EABA2C9, 0xBE82C2F4, 0x6EF862B3, 0xDED1028E,
-               0xCE0D223C, 0x7E244201, 0xAE5EE246, 0x1E77827B,
-               0x92B0E6B1, 0x2299868C, 0xF2E326CB, 0x42CA46F6,
-               0x52166644, 0xE23F0679, 0x3245A63E, 0x826CC603,
-               0x53FB9681, 0xE3D2F6BC, 0x33A856FB, 0x838136C6,
-               0x935D1674, 0x23747649, 0xF30ED60E, 0x4327B633,
-               0x102706D1, 0xA00E66EC, 0x7074C6AB, 0xC05DA696,
-               0xD0818624, 0x60A8E619, 0xB0D2465E, 0x00FB2663,
-               0xD16C76E1, 0x614516DC, 0xB13FB69B, 0x0116D6A6,
-               0x11CAF614, 0xA1E39629, 0x7199366E, 0xC1B05653,
-               0x969F2770, 0x26B6474D, 0xF6CCE70A, 0x46E58737,
-               0x5639A785, 0xE610C7B8, 0x366A67FF, 0x864307C2,
-               0x57D45740, 0xE7FD377D, 0x3787973A, 0x87AEF707,
-               0x9772D7B5, 0x275BB788, 0xF72117CF, 0x470877F2,
-               0x1408C710, 0xA421A72D, 0x745B076A, 0xC4726757,
-               0xD4AE47E5, 0x648727D8, 0xB4FD879F, 0x04D4E7A2,
-               0xD543B720, 0x656AD71D, 0xB510775A, 0x05391767,
-               0x15E537D5, 0xA5CC57E8, 0x75B6F7AF, 0xC59F9792,
-               0xDBE815E9, 0x6BC175D4, 0xBBBBD593, 0x0B92B5AE,
-               0x1B4E951C, 0xAB67F521, 0x7B1D5566, 0xCB34355B,
-               0x1AA365D9, 0xAA8A05E4, 0x7AF0A5A3, 0xCAD9C59E,
-               0xDA05E52C, 0x6A2C8511, 0xBA562556, 0x0A7F456B,
-               0x597FF589, 0xE95695B4, 0x392C35F3, 0x890555CE,
-               0x99D9757C, 0x29F01541, 0xF98AB506, 0x49A3D53B,
-               0x983485B9, 0x281DE584, 0xF86745C3, 0x484E25FE,
-               0x5892054C, 0xE8BB6571, 0x38C1C536, 0x88E8A50B,
-               0xDFC7D428, 0x6FEEB415, 0xBF941452, 0x0FBD746F,
-               0x1F6154DD, 0xAF4834E0, 0x7F3294A7, 0xCF1BF49A,
-               0x1E8CA418, 0xAEA5C425, 0x7EDF6462, 0xCEF6045F,
-               0xDE2A24ED, 0x6E0344D0, 0xBE79E497, 0x0E5084AA,
-               0x5D503448, 0xED795475, 0x3D03F432, 0x8D2A940F,
-               0x9DF6B4BD, 0x2DDFD480, 0xFDA574C7, 0x4D8C14FA,
-               0x9C1B4478, 0x2C322445, 0xFC488402, 0x4C61E43F,
-               0x5CBDC48D, 0xEC94A4B0, 0x3CEE04F7, 0x8CC764CA
-       }, {
-               0x00000000, 0xA5D35CCB, 0x0BA1C84D, 0xAE729486,
-               0x1642919B, 0xB391CD50, 0x1DE359D6, 0xB830051D,
-               0x6D8253EC, 0xC8510F27, 0x66239BA1, 0xC3F0C76A,
-               0x7BC0C277, 0xDE139EBC, 0x70610A3A, 0xD5B256F1,
-               0x9B02D603, 0x3ED18AC8, 0x90A31E4E, 0x35704285,
-               0x8D404798, 0x28931B53, 0x86E18FD5, 0x2332D31E,
-               0xF68085EF, 0x5353D924, 0xFD214DA2, 0x58F21169,
-               0xE0C21474, 0x451148BF, 0xEB63DC39, 0x4EB080F2,
-               0x3605AC07, 0x93D6F0CC, 0x3DA4644A, 0x98773881,
-               0x20473D9C, 0x85946157, 0x2BE6F5D1, 0x8E35A91A,
-               0x5B87FFEB, 0xFE54A320, 0x502637A6, 0xF5F56B6D,
-               0x4DC56E70, 0xE81632BB, 0x4664A63D, 0xE3B7FAF6,
-               0xAD077A04, 0x08D426CF, 0xA6A6B249, 0x0375EE82,
-               0xBB45EB9F, 0x1E96B754, 0xB0E423D2, 0x15377F19,
-               0xC08529E8, 0x65567523, 0xCB24E1A5, 0x6EF7BD6E,
-               0xD6C7B873, 0x7314E4B8, 0xDD66703E, 0x78B52CF5,
-               0x6C0A580F, 0xC9D904C4, 0x67AB9042, 0xC278CC89,
-               0x7A48C994, 0xDF9B955F, 0x71E901D9, 0xD43A5D12,
-               0x01880BE3, 0xA45B5728, 0x0A29C3AE, 0xAFFA9F65,
-               0x17CA9A78, 0xB219C6B3, 0x1C6B5235, 0xB9B80EFE,
-               0xF7088E0C, 0x52DBD2C7, 0xFCA94641, 0x597A1A8A,
-               0xE14A1F97, 0x4499435C, 0xEAEBD7DA, 0x4F388B11,
-               0x9A8ADDE0, 0x3F59812B, 0x912B15AD, 0x34F84966,
-               0x8CC84C7B, 0x291B10B0, 0x87698436, 0x22BAD8FD,
-               0x5A0FF408, 0xFFDCA8C3, 0x51AE3C45, 0xF47D608E,
-               0x4C4D6593, 0xE99E3958, 0x47ECADDE, 0xE23FF115,
-               0x378DA7E4, 0x925EFB2F, 0x3C2C6FA9, 0x99FF3362,
-               0x21CF367F, 0x841C6AB4, 0x2A6EFE32, 0x8FBDA2F9,
-               0xC10D220B, 0x64DE7EC0, 0xCAACEA46, 0x6F7FB68D,
-               0xD74FB390, 0x729CEF5B, 0xDCEE7BDD, 0x793D2716,
-               0xAC8F71E7, 0x095C2D2C, 0xA72EB9AA, 0x02FDE561,
-               0xBACDE07C, 0x1F1EBCB7, 0xB16C2831, 0x14BF74FA,
-               0xD814B01E, 0x7DC7ECD5, 0xD3B57853, 0x76662498,
-               0xCE562185, 0x6B857D4E, 0xC5F7E9C8, 0x6024B503,
-               0xB596E3F2, 0x1045BF39, 0xBE372BBF, 0x1BE47774,
-               0xA3D47269, 0x06072EA2, 0xA875BA24, 0x0DA6E6EF,
-               0x4316661D, 0xE6C53AD6, 0x48B7AE50, 0xED64F29B,
-               0x5554F786, 0xF087AB4D, 0x5EF53FCB, 0xFB266300,
-               0x2E9435F1, 0x8B47693A, 0x2535FDBC, 0x80E6A177,
-               0x38D6A46A, 0x9D05F8A1, 0x33776C27, 0x96A430EC,
-               0xEE111C19, 0x4BC240D2, 0xE5B0D454, 0x4063889F,
-               0xF8538D82, 0x5D80D149, 0xF3F245CF, 0x56211904,
-               0x83934FF5, 0x2640133E, 0x883287B8, 0x2DE1DB73,
-               0x95D1DE6E, 0x300282A5, 0x9E701623, 0x3BA34AE8,
-               0x7513CA1A, 0xD0C096D1, 0x7EB20257, 0xDB615E9C,
-               0x63515B81, 0xC682074A, 0x68F093CC, 0xCD23CF07,
-               0x189199F6, 0xBD42C53D, 0x133051BB, 0xB6E30D70,
-               0x0ED3086D, 0xAB0054A6, 0x0572C020, 0xA0A19CEB,
-               0xB41EE811, 0x11CDB4DA, 0xBFBF205C, 0x1A6C7C97,
-               0xA25C798A, 0x078F2541, 0xA9FDB1C7, 0x0C2EED0C,
-               0xD99CBBFD, 0x7C4FE736, 0xD23D73B0, 0x77EE2F7B,
-               0xCFDE2A66, 0x6A0D76AD, 0xC47FE22B, 0x61ACBEE0,
-               0x2F1C3E12, 0x8ACF62D9, 0x24BDF65F, 0x816EAA94,
-               0x395EAF89, 0x9C8DF342, 0x32FF67C4, 0x972C3B0F,
-               0x429E6DFE, 0xE74D3135, 0x493FA5B3, 0xECECF978,
-               0x54DCFC65, 0xF10FA0AE, 0x5F7D3428, 0xFAAE68E3,
-               0x821B4416, 0x27C818DD, 0x89BA8C5B, 0x2C69D090,
-               0x9459D58D, 0x318A8946, 0x9FF81DC0, 0x3A2B410B,
-               0xEF9917FA, 0x4A4A4B31, 0xE438DFB7, 0x41EB837C,
-               0xF9DB8661, 0x5C08DAAA, 0xF27A4E2C, 0x57A912E7,
-               0x19199215, 0xBCCACEDE, 0x12B85A58, 0xB76B0693,
-               0x0F5B038E, 0xAA885F45, 0x04FACBC3, 0xA1299708,
-               0x749BC1F9, 0xD1489D32, 0x7F3A09B4, 0xDAE9557F,
-               0x62D95062, 0xC70A0CA9, 0x6978982F, 0xCCABC4E4
-       }, {
-               0x00000000, 0xB40B77A6, 0x29119F97, 0x9D1AE831,
-               0x13244FF4, 0xA72F3852, 0x3A35D063, 0x8E3EA7C5,
-               0x674EEF33, 0xD3459895, 0x4E5F70A4, 0xFA540702,
-               0x746AA0C7, 0xC061D761, 0x5D7B3F50, 0xE97048F6,
-               0xCE9CDE67, 0x7A97A9C1, 0xE78D41F0, 0x53863656,
-               0xDDB89193, 0x69B3E635, 0xF4A90E04, 0x40A279A2,
-               0xA9D23154, 0x1DD946F2, 0x80C3AEC3, 0x34C8D965,
-               0xBAF67EA0, 0x0EFD0906, 0x93E7E137, 0x27EC9691,
-               0x9C39BDCF, 0x2832CA69, 0xB5282258, 0x012355FE,
-               0x8F1DF23B, 0x3B16859D, 0xA60C6DAC, 0x12071A0A,
-               0xFB7752FC, 0x4F7C255A, 0xD266CD6B, 0x666DBACD,
-               0xE8531D08, 0x5C586AAE, 0xC142829F, 0x7549F539,
-               0x52A563A8, 0xE6AE140E, 0x7BB4FC3F, 0xCFBF8B99,
-               0x41812C5C, 0xF58A5BFA, 0x6890B3CB, 0xDC9BC46D,
-               0x35EB8C9B, 0x81E0FB3D, 0x1CFA130C, 0xA8F164AA,
-               0x26CFC36F, 0x92C4B4C9, 0x0FDE5CF8, 0xBBD52B5E,
-               0x79750B44, 0xCD7E7CE2, 0x506494D3, 0xE46FE375,
-               0x6A5144B0, 0xDE5A3316, 0x4340DB27, 0xF74BAC81,
-               0x1E3BE477, 0xAA3093D1, 0x372A7BE0, 0x83210C46,
-               0x0D1FAB83, 0xB914DC25, 0x240E3414, 0x900543B2,
-               0xB7E9D523, 0x03E2A285, 0x9EF84AB4, 0x2AF33D12,
-               0xA4CD9AD7, 0x10C6ED71, 0x8DDC0540, 0x39D772E6,
-               0xD0A73A10, 0x64AC4DB6, 0xF9B6A587, 0x4DBDD221,
-               0xC38375E4, 0x77880242, 0xEA92EA73, 0x5E999DD5,
-               0xE54CB68B, 0x5147C12D, 0xCC5D291C, 0x78565EBA,
-               0xF668F97F, 0x42638ED9, 0xDF7966E8, 0x6B72114E,
-               0x820259B8, 0x36092E1E, 0xAB13C62F, 0x1F18B189,
-               0x9126164C, 0x252D61EA, 0xB83789DB, 0x0C3CFE7D,
-               0x2BD068EC, 0x9FDB1F4A, 0x02C1F77B, 0xB6CA80DD,
-               0x38F42718, 0x8CFF50BE, 0x11E5B88F, 0xA5EECF29,
-               0x4C9E87DF, 0xF895F079, 0x658F1848, 0xD1846FEE,
-               0x5FBAC82B, 0xEBB1BF8D, 0x76AB57BC, 0xC2A0201A,
-               0xF2EA1688, 0x46E1612E, 0xDBFB891F, 0x6FF0FEB9,
-               0xE1CE597C, 0x55C52EDA, 0xC8DFC6EB, 0x7CD4B14D,
-               0x95A4F9BB, 0x21AF8E1D, 0xBCB5662C, 0x08BE118A,
-               0x8680B64F, 0x328BC1E9, 0xAF9129D8, 0x1B9A5E7E,
-               0x3C76C8EF, 0x887DBF49, 0x15675778, 0xA16C20DE,
-               0x2F52871B, 0x9B59F0BD, 0x0643188C, 0xB2486F2A,
-               0x5B3827DC, 0xEF33507A, 0x7229B84B, 0xC622CFED,
-               0x481C6828, 0xFC171F8E, 0x610DF7BF, 0xD5068019,
-               0x6ED3AB47, 0xDAD8DCE1, 0x47C234D0, 0xF3C94376,
-               0x7DF7E4B3, 0xC9FC9315, 0x54E67B24, 0xE0ED0C82,
-               0x099D4474, 0xBD9633D2, 0x208CDBE3, 0x9487AC45,
-               0x1AB90B80, 0xAEB27C26, 0x33A89417, 0x87A3E3B1,
-               0xA04F7520, 0x14440286, 0x895EEAB7, 0x3D559D11,
-               0xB36B3AD4, 0x07604D72, 0x9A7AA543, 0x2E71D2E5,
-               0xC7019A13, 0x730AEDB5, 0xEE100584, 0x5A1B7222,
-               0xD425D5E7, 0x602EA241, 0xFD344A70, 0x493F3DD6,
-               0x8B9F1DCC, 0x3F946A6A, 0xA28E825B, 0x1685F5FD,
-               0x98BB5238, 0x2CB0259E, 0xB1AACDAF, 0x05A1BA09,
-               0xECD1F2FF, 0x58DA8559, 0xC5C06D68, 0x71CB1ACE,
-               0xFFF5BD0B, 0x4BFECAAD, 0xD6E4229C, 0x62EF553A,
-               0x4503C3AB, 0xF108B40D, 0x6C125C3C, 0xD8192B9A,
-               0x56278C5F, 0xE22CFBF9, 0x7F3613C8, 0xCB3D646E,
-               0x224D2C98, 0x96465B3E, 0x0B5CB30F, 0xBF57C4A9,
-               0x3169636C, 0x856214CA, 0x1878FCFB, 0xAC738B5D,
-               0x17A6A003, 0xA3ADD7A5, 0x3EB73F94, 0x8ABC4832,
-               0x0482EFF7, 0xB0899851, 0x2D937060, 0x999807C6,
-               0x70E84F30, 0xC4E33896, 0x59F9D0A7, 0xEDF2A701,
-               0x63CC00C4, 0xD7C77762, 0x4ADD9F53, 0xFED6E8F5,
-               0xD93A7E64, 0x6D3109C2, 0xF02BE1F3, 0x44209655,
-               0xCA1E3190, 0x7E154636, 0xE30FAE07, 0x5704D9A1,
-               0xBE749157, 0x0A7FE6F1, 0x97650EC0, 0x236E7966,
-               0xAD50DEA3, 0x195BA905, 0x84414134, 0x304A3692
-       }, {
-               0x00000000, 0x9E00AACC, 0x7D072542, 0xE3078F8E,
-               0xFA0E4A84, 0x640EE048, 0x87096FC6, 0x1909C50A,
-               0xB51BE5D3, 0x2B1B4F1F, 0xC81CC091, 0x561C6A5D,
-               0x4F15AF57, 0xD115059B, 0x32128A15, 0xAC1220D9,
-               0x2B31BB7C, 0xB53111B0, 0x56369E3E, 0xC83634F2,
-               0xD13FF1F8, 0x4F3F5B34, 0xAC38D4BA, 0x32387E76,
-               0x9E2A5EAF, 0x002AF463, 0xE32D7BED, 0x7D2DD121,
-               0x6424142B, 0xFA24BEE7, 0x19233169, 0x87239BA5,
-               0x566276F9, 0xC862DC35, 0x2B6553BB, 0xB565F977,
-               0xAC6C3C7D, 0x326C96B1, 0xD16B193F, 0x4F6BB3F3,
-               0xE379932A, 0x7D7939E6, 0x9E7EB668, 0x007E1CA4,
-               0x1977D9AE, 0x87777362, 0x6470FCEC, 0xFA705620,
-               0x7D53CD85, 0xE3536749, 0x0054E8C7, 0x9E54420B,
-               0x875D8701, 0x195D2DCD, 0xFA5AA243, 0x645A088F,
-               0xC8482856, 0x5648829A, 0xB54F0D14, 0x2B4FA7D8,
-               0x324662D2, 0xAC46C81E, 0x4F414790, 0xD141ED5C,
-               0xEDC29D29, 0x73C237E5, 0x90C5B86B, 0x0EC512A7,
-               0x17CCD7AD, 0x89CC7D61, 0x6ACBF2EF, 0xF4CB5823,
-               0x58D978FA, 0xC6D9D236, 0x25DE5DB8, 0xBBDEF774,
-               0xA2D7327E, 0x3CD798B2, 0xDFD0173C, 0x41D0BDF0,
-               0xC6F32655, 0x58F38C99, 0xBBF40317, 0x25F4A9DB,
-               0x3CFD6CD1, 0xA2FDC61D, 0x41FA4993, 0xDFFAE35F,
-               0x73E8C386, 0xEDE8694A, 0x0EEFE6C4, 0x90EF4C08,
-               0x89E68902, 0x17E623CE, 0xF4E1AC40, 0x6AE1068C,
-               0xBBA0EBD0, 0x25A0411C, 0xC6A7CE92, 0x58A7645E,
-               0x41AEA154, 0xDFAE0B98, 0x3CA98416, 0xA2A92EDA,
-               0x0EBB0E03, 0x90BBA4CF, 0x73BC2B41, 0xEDBC818D,
-               0xF4B54487, 0x6AB5EE4B, 0x89B261C5, 0x17B2CB09,
-               0x909150AC, 0x0E91FA60, 0xED9675EE, 0x7396DF22,
-               0x6A9F1A28, 0xF49FB0E4, 0x17983F6A, 0x899895A6,
-               0x258AB57F, 0xBB8A1FB3, 0x588D903D, 0xC68D3AF1,
-               0xDF84FFFB, 0x41845537, 0xA283DAB9, 0x3C837075,
-               0xDA853B53, 0x4485919F, 0xA7821E11, 0x3982B4DD,
-               0x208B71D7, 0xBE8BDB1B, 0x5D8C5495, 0xC38CFE59,
-               0x6F9EDE80, 0xF19E744C, 0x1299FBC2, 0x8C99510E,
-               0x95909404, 0x0B903EC8, 0xE897B146, 0x76971B8A,
-               0xF1B4802F, 0x6FB42AE3, 0x8CB3A56D, 0x12B30FA1,
-               0x0BBACAAB, 0x95BA6067, 0x76BDEFE9, 0xE8BD4525,
-               0x44AF65FC, 0xDAAFCF30, 0x39A840BE, 0xA7A8EA72,
-               0xBEA12F78, 0x20A185B4, 0xC3A60A3A, 0x5DA6A0F6,
-               0x8CE74DAA, 0x12E7E766, 0xF1E068E8, 0x6FE0C224,
-               0x76E9072E, 0xE8E9ADE2, 0x0BEE226C, 0x95EE88A0,
-               0x39FCA879, 0xA7FC02B5, 0x44FB8D3B, 0xDAFB27F7,
-               0xC3F2E2FD, 0x5DF24831, 0xBEF5C7BF, 0x20F56D73,
-               0xA7D6F6D6, 0x39D65C1A, 0xDAD1D394, 0x44D17958,
-               0x5DD8BC52, 0xC3D8169E, 0x20DF9910, 0xBEDF33DC,
-               0x12CD1305, 0x8CCDB9C9, 0x6FCA3647, 0xF1CA9C8B,
-               0xE8C35981, 0x76C3F34D, 0x95C47CC3, 0x0BC4D60F,
-               0x3747A67A, 0xA9470CB6, 0x4A408338, 0xD44029F4,
-               0xCD49ECFE, 0x53494632, 0xB04EC9BC, 0x2E4E6370,
-               0x825C43A9, 0x1C5CE965, 0xFF5B66EB, 0x615BCC27,
-               0x7852092D, 0xE652A3E1, 0x05552C6F, 0x9B5586A3,
-               0x1C761D06, 0x8276B7CA, 0x61713844, 0xFF719288,
-               0xE6785782, 0x7878FD4E, 0x9B7F72C0, 0x057FD80C,
-               0xA96DF8D5, 0x376D5219, 0xD46ADD97, 0x4A6A775B,
-               0x5363B251, 0xCD63189D, 0x2E649713, 0xB0643DDF,
-               0x6125D083, 0xFF257A4F, 0x1C22F5C1, 0x82225F0D,
-               0x9B2B9A07, 0x052B30CB, 0xE62CBF45, 0x782C1589,
-               0xD43E3550, 0x4A3E9F9C, 0xA9391012, 0x3739BADE,
-               0x2E307FD4, 0xB030D518, 0x53375A96, 0xCD37F05A,
-               0x4A146BFF, 0xD414C133, 0x37134EBD, 0xA913E471,
-               0xB01A217B, 0x2E1A8BB7, 0xCD1D0439, 0x531DAEF5,
-               0xFF0F8E2C, 0x610F24E0, 0x8208AB6E, 0x1C0801A2,
-               0x0501C4A8, 0x9B016E64, 0x7806E1EA, 0xE6064B26
-       }
-};
diff --git a/contrib/xz/src/liblzma/check/crc32_tablegen.c b/contrib/xz/src/liblzma/check/crc32_tablegen.c
deleted file mode 100644 (file)
index 31a4d27..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file       crc32_tablegen.c
-/// \brief      Generate crc32_table_le.h and crc32_table_be.h
-///
-/// Compiling: gcc -std=c99 -o crc32_tablegen crc32_tablegen.c
-/// Add -DWORDS_BIGENDIAN to generate big endian table.
-/// Add -DLZ_HASH_TABLE to generate lz_encoder_hash_table.h (little endian).
-//
-//  Author:     Lasse Collin
-//
-//  This file has been put into the public domain.
-//  You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include "../../common/tuklib_integer.h"
-
-
-static uint32_t crc32_table[8][256];
-
-
-static void
-init_crc32_table(void)
-{
-       static const uint32_t poly32 = UINT32_C(0xEDB88320);
-
-       for (size_t s = 0; s < 8; ++s) {
-               for (size_t b = 0; b < 256; ++b) {
-                       uint32_t r = s == 0 ? b : crc32_table[s - 1][b];
-
-                       for (size_t i = 0; i < 8; ++i) {
-                               if (r & 1)
-                                       r = (r >> 1) ^ poly32;
-                               else
-                                       r >>= 1;
-                       }
-
-                       crc32_table[s][b] = r;
-               }
-       }
-
-#ifdef WORDS_BIGENDIAN
-       for (size_t s = 0; s < 8; ++s)
-               for (size_t b = 0; b < 256; ++b)
-                       crc32_table[s][b] = bswap32(crc32_table[s][b]);
-#endif
-
-       return;
-}
-
-
-static void
-print_crc32_table(void)
-{
-       printf("/* This file has been automatically generated by "
-                       "crc32_tablegen.c. */\n\n"
-                       "const uint32_t lzma_crc32_table[8][256] = {\n\t{");
-
-       for (size_t s = 0; s < 8; ++s) {
-               for (size_t b = 0; b < 256; ++b) {
-                       if ((b % 4) == 0)
-                               printf("\n\t\t");
-
-                       printf("0x%08" PRIX32, crc32_table[s][b]);
-
-                       if (b != 255)
-                               printf(",%s", (b+1) % 4 == 0 ? "" : " ");
-               }
-
-               if (s == 7)
-                       printf("\n\t}\n};\n");
-               else
-                       printf("\n\t}, {");
-       }
-
-       return;
-}
-
-
-static void
-print_lz_table(void)
-{
-       printf("/* This file has been automatically generated by "
-                       "crc32_tablegen.c. */\n\n"
-                       "const uint32_t lzma_lz_hash_table[256] = {");
-
-       for (size_t b = 0; b < 256; ++b) {
-               if ((b % 4) == 0)
-                       printf("\n\t");
-
-               printf("0x%08" PRIX32, crc32_table[0][b]);
-
-               if (b != 255)
-                       printf(",%s", (b+1) % 4 == 0 ? "" : " ");
-       }
-
-       printf("\n};\n");
-
-       return;
-}
-
-
-int
-main(void)
-{
-       init_crc32_table();
-
-#ifdef LZ_HASH_TABLE
-       print_lz_table();
-#else
-       print_crc32_table();
-#endif
-
-       return 0;
-}
diff --git a/contrib/xz/src/liblzma/check/crc32_x86.S b/contrib/xz/src/liblzma/check/crc32_x86.S
deleted file mode 100644 (file)
index 67f68a4..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Speed-optimized CRC32 using slicing-by-eight algorithm
- *
- * This uses only i386 instructions, but it is optimized for i686 and later
- * (including e.g. Pentium II/III/IV, Athlon XP, and Core 2). For i586
- * (e.g. Pentium), slicing-by-four would be better, and even the C version
- * of slicing-by-eight built with gcc -march=i586 tends to be a little bit
- * better than this. Very few probably run this code on i586 or older x86
- * so this shouldn't be a problem in practice.
- *
- * Authors: Igor Pavlov (original version)
- *          Lasse Collin (AT&T syntax, PIC support, better portability)
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- *
- * This code needs lzma_crc32_table, which can be created using the
- * following C code:
-
-uint32_t lzma_crc32_table[8][256];
-
-void
-init_table(void)
-{
-       // IEEE-802.3
-       static const uint32_t poly32 = UINT32_C(0xEDB88320);
-
-       // Castagnoli
-       // static const uint32_t poly32 = UINT32_C(0x82F63B78);
-
-       // Koopman
-       // static const uint32_t poly32 = UINT32_C(0xEB31D82E);
-
-       for (size_t s = 0; s < 8; ++s) {
-               for (size_t b = 0; b < 256; ++b) {
-                       uint32_t r = s == 0 ? b : lzma_crc32_table[s - 1][b];
-
-                       for (size_t i = 0; i < 8; ++i) {
-                               if (r & 1)
-                                       r = (r >> 1) ^ poly32;
-                               else
-                                       r >>= 1;
-                       }
-
-                       lzma_crc32_table[s][b] = r;
-               }
-       }
-}
-
- * The prototype of the CRC32 function:
- * extern uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc);
- */
-
-/*
- * On some systems, the functions need to be prefixed. The prefix is
- * usually an underscore.
- */
-#ifndef __USER_LABEL_PREFIX__
-#      define __USER_LABEL_PREFIX__
-#endif
-#define MAKE_SYM_CAT(prefix, sym) prefix ## sym
-#define MAKE_SYM(prefix, sym) MAKE_SYM_CAT(prefix, sym)
-#define LZMA_CRC32 MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc32)
-#define LZMA_CRC32_TABLE MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc32_table)
-
-/*
- * Solaris assembler doesn't have .p2align, and Darwin uses .align
- * differently than GNU/Linux and Solaris.
- */
-#if defined(__APPLE__) || defined(__MSDOS__)
-#      define ALIGN(pow2, abs) .align pow2
-#else
-#      define ALIGN(pow2, abs) .align abs
-#endif
-
-       .text
-       .globl  LZMA_CRC32
-
-#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) \
-               && !defined(__MSDOS__)
-       .type   LZMA_CRC32, @function
-#endif
-
-       ALIGN(4, 16)
-LZMA_CRC32:
-       /*
-        * Register usage:
-        * %eax crc
-        * %esi buf
-        * %edi size or buf + size
-        * %ebx lzma_crc32_table
-        * %ebp Table index
-        * %ecx Temporary
-        * %edx Temporary
-        */
-       pushl   %ebx
-       pushl   %esi
-       pushl   %edi
-       pushl   %ebp
-       movl    0x14(%esp), %esi /* buf */
-       movl    0x18(%esp), %edi /* size */
-       movl    0x1C(%esp), %eax /* crc */
-
-       /*
-        * Store the address of lzma_crc32_table to %ebx. This is needed to
-        * get position-independent code (PIC).
-        *
-        * The PIC macro is defined by libtool, while __PIC__ is defined
-        * by GCC but only on some systems. Testing for both makes it simpler
-        * to test this code without libtool, and keeps the code working also
-        * when built with libtool but using something else than GCC.
-        *
-        * I understood that libtool may define PIC on Windows even though
-        * the code in Windows DLLs is not PIC in sense that it is in ELF
-        * binaries, so we need a separate check to always use the non-PIC
-        * code on Windows.
-        */
-#if (!defined(PIC) && !defined(__PIC__)) \
-               || (defined(_WIN32) || defined(__CYGWIN__))
-       /* Not PIC */
-       movl    $ LZMA_CRC32_TABLE, %ebx
-#elif defined(__APPLE__)
-       /* Mach-O */
-       call    .L_get_pc
-.L_pic:
-       leal    .L_lzma_crc32_table$non_lazy_ptr-.L_pic(%ebx), %ebx
-       movl    (%ebx), %ebx
-#else
-       /* ELF */
-       call    .L_get_pc
-       addl    $_GLOBAL_OFFSET_TABLE_, %ebx
-       movl    LZMA_CRC32_TABLE@GOT(%ebx), %ebx
-#endif
-
-       /* Complement the initial value. */
-       notl    %eax
-
-       ALIGN(4, 16)
-.L_align:
-       /*
-        * Check if there is enough input to use slicing-by-eight.
-        * We need 16 bytes, because the loop pre-reads eight bytes.
-        */
-       cmpl    $16, %edi
-       jb      .L_rest
-
-       /* Check if we have reached alignment of eight bytes. */
-       testl   $7, %esi
-       jz      .L_slice
-
-       /* Calculate CRC of the next input byte. */
-       movzbl  (%esi), %ebp
-       incl    %esi
-       movzbl  %al, %ecx
-       xorl    %ecx, %ebp
-       shrl    $8, %eax
-       xorl    (%ebx, %ebp, 4), %eax
-       decl    %edi
-       jmp     .L_align
-
-       ALIGN(2, 4)
-.L_slice:
-       /*
-        * If we get here, there's at least 16 bytes of aligned input
-        * available. Make %edi multiple of eight bytes. Store the possible
-        * remainder over the "size" variable in the argument stack.
-        */
-       movl    %edi, 0x18(%esp)
-       andl    $-8, %edi
-       subl    %edi, 0x18(%esp)
-
-       /*
-        * Let %edi be buf + size - 8 while running the main loop. This way
-        * we can compare for equality to determine when exit the loop.
-        */
-       addl    %esi, %edi
-       subl    $8, %edi
-
-       /* Read in the first eight aligned bytes. */
-       xorl    (%esi), %eax
-       movl    4(%esi), %ecx
-       movzbl  %cl, %ebp
-
-.L_loop:
-       movl    0x0C00(%ebx, %ebp, 4), %edx
-       movzbl  %ch, %ebp
-       xorl    0x0800(%ebx, %ebp, 4), %edx
-       shrl    $16, %ecx
-       xorl    8(%esi), %edx
-       movzbl  %cl, %ebp
-       xorl    0x0400(%ebx, %ebp, 4), %edx
-       movzbl  %ch, %ebp
-       xorl    (%ebx, %ebp, 4), %edx
-       movzbl  %al, %ebp
-
-       /*
-        * Read the next four bytes, for which the CRC is calculated
-        * on the next interation of the loop.
-        */
-       movl    12(%esi), %ecx
-
-       xorl    0x1C00(%ebx, %ebp, 4), %edx
-       movzbl  %ah, %ebp
-       shrl    $16, %eax
-       xorl    0x1800(%ebx, %ebp, 4), %edx
-       movzbl  %ah, %ebp
-       movzbl  %al, %eax
-       movl    0x1400(%ebx, %eax, 4), %eax
-       addl    $8, %esi
-       xorl    %edx, %eax
-       xorl    0x1000(%ebx, %ebp, 4), %eax
-
-       /* Check for end of aligned input. */
-       cmpl    %edi, %esi
-       movzbl  %cl, %ebp
-       jne     .L_loop
-
-       /*
-        * Process the remaining eight bytes, which we have already
-        * copied to %ecx and %edx.
-        */
-       movl    0x0C00(%ebx, %ebp, 4), %edx
-       movzbl  %ch, %ebp
-       xorl    0x0800(%ebx, %ebp, 4), %edx
-       shrl    $16, %ecx
-       movzbl  %cl, %ebp
-       xorl    0x0400(%ebx, %ebp, 4), %edx
-       movzbl  %ch, %ebp
-       xorl    (%ebx, %ebp, 4), %edx
-       movzbl  %al, %ebp
-
-       xorl    0x1C00(%ebx, %ebp, 4), %edx
-       movzbl  %ah, %ebp
-       shrl    $16, %eax
-       xorl    0x1800(%ebx, %ebp, 4), %edx
-       movzbl  %ah, %ebp
-       movzbl  %al, %eax
-       movl    0x1400(%ebx, %eax, 4), %eax
-       addl    $8, %esi
-       xorl    %edx, %eax
-       xorl    0x1000(%ebx, %ebp, 4), %eax
-
-       /* Copy the number of remaining bytes to %edi. */
-       movl    0x18(%esp), %edi
-
-.L_rest:
-       /* Check for end of input. */
-       testl   %edi, %edi
-       jz      .L_return
-
-       /* Calculate CRC of the next input byte. */
-       movzbl  (%esi), %ebp
-       incl    %esi
-       movzbl  %al, %ecx
-       xorl    %ecx, %ebp
-       shrl    $8, %eax
-       xorl    (%ebx, %ebp, 4), %eax
-       decl    %edi
-       jmp     .L_rest
-
-.L_return:
-       /* Complement the final value. */
-       notl    %eax
-
-       popl    %ebp
-       popl    %edi
-       popl    %esi
-       popl    %ebx
-       ret
-
-#if defined(PIC) || defined(__PIC__)
-       ALIGN(4, 16)
-.L_get_pc:
-       movl    (%esp), %ebx
-       ret
-#endif
-
-#if defined(__APPLE__) && (defined(PIC) || defined(__PIC__))
-       /* Mach-O PIC */
-       .section __IMPORT,__pointers,non_lazy_symbol_pointers
-.L_lzma_crc32_table$non_lazy_ptr:
-       .indirect_symbol LZMA_CRC32_TABLE
-       .long 0
-
-#elif defined(_WIN32) || defined(__CYGWIN__)
-#      ifdef DLL_EXPORT
-       /* This is equivalent of __declspec(dllexport). */
-       .section .drectve
-       .ascii " -export:lzma_crc32"
-#      endif
-
-#elif !defined(__MSDOS__)
-       /* ELF */
-       .size   LZMA_CRC32, .-LZMA_CRC32
-#endif
-
-/*
- * This is needed to support non-executable stack. It's ugly to
- * use __linux__ here, but I don't know a way to detect when
- * we are using GNU assembler.
- */
-#if defined(__ELF__) && defined(__linux__)
-       .section        .note.GNU-stack,"",@progbits
-#endif
diff --git a/contrib/xz/src/liblzma/check/crc64_small.c b/contrib/xz/src/liblzma/check/crc64_small.c
deleted file mode 100644 (file)
index 55d7231..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file       crc64_small.c
-/// \brief      CRC64 calculation (size-optimized)
-//
-//  Author:     Lasse Collin
-//
-//  This file has been put into the public domain.
-//  You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include "check.h"
-
-
-static uint64_t crc64_table[256];
-
-
-static void
-crc64_init(void)
-{
-       static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
-
-       for (size_t b = 0; b < 256; ++b) {
-               uint64_t r = b;
-               for (size_t i = 0; i < 8; ++i) {
-                       if (r & 1)
-                               r = (r >> 1) ^ poly64;
-                       else
-                               r >>= 1;
-               }
-
-               crc64_table[b] = r;
-       }
-
-       return;
-}
-
-
-extern LZMA_API(uint64_t)
-lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
-{
-       mythread_once(crc64_init);
-
-       crc = ~crc;
-
-       while (size != 0) {
-               crc = crc64_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
-               --size;
-       }
-
-       return ~crc;
-}
diff --git a/contrib/xz/src/liblzma/check/crc64_table_be.h b/contrib/xz/src/liblzma/check/crc64_table_be.h
deleted file mode 100644 (file)
index ea074f3..0000000
+++ /dev/null
@@ -1,521 +0,0 @@
-/* This file has been automatically generated by crc64_tablegen.c. */
-
-const uint64_t lzma_crc64_table[4][256] = {
-       {
-               UINT64_C(0x0000000000000000), UINT64_C(0x6F5FA703BE4C2EB3),
-               UINT64_C(0x5BA040A8573684F4), UINT64_C(0x34FFE7ABE97AAA47),
-               UINT64_C(0x335E8FFF84C3D07B), UINT64_C(0x5C0128FC3A8FFEC8),
-               UINT64_C(0x68FECF57D3F5548F), UINT64_C(0x07A168546DB97A3C),
-               UINT64_C(0x66BC1EFF0987A1F7), UINT64_C(0x09E3B9FCB7CB8F44),
-               UINT64_C(0x3D1C5E575EB12503), UINT64_C(0x5243F954E0FD0BB0),
-               UINT64_C(0x55E291008D44718C), UINT64_C(0x3ABD360333085F3F),
-               UINT64_C(0x0E42D1A8DA72F578), UINT64_C(0x611D76AB643EDBCB),
-               UINT64_C(0x4966335138A19B7D), UINT64_C(0x2639945286EDB5CE),
-               UINT64_C(0x12C673F96F971F89), UINT64_C(0x7D99D4FAD1DB313A),
-               UINT64_C(0x7A38BCAEBC624B06), UINT64_C(0x15671BAD022E65B5),
-               UINT64_C(0x2198FC06EB54CFF2), UINT64_C(0x4EC75B055518E141),
-               UINT64_C(0x2FDA2DAE31263A8A), UINT64_C(0x40858AAD8F6A1439),
-               UINT64_C(0x747A6D066610BE7E), UINT64_C(0x1B25CA05D85C90CD),
-               UINT64_C(0x1C84A251B5E5EAF1), UINT64_C(0x73DB05520BA9C442),
-               UINT64_C(0x4724E2F9E2D36E05), UINT64_C(0x287B45FA5C9F40B6),
-               UINT64_C(0x92CC66A2704237FB), UINT64_C(0xFD93C1A1CE0E1948),
-               UINT64_C(0xC96C260A2774B30F), UINT64_C(0xA633810999389DBC),
-               UINT64_C(0xA192E95DF481E780), UINT64_C(0xCECD4E5E4ACDC933),
-               UINT64_C(0xFA32A9F5A3B76374), UINT64_C(0x956D0EF61DFB4DC7),
-               UINT64_C(0xF470785D79C5960C), UINT64_C(0x9B2FDF5EC789B8BF),
-               UINT64_C(0xAFD038F52EF312F8), UINT64_C(0xC08F9FF690BF3C4B),
-               UINT64_C(0xC72EF7A2FD064677), UINT64_C(0xA87150A1434A68C4),
-               UINT64_C(0x9C8EB70AAA30C283), UINT64_C(0xF3D11009147CEC30),
-               UINT64_C(0xDBAA55F348E3AC86), UINT64_C(0xB4F5F2F0F6AF8235),
-               UINT64_C(0x800A155B1FD52872), UINT64_C(0xEF55B258A19906C1),
-               UINT64_C(0xE8F4DA0CCC207CFD), UINT64_C(0x87AB7D0F726C524E),
-               UINT64_C(0xB3549AA49B16F809), UINT64_C(0xDC0B3DA7255AD6BA),
-               UINT64_C(0xBD164B0C41640D71), UINT64_C(0xD249EC0FFF2823C2),
-               UINT64_C(0xE6B60BA416528985), UINT64_C(0x89E9ACA7A81EA736),
-               UINT64_C(0x8E48C4F3C5A7DD0A), UINT64_C(0xE11763F07BEBF3B9),
-               UINT64_C(0xD5E8845B929159FE), UINT64_C(0xBAB723582CDD774D),
-               UINT64_C(0xA187C3EBCA2BB664), UINT64_C(0xCED864E8746798D7),
-               UINT64_C(0xFA2783439D1D3290), UINT64_C(0x9578244023511C23),
-               UINT64_C(0x92D94C144EE8661F), UINT64_C(0xFD86EB17F0A448AC),
-               UINT64_C(0xC9790CBC19DEE2EB), UINT64_C(0xA626ABBFA792CC58),
-               UINT64_C(0xC73BDD14C3AC1793), UINT64_C(0xA8647A177DE03920),
-               UINT64_C(0x9C9B9DBC949A9367), UINT64_C(0xF3C43ABF2AD6BDD4),
-               UINT64_C(0xF46552EB476FC7E8), UINT64_C(0x9B3AF5E8F923E95B),
-               UINT64_C(0xAFC512431059431C), UINT64_C(0xC09AB540AE156DAF),
-               UINT64_C(0xE8E1F0BAF28A2D19), UINT64_C(0x87BE57B94CC603AA),
-               UINT64_C(0xB341B012A5BCA9ED), UINT64_C(0xDC1E17111BF0875E),
-               UINT64_C(0xDBBF7F457649FD62), UINT64_C(0xB4E0D846C805D3D1),
-               UINT64_C(0x801F3FED217F7996), UINT64_C(0xEF4098EE9F335725),
-               UINT64_C(0x8E5DEE45FB0D8CEE), UINT64_C(0xE10249464541A25D),
-               UINT64_C(0xD5FDAEEDAC3B081A), UINT64_C(0xBAA209EE127726A9),
-               UINT64_C(0xBD0361BA7FCE5C95), UINT64_C(0xD25CC6B9C1827226),
-               UINT64_C(0xE6A3211228F8D861), UINT64_C(0x89FC861196B4F6D2),
-               UINT64_C(0x334BA549BA69819F), UINT64_C(0x5C14024A0425AF2C),
-               UINT64_C(0x68EBE5E1ED5F056B), UINT64_C(0x07B442E253132BD8),
-               UINT64_C(0x00152AB63EAA51E4), UINT64_C(0x6F4A8DB580E67F57),
-               UINT64_C(0x5BB56A1E699CD510), UINT64_C(0x34EACD1DD7D0FBA3),
-               UINT64_C(0x55F7BBB6B3EE2068), UINT64_C(0x3AA81CB50DA20EDB),
-               UINT64_C(0x0E57FB1EE4D8A49C), UINT64_C(0x61085C1D5A948A2F),
-               UINT64_C(0x66A93449372DF013), UINT64_C(0x09F6934A8961DEA0),
-               UINT64_C(0x3D0974E1601B74E7), UINT64_C(0x5256D3E2DE575A54),
-               UINT64_C(0x7A2D961882C81AE2), UINT64_C(0x1572311B3C843451),
-               UINT64_C(0x218DD6B0D5FE9E16), UINT64_C(0x4ED271B36BB2B0A5),
-               UINT64_C(0x497319E7060BCA99), UINT64_C(0x262CBEE4B847E42A),
-               UINT64_C(0x12D3594F513D4E6D), UINT64_C(0x7D8CFE4CEF7160DE),
-               UINT64_C(0x1C9188E78B4FBB15), UINT64_C(0x73CE2FE4350395A6),
-               UINT64_C(0x4731C84FDC793FE1), UINT64_C(0x286E6F4C62351152),
-               UINT64_C(0x2FCF07180F8C6B6E), UINT64_C(0x4090A01BB1C045DD),
-               UINT64_C(0x746F47B058BAEF9A), UINT64_C(0x1B30E0B3E6F6C129),
-               UINT64_C(0x420F87D795576CC9), UINT64_C(0x2D5020D42B1B427A),
-               UINT64_C(0x19AFC77FC261E83D), UINT64_C(0x76F0607C7C2DC68E),
-               UINT64_C(0x715108281194BCB2), UINT64_C(0x1E0EAF2BAFD89201),
-               UINT64_C(0x2AF1488046A23846), UINT64_C(0x45AEEF83F8EE16F5),
-               UINT64_C(0x24B399289CD0CD3E), UINT64_C(0x4BEC3E2B229CE38D),
-               UINT64_C(0x7F13D980CBE649CA), UINT64_C(0x104C7E8375AA6779),
-               UINT64_C(0x17ED16D718131D45), UINT64_C(0x78B2B1D4A65F33F6),
-               UINT64_C(0x4C4D567F4F2599B1), UINT64_C(0x2312F17CF169B702),
-               UINT64_C(0x0B69B486ADF6F7B4), UINT64_C(0x6436138513BAD907),
-               UINT64_C(0x50C9F42EFAC07340), UINT64_C(0x3F96532D448C5DF3),
-               UINT64_C(0x38373B79293527CF), UINT64_C(0x57689C7A9779097C),
-               UINT64_C(0x63977BD17E03A33B), UINT64_C(0x0CC8DCD2C04F8D88),
-               UINT64_C(0x6DD5AA79A4715643), UINT64_C(0x028A0D7A1A3D78F0),
-               UINT64_C(0x3675EAD1F347D2B7), UINT64_C(0x592A4DD24D0BFC04),
-               UINT64_C(0x5E8B258620B28638), UINT64_C(0x31D482859EFEA88B),
-               UINT64_C(0x052B652E778402CC), UINT64_C(0x6A74C22DC9C82C7F),
-               UINT64_C(0xD0C3E175E5155B32), UINT64_C(0xBF9C46765B597581),
-               UINT64_C(0x8B63A1DDB223DFC6), UINT64_C(0xE43C06DE0C6FF175),
-               UINT64_C(0xE39D6E8A61D68B49), UINT64_C(0x8CC2C989DF9AA5FA),
-               UINT64_C(0xB83D2E2236E00FBD), UINT64_C(0xD762892188AC210E),
-               UINT64_C(0xB67FFF8AEC92FAC5), UINT64_C(0xD920588952DED476),
-               UINT64_C(0xEDDFBF22BBA47E31), UINT64_C(0x8280182105E85082),
-               UINT64_C(0x8521707568512ABE), UINT64_C(0xEA7ED776D61D040D),
-               UINT64_C(0xDE8130DD3F67AE4A), UINT64_C(0xB1DE97DE812B80F9),
-               UINT64_C(0x99A5D224DDB4C04F), UINT64_C(0xF6FA752763F8EEFC),
-               UINT64_C(0xC205928C8A8244BB), UINT64_C(0xAD5A358F34CE6A08),
-               UINT64_C(0xAAFB5DDB59771034), UINT64_C(0xC5A4FAD8E73B3E87),
-               UINT64_C(0xF15B1D730E4194C0), UINT64_C(0x9E04BA70B00DBA73),
-               UINT64_C(0xFF19CCDBD43361B8), UINT64_C(0x90466BD86A7F4F0B),
-               UINT64_C(0xA4B98C738305E54C), UINT64_C(0xCBE62B703D49CBFF),
-               UINT64_C(0xCC47432450F0B1C3), UINT64_C(0xA318E427EEBC9F70),
-               UINT64_C(0x97E7038C07C63537), UINT64_C(0xF8B8A48FB98A1B84),
-               UINT64_C(0xE388443C5F7CDAAD), UINT64_C(0x8CD7E33FE130F41E),
-               UINT64_C(0xB8280494084A5E59), UINT64_C(0xD777A397B60670EA),
-               UINT64_C(0xD0D6CBC3DBBF0AD6), UINT64_C(0xBF896CC065F32465),
-               UINT64_C(0x8B768B6B8C898E22), UINT64_C(0xE4292C6832C5A091),
-               UINT64_C(0x85345AC356FB7B5A), UINT64_C(0xEA6BFDC0E8B755E9),
-               UINT64_C(0xDE941A6B01CDFFAE), UINT64_C(0xB1CBBD68BF81D11D),
-               UINT64_C(0xB66AD53CD238AB21), UINT64_C(0xD935723F6C748592),
-               UINT64_C(0xEDCA9594850E2FD5), UINT64_C(0x829532973B420166),
-               UINT64_C(0xAAEE776D67DD41D0), UINT64_C(0xC5B1D06ED9916F63),
-               UINT64_C(0xF14E37C530EBC524), UINT64_C(0x9E1190C68EA7EB97),
-               UINT64_C(0x99B0F892E31E91AB), UINT64_C(0xF6EF5F915D52BF18),
-               UINT64_C(0xC210B83AB428155F), UINT64_C(0xAD4F1F390A643BEC),
-               UINT64_C(0xCC5269926E5AE027), UINT64_C(0xA30DCE91D016CE94),
-               UINT64_C(0x97F2293A396C64D3), UINT64_C(0xF8AD8E3987204A60),
-               UINT64_C(0xFF0CE66DEA99305C), UINT64_C(0x9053416E54D51EEF),
-               UINT64_C(0xA4ACA6C5BDAFB4A8), UINT64_C(0xCBF301C603E39A1B),
-               UINT64_C(0x7144229E2F3EED56), UINT64_C(0x1E1B859D9172C3E5),
-               UINT64_C(0x2AE46236780869A2), UINT64_C(0x45BBC535C6444711),
-               UINT64_C(0x421AAD61ABFD3D2D), UINT64_C(0x2D450A6215B1139E),
-               UINT64_C(0x19BAEDC9FCCBB9D9), UINT64_C(0x76E54ACA4287976A),
-               UINT64_C(0x17F83C6126B94CA1), UINT64_C(0x78A79B6298F56212),
-               UINT64_C(0x4C587CC9718FC855), UINT64_C(0x2307DBCACFC3E6E6),
-               UINT64_C(0x24A6B39EA27A9CDA), UINT64_C(0x4BF9149D1C36B269),
-               UINT64_C(0x7F06F336F54C182E), UINT64_C(0x105954354B00369D),
-               UINT64_C(0x382211CF179F762B), UINT64_C(0x577DB6CCA9D35898),
-               UINT64_C(0x6382516740A9F2DF), UINT64_C(0x0CDDF664FEE5DC6C),
-               UINT64_C(0x0B7C9E30935CA650), UINT64_C(0x642339332D1088E3),
-               UINT64_C(0x50DCDE98C46A22A4), UINT64_C(0x3F83799B7A260C17),
-               UINT64_C(0x5E9E0F301E18D7DC), UINT64_C(0x31C1A833A054F96F),
-               UINT64_C(0x053E4F98492E5328), UINT64_C(0x6A61E89BF7627D9B),
-               UINT64_C(0x6DC080CF9ADB07A7), UINT64_C(0x029F27CC24972914),
-               UINT64_C(0x3660C067CDED8353), UINT64_C(0x593F676473A1ADE0)
-       }, {
-               UINT64_C(0x0000000000000000), UINT64_C(0x0DF1D05C9279E954),
-               UINT64_C(0x1AE2A1B924F3D2A9), UINT64_C(0x171371E5B68A3BFD),
-               UINT64_C(0xB1DA4DDC62497DC1), UINT64_C(0xBC2B9D80F0309495),
-               UINT64_C(0xAB38EC6546BAAF68), UINT64_C(0xA6C93C39D4C3463C),
-               UINT64_C(0xE7AB9517EE3D2210), UINT64_C(0xEA5A454B7C44CB44),
-               UINT64_C(0xFD4934AECACEF0B9), UINT64_C(0xF0B8E4F258B719ED),
-               UINT64_C(0x5671D8CB8C745FD1), UINT64_C(0x5B8008971E0DB685),
-               UINT64_C(0x4C937972A8878D78), UINT64_C(0x4162A92E3AFE642C),
-               UINT64_C(0xCE572B2FDC7B4420), UINT64_C(0xC3A6FB734E02AD74),
-               UINT64_C(0xD4B58A96F8889689), UINT64_C(0xD9445ACA6AF17FDD),
-               UINT64_C(0x7F8D66F3BE3239E1), UINT64_C(0x727CB6AF2C4BD0B5),
-               UINT64_C(0x656FC74A9AC1EB48), UINT64_C(0x689E171608B8021C),
-               UINT64_C(0x29FCBE3832466630), UINT64_C(0x240D6E64A03F8F64),
-               UINT64_C(0x331E1F8116B5B499), UINT64_C(0x3EEFCFDD84CC5DCD),
-               UINT64_C(0x9826F3E4500F1BF1), UINT64_C(0x95D723B8C276F2A5),
-               UINT64_C(0x82C4525D74FCC958), UINT64_C(0x8F358201E685200C),
-               UINT64_C(0x9CAF565EB8F78840), UINT64_C(0x915E86022A8E6114),
-               UINT64_C(0x864DF7E79C045AE9), UINT64_C(0x8BBC27BB0E7DB3BD),
-               UINT64_C(0x2D751B82DABEF581), UINT64_C(0x2084CBDE48C71CD5),
-               UINT64_C(0x3797BA3BFE4D2728), UINT64_C(0x3A666A676C34CE7C),
-               UINT64_C(0x7B04C34956CAAA50), UINT64_C(0x76F51315C4B34304),
-               UINT64_C(0x61E662F0723978F9), UINT64_C(0x6C17B2ACE04091AD),
-               UINT64_C(0xCADE8E953483D791), UINT64_C(0xC72F5EC9A6FA3EC5),
-               UINT64_C(0xD03C2F2C10700538), UINT64_C(0xDDCDFF708209EC6C),
-               UINT64_C(0x52F87D71648CCC60), UINT64_C(0x5F09AD2DF6F52534),
-               UINT64_C(0x481ADCC8407F1EC9), UINT64_C(0x45EB0C94D206F79D),
-               UINT64_C(0xE32230AD06C5B1A1), UINT64_C(0xEED3E0F194BC58F5),
-               UINT64_C(0xF9C0911422366308), UINT64_C(0xF4314148B04F8A5C),
-               UINT64_C(0xB553E8668AB1EE70), UINT64_C(0xB8A2383A18C80724),
-               UINT64_C(0xAFB149DFAE423CD9), UINT64_C(0xA24099833C3BD58D),
-               UINT64_C(0x0489A5BAE8F893B1), UINT64_C(0x097875E67A817AE5),
-               UINT64_C(0x1E6B0403CC0B4118), UINT64_C(0x139AD45F5E72A84C),
-               UINT64_C(0x385FADBC70EF1181), UINT64_C(0x35AE7DE0E296F8D5),
-               UINT64_C(0x22BD0C05541CC328), UINT64_C(0x2F4CDC59C6652A7C),
-               UINT64_C(0x8985E06012A66C40), UINT64_C(0x8474303C80DF8514),
-               UINT64_C(0x936741D93655BEE9), UINT64_C(0x9E969185A42C57BD),
-               UINT64_C(0xDFF438AB9ED23391), UINT64_C(0xD205E8F70CABDAC5),
-               UINT64_C(0xC5169912BA21E138), UINT64_C(0xC8E7494E2858086C),
-               UINT64_C(0x6E2E7577FC9B4E50), UINT64_C(0x63DFA52B6EE2A704),
-               UINT64_C(0x74CCD4CED8689CF9), UINT64_C(0x793D04924A1175AD),
-               UINT64_C(0xF6088693AC9455A1), UINT64_C(0xFBF956CF3EEDBCF5),
-               UINT64_C(0xECEA272A88678708), UINT64_C(0xE11BF7761A1E6E5C),
-               UINT64_C(0x47D2CB4FCEDD2860), UINT64_C(0x4A231B135CA4C134),
-               UINT64_C(0x5D306AF6EA2EFAC9), UINT64_C(0x50C1BAAA7857139D),
-               UINT64_C(0x11A3138442A977B1), UINT64_C(0x1C52C3D8D0D09EE5),
-               UINT64_C(0x0B41B23D665AA518), UINT64_C(0x06B06261F4234C4C),
-               UINT64_C(0xA0795E5820E00A70), UINT64_C(0xAD888E04B299E324),
-               UINT64_C(0xBA9BFFE10413D8D9), UINT64_C(0xB76A2FBD966A318D),
-               UINT64_C(0xA4F0FBE2C81899C1), UINT64_C(0xA9012BBE5A617095),
-               UINT64_C(0xBE125A5BECEB4B68), UINT64_C(0xB3E38A077E92A23C),
-               UINT64_C(0x152AB63EAA51E400), UINT64_C(0x18DB666238280D54),
-               UINT64_C(0x0FC817878EA236A9), UINT64_C(0x0239C7DB1CDBDFFD),
-               UINT64_C(0x435B6EF52625BBD1), UINT64_C(0x4EAABEA9B45C5285),
-               UINT64_C(0x59B9CF4C02D66978), UINT64_C(0x54481F1090AF802C),
-               UINT64_C(0xF2812329446CC610), UINT64_C(0xFF70F375D6152F44),
-               UINT64_C(0xE8638290609F14B9), UINT64_C(0xE59252CCF2E6FDED),
-               UINT64_C(0x6AA7D0CD1463DDE1), UINT64_C(0x67560091861A34B5),
-               UINT64_C(0x7045717430900F48), UINT64_C(0x7DB4A128A2E9E61C),
-               UINT64_C(0xDB7D9D11762AA020), UINT64_C(0xD68C4D4DE4534974),
-               UINT64_C(0xC19F3CA852D97289), UINT64_C(0xCC6EECF4C0A09BDD),
-               UINT64_C(0x8D0C45DAFA5EFFF1), UINT64_C(0x80FD9586682716A5),
-               UINT64_C(0x97EEE463DEAD2D58), UINT64_C(0x9A1F343F4CD4C40C),
-               UINT64_C(0x3CD6080698178230), UINT64_C(0x3127D85A0A6E6B64),
-               UINT64_C(0x2634A9BFBCE45099), UINT64_C(0x2BC579E32E9DB9CD),
-               UINT64_C(0xF5A054D6CA71FB90), UINT64_C(0xF851848A580812C4),
-               UINT64_C(0xEF42F56FEE822939), UINT64_C(0xE2B325337CFBC06D),
-               UINT64_C(0x447A190AA8388651), UINT64_C(0x498BC9563A416F05),
-               UINT64_C(0x5E98B8B38CCB54F8), UINT64_C(0x536968EF1EB2BDAC),
-               UINT64_C(0x120BC1C1244CD980), UINT64_C(0x1FFA119DB63530D4),
-               UINT64_C(0x08E9607800BF0B29), UINT64_C(0x0518B02492C6E27D),
-               UINT64_C(0xA3D18C1D4605A441), UINT64_C(0xAE205C41D47C4D15),
-               UINT64_C(0xB9332DA462F676E8), UINT64_C(0xB4C2FDF8F08F9FBC),
-               UINT64_C(0x3BF77FF9160ABFB0), UINT64_C(0x3606AFA5847356E4),
-               UINT64_C(0x2115DE4032F96D19), UINT64_C(0x2CE40E1CA080844D),
-               UINT64_C(0x8A2D32257443C271), UINT64_C(0x87DCE279E63A2B25),
-               UINT64_C(0x90CF939C50B010D8), UINT64_C(0x9D3E43C0C2C9F98C),
-               UINT64_C(0xDC5CEAEEF8379DA0), UINT64_C(0xD1AD3AB26A4E74F4),
-               UINT64_C(0xC6BE4B57DCC44F09), UINT64_C(0xCB4F9B0B4EBDA65D),
-               UINT64_C(0x6D86A7329A7EE061), UINT64_C(0x6077776E08070935),
-               UINT64_C(0x7764068BBE8D32C8), UINT64_C(0x7A95D6D72CF4DB9C),
-               UINT64_C(0x690F0288728673D0), UINT64_C(0x64FED2D4E0FF9A84),
-               UINT64_C(0x73EDA3315675A179), UINT64_C(0x7E1C736DC40C482D),
-               UINT64_C(0xD8D54F5410CF0E11), UINT64_C(0xD5249F0882B6E745),
-               UINT64_C(0xC237EEED343CDCB8), UINT64_C(0xCFC63EB1A64535EC),
-               UINT64_C(0x8EA4979F9CBB51C0), UINT64_C(0x835547C30EC2B894),
-               UINT64_C(0x94463626B8488369), UINT64_C(0x99B7E67A2A316A3D),
-               UINT64_C(0x3F7EDA43FEF22C01), UINT64_C(0x328F0A1F6C8BC555),
-               UINT64_C(0x259C7BFADA01FEA8), UINT64_C(0x286DABA6487817FC),
-               UINT64_C(0xA75829A7AEFD37F0), UINT64_C(0xAAA9F9FB3C84DEA4),
-               UINT64_C(0xBDBA881E8A0EE559), UINT64_C(0xB04B584218770C0D),
-               UINT64_C(0x1682647BCCB44A31), UINT64_C(0x1B73B4275ECDA365),
-               UINT64_C(0x0C60C5C2E8479898), UINT64_C(0x0191159E7A3E71CC),
-               UINT64_C(0x40F3BCB040C015E0), UINT64_C(0x4D026CECD2B9FCB4),
-               UINT64_C(0x5A111D096433C749), UINT64_C(0x57E0CD55F64A2E1D),
-               UINT64_C(0xF129F16C22896821), UINT64_C(0xFCD82130B0F08175),
-               UINT64_C(0xEBCB50D5067ABA88), UINT64_C(0xE63A8089940353DC),
-               UINT64_C(0xCDFFF96ABA9EEA11), UINT64_C(0xC00E293628E70345),
-               UINT64_C(0xD71D58D39E6D38B8), UINT64_C(0xDAEC888F0C14D1EC),
-               UINT64_C(0x7C25B4B6D8D797D0), UINT64_C(0x71D464EA4AAE7E84),
-               UINT64_C(0x66C7150FFC244579), UINT64_C(0x6B36C5536E5DAC2D),
-               UINT64_C(0x2A546C7D54A3C801), UINT64_C(0x27A5BC21C6DA2155),
-               UINT64_C(0x30B6CDC470501AA8), UINT64_C(0x3D471D98E229F3FC),
-               UINT64_C(0x9B8E21A136EAB5C0), UINT64_C(0x967FF1FDA4935C94),
-               UINT64_C(0x816C801812196769), UINT64_C(0x8C9D504480608E3D),
-               UINT64_C(0x03A8D24566E5AE31), UINT64_C(0x0E590219F49C4765),
-               UINT64_C(0x194A73FC42167C98), UINT64_C(0x14BBA3A0D06F95CC),
-               UINT64_C(0xB2729F9904ACD3F0), UINT64_C(0xBF834FC596D53AA4),
-               UINT64_C(0xA8903E20205F0159), UINT64_C(0xA561EE7CB226E80D),
-               UINT64_C(0xE403475288D88C21), UINT64_C(0xE9F2970E1AA16575),
-               UINT64_C(0xFEE1E6EBAC2B5E88), UINT64_C(0xF31036B73E52B7DC),
-               UINT64_C(0x55D90A8EEA91F1E0), UINT64_C(0x5828DAD278E818B4),
-               UINT64_C(0x4F3BAB37CE622349), UINT64_C(0x42CA7B6B5C1BCA1D),
-               UINT64_C(0x5150AF3402696251), UINT64_C(0x5CA17F6890108B05),
-               UINT64_C(0x4BB20E8D269AB0F8), UINT64_C(0x4643DED1B4E359AC),
-               UINT64_C(0xE08AE2E860201F90), UINT64_C(0xED7B32B4F259F6C4),
-               UINT64_C(0xFA68435144D3CD39), UINT64_C(0xF799930DD6AA246D),
-               UINT64_C(0xB6FB3A23EC544041), UINT64_C(0xBB0AEA7F7E2DA915),
-               UINT64_C(0xAC199B9AC8A792E8), UINT64_C(0xA1E84BC65ADE7BBC),
-               UINT64_C(0x072177FF8E1D3D80), UINT64_C(0x0AD0A7A31C64D4D4),
-               UINT64_C(0x1DC3D646AAEEEF29), UINT64_C(0x1032061A3897067D),
-               UINT64_C(0x9F07841BDE122671), UINT64_C(0x92F654474C6BCF25),
-               UINT64_C(0x85E525A2FAE1F4D8), UINT64_C(0x8814F5FE68981D8C),
-               UINT64_C(0x2EDDC9C7BC5B5BB0), UINT64_C(0x232C199B2E22B2E4),
-               UINT64_C(0x343F687E98A88919), UINT64_C(0x39CEB8220AD1604D),
-               UINT64_C(0x78AC110C302F0461), UINT64_C(0x755DC150A256ED35),
-               UINT64_C(0x624EB0B514DCD6C8), UINT64_C(0x6FBF60E986A53F9C),
-               UINT64_C(0xC9765CD0526679A0), UINT64_C(0xC4878C8CC01F90F4),
-               UINT64_C(0xD394FD697695AB09), UINT64_C(0xDE652D35E4EC425D)
-       }, {
-               UINT64_C(0x0000000000000000), UINT64_C(0xCB6D6A914AE10B3F),
-               UINT64_C(0x96DBD42295C2177E), UINT64_C(0x5DB6BEB3DF231C41),
-               UINT64_C(0x2CB7A9452A852FFC), UINT64_C(0xE7DAC3D4606424C3),
-               UINT64_C(0xBA6C7D67BF473882), UINT64_C(0x710117F6F5A633BD),
-               UINT64_C(0xDD705D247FA5876A), UINT64_C(0x161D37B535448C55),
-               UINT64_C(0x4BAB8906EA679014), UINT64_C(0x80C6E397A0869B2B),
-               UINT64_C(0xF1C7F4615520A896), UINT64_C(0x3AAA9EF01FC1A3A9),
-               UINT64_C(0x671C2043C0E2BFE8), UINT64_C(0xAC714AD28A03B4D7),
-               UINT64_C(0xBAE1BA48FE4A0FD5), UINT64_C(0x718CD0D9B4AB04EA),
-               UINT64_C(0x2C3A6E6A6B8818AB), UINT64_C(0xE75704FB21691394),
-               UINT64_C(0x9656130DD4CF2029), UINT64_C(0x5D3B799C9E2E2B16),
-               UINT64_C(0x008DC72F410D3757), UINT64_C(0xCBE0ADBE0BEC3C68),
-               UINT64_C(0x6791E76C81EF88BF), UINT64_C(0xACFC8DFDCB0E8380),
-               UINT64_C(0xF14A334E142D9FC1), UINT64_C(0x3A2759DF5ECC94FE),
-               UINT64_C(0x4B264E29AB6AA743), UINT64_C(0x804B24B8E18BAC7C),
-               UINT64_C(0xDDFD9A0B3EA8B03D), UINT64_C(0x1690F09A7449BB02),
-               UINT64_C(0xF1DD7B3ED73AC638), UINT64_C(0x3AB011AF9DDBCD07),
-               UINT64_C(0x6706AF1C42F8D146), UINT64_C(0xAC6BC58D0819DA79),
-               UINT64_C(0xDD6AD27BFDBFE9C4), UINT64_C(0x1607B8EAB75EE2FB),
-               UINT64_C(0x4BB10659687DFEBA), UINT64_C(0x80DC6CC8229CF585),
-               UINT64_C(0x2CAD261AA89F4152), UINT64_C(0xE7C04C8BE27E4A6D),
-               UINT64_C(0xBA76F2383D5D562C), UINT64_C(0x711B98A977BC5D13),
-               UINT64_C(0x001A8F5F821A6EAE), UINT64_C(0xCB77E5CEC8FB6591),
-               UINT64_C(0x96C15B7D17D879D0), UINT64_C(0x5DAC31EC5D3972EF),
-               UINT64_C(0x4B3CC1762970C9ED), UINT64_C(0x8051ABE76391C2D2),
-               UINT64_C(0xDDE71554BCB2DE93), UINT64_C(0x168A7FC5F653D5AC),
-               UINT64_C(0x678B683303F5E611), UINT64_C(0xACE602A24914ED2E),
-               UINT64_C(0xF150BC119637F16F), UINT64_C(0x3A3DD680DCD6FA50),
-               UINT64_C(0x964C9C5256D54E87), UINT64_C(0x5D21F6C31C3445B8),
-               UINT64_C(0x00974870C31759F9), UINT64_C(0xCBFA22E189F652C6),
-               UINT64_C(0xBAFB35177C50617B), UINT64_C(0x71965F8636B16A44),
-               UINT64_C(0x2C20E135E9927605), UINT64_C(0xE74D8BA4A3737D3A),
-               UINT64_C(0xE2BBF77CAE758C71), UINT64_C(0x29D69DEDE494874E),
-               UINT64_C(0x7460235E3BB79B0F), UINT64_C(0xBF0D49CF71569030),
-               UINT64_C(0xCE0C5E3984F0A38D), UINT64_C(0x056134A8CE11A8B2),
-               UINT64_C(0x58D78A1B1132B4F3), UINT64_C(0x93BAE08A5BD3BFCC),
-               UINT64_C(0x3FCBAA58D1D00B1B), UINT64_C(0xF4A6C0C99B310024),
-               UINT64_C(0xA9107E7A44121C65), UINT64_C(0x627D14EB0EF3175A),
-               UINT64_C(0x137C031DFB5524E7), UINT64_C(0xD811698CB1B42FD8),
-               UINT64_C(0x85A7D73F6E973399), UINT64_C(0x4ECABDAE247638A6),
-               UINT64_C(0x585A4D34503F83A4), UINT64_C(0x933727A51ADE889B),
-               UINT64_C(0xCE819916C5FD94DA), UINT64_C(0x05ECF3878F1C9FE5),
-               UINT64_C(0x74EDE4717ABAAC58), UINT64_C(0xBF808EE0305BA767),
-               UINT64_C(0xE2363053EF78BB26), UINT64_C(0x295B5AC2A599B019),
-               UINT64_C(0x852A10102F9A04CE), UINT64_C(0x4E477A81657B0FF1),
-               UINT64_C(0x13F1C432BA5813B0), UINT64_C(0xD89CAEA3F0B9188F),
-               UINT64_C(0xA99DB955051F2B32), UINT64_C(0x62F0D3C44FFE200D),
-               UINT64_C(0x3F466D7790DD3C4C), UINT64_C(0xF42B07E6DA3C3773),
-               UINT64_C(0x13668C42794F4A49), UINT64_C(0xD80BE6D333AE4176),
-               UINT64_C(0x85BD5860EC8D5D37), UINT64_C(0x4ED032F1A66C5608),
-               UINT64_C(0x3FD1250753CA65B5), UINT64_C(0xF4BC4F96192B6E8A),
-               UINT64_C(0xA90AF125C60872CB), UINT64_C(0x62679BB48CE979F4),
-               UINT64_C(0xCE16D16606EACD23), UINT64_C(0x057BBBF74C0BC61C),
-               UINT64_C(0x58CD05449328DA5D), UINT64_C(0x93A06FD5D9C9D162),
-               UINT64_C(0xE2A178232C6FE2DF), UINT64_C(0x29CC12B2668EE9E0),
-               UINT64_C(0x747AAC01B9ADF5A1), UINT64_C(0xBF17C690F34CFE9E),
-               UINT64_C(0xA987360A8705459C), UINT64_C(0x62EA5C9BCDE44EA3),
-               UINT64_C(0x3F5CE22812C752E2), UINT64_C(0xF43188B9582659DD),
-               UINT64_C(0x85309F4FAD806A60), UINT64_C(0x4E5DF5DEE761615F),
-               UINT64_C(0x13EB4B6D38427D1E), UINT64_C(0xD88621FC72A37621),
-               UINT64_C(0x74F76B2EF8A0C2F6), UINT64_C(0xBF9A01BFB241C9C9),
-               UINT64_C(0xE22CBF0C6D62D588), UINT64_C(0x2941D59D2783DEB7),
-               UINT64_C(0x5840C26BD225ED0A), UINT64_C(0x932DA8FA98C4E635),
-               UINT64_C(0xCE9B164947E7FA74), UINT64_C(0x05F67CD80D06F14B),
-               UINT64_C(0xC477EFF95CEB18E3), UINT64_C(0x0F1A8568160A13DC),
-               UINT64_C(0x52AC3BDBC9290F9D), UINT64_C(0x99C1514A83C804A2),
-               UINT64_C(0xE8C046BC766E371F), UINT64_C(0x23AD2C2D3C8F3C20),
-               UINT64_C(0x7E1B929EE3AC2061), UINT64_C(0xB576F80FA94D2B5E),
-               UINT64_C(0x1907B2DD234E9F89), UINT64_C(0xD26AD84C69AF94B6),
-               UINT64_C(0x8FDC66FFB68C88F7), UINT64_C(0x44B10C6EFC6D83C8),
-               UINT64_C(0x35B01B9809CBB075), UINT64_C(0xFEDD7109432ABB4A),
-               UINT64_C(0xA36BCFBA9C09A70B), UINT64_C(0x6806A52BD6E8AC34),
-               UINT64_C(0x7E9655B1A2A11736), UINT64_C(0xB5FB3F20E8401C09),
-               UINT64_C(0xE84D819337630048), UINT64_C(0x2320EB027D820B77),
-               UINT64_C(0x5221FCF4882438CA), UINT64_C(0x994C9665C2C533F5),
-               UINT64_C(0xC4FA28D61DE62FB4), UINT64_C(0x0F9742475707248B),
-               UINT64_C(0xA3E60895DD04905C), UINT64_C(0x688B620497E59B63),
-               UINT64_C(0x353DDCB748C68722), UINT64_C(0xFE50B62602278C1D),
-               UINT64_C(0x8F51A1D0F781BFA0), UINT64_C(0x443CCB41BD60B49F),
-               UINT64_C(0x198A75F26243A8DE), UINT64_C(0xD2E71F6328A2A3E1),
-               UINT64_C(0x35AA94C78BD1DEDB), UINT64_C(0xFEC7FE56C130D5E4),
-               UINT64_C(0xA37140E51E13C9A5), UINT64_C(0x681C2A7454F2C29A),
-               UINT64_C(0x191D3D82A154F127), UINT64_C(0xD2705713EBB5FA18),
-               UINT64_C(0x8FC6E9A03496E659), UINT64_C(0x44AB83317E77ED66),
-               UINT64_C(0xE8DAC9E3F47459B1), UINT64_C(0x23B7A372BE95528E),
-               UINT64_C(0x7E011DC161B64ECF), UINT64_C(0xB56C77502B5745F0),
-               UINT64_C(0xC46D60A6DEF1764D), UINT64_C(0x0F000A3794107D72),
-               UINT64_C(0x52B6B4844B336133), UINT64_C(0x99DBDE1501D26A0C),
-               UINT64_C(0x8F4B2E8F759BD10E), UINT64_C(0x4426441E3F7ADA31),
-               UINT64_C(0x1990FAADE059C670), UINT64_C(0xD2FD903CAAB8CD4F),
-               UINT64_C(0xA3FC87CA5F1EFEF2), UINT64_C(0x6891ED5B15FFF5CD),
-               UINT64_C(0x352753E8CADCE98C), UINT64_C(0xFE4A3979803DE2B3),
-               UINT64_C(0x523B73AB0A3E5664), UINT64_C(0x9956193A40DF5D5B),
-               UINT64_C(0xC4E0A7899FFC411A), UINT64_C(0x0F8DCD18D51D4A25),
-               UINT64_C(0x7E8CDAEE20BB7998), UINT64_C(0xB5E1B07F6A5A72A7),
-               UINT64_C(0xE8570ECCB5796EE6), UINT64_C(0x233A645DFF9865D9),
-               UINT64_C(0x26CC1885F29E9492), UINT64_C(0xEDA17214B87F9FAD),
-               UINT64_C(0xB017CCA7675C83EC), UINT64_C(0x7B7AA6362DBD88D3),
-               UINT64_C(0x0A7BB1C0D81BBB6E), UINT64_C(0xC116DB5192FAB051),
-               UINT64_C(0x9CA065E24DD9AC10), UINT64_C(0x57CD0F730738A72F),
-               UINT64_C(0xFBBC45A18D3B13F8), UINT64_C(0x30D12F30C7DA18C7),
-               UINT64_C(0x6D67918318F90486), UINT64_C(0xA60AFB1252180FB9),
-               UINT64_C(0xD70BECE4A7BE3C04), UINT64_C(0x1C668675ED5F373B),
-               UINT64_C(0x41D038C6327C2B7A), UINT64_C(0x8ABD5257789D2045),
-               UINT64_C(0x9C2DA2CD0CD49B47), UINT64_C(0x5740C85C46359078),
-               UINT64_C(0x0AF676EF99168C39), UINT64_C(0xC19B1C7ED3F78706),
-               UINT64_C(0xB09A0B882651B4BB), UINT64_C(0x7BF761196CB0BF84),
-               UINT64_C(0x2641DFAAB393A3C5), UINT64_C(0xED2CB53BF972A8FA),
-               UINT64_C(0x415DFFE973711C2D), UINT64_C(0x8A30957839901712),
-               UINT64_C(0xD7862BCBE6B30B53), UINT64_C(0x1CEB415AAC52006C),
-               UINT64_C(0x6DEA56AC59F433D1), UINT64_C(0xA6873C3D131538EE),
-               UINT64_C(0xFB31828ECC3624AF), UINT64_C(0x305CE81F86D72F90),
-               UINT64_C(0xD71163BB25A452AA), UINT64_C(0x1C7C092A6F455995),
-               UINT64_C(0x41CAB799B06645D4), UINT64_C(0x8AA7DD08FA874EEB),
-               UINT64_C(0xFBA6CAFE0F217D56), UINT64_C(0x30CBA06F45C07669),
-               UINT64_C(0x6D7D1EDC9AE36A28), UINT64_C(0xA610744DD0026117),
-               UINT64_C(0x0A613E9F5A01D5C0), UINT64_C(0xC10C540E10E0DEFF),
-               UINT64_C(0x9CBAEABDCFC3C2BE), UINT64_C(0x57D7802C8522C981),
-               UINT64_C(0x26D697DA7084FA3C), UINT64_C(0xEDBBFD4B3A65F103),
-               UINT64_C(0xB00D43F8E546ED42), UINT64_C(0x7B602969AFA7E67D),
-               UINT64_C(0x6DF0D9F3DBEE5D7F), UINT64_C(0xA69DB362910F5640),
-               UINT64_C(0xFB2B0DD14E2C4A01), UINT64_C(0x3046674004CD413E),
-               UINT64_C(0x414770B6F16B7283), UINT64_C(0x8A2A1A27BB8A79BC),
-               UINT64_C(0xD79CA49464A965FD), UINT64_C(0x1CF1CE052E486EC2),
-               UINT64_C(0xB08084D7A44BDA15), UINT64_C(0x7BEDEE46EEAAD12A),
-               UINT64_C(0x265B50F53189CD6B), UINT64_C(0xED363A647B68C654),
-               UINT64_C(0x9C372D928ECEF5E9), UINT64_C(0x575A4703C42FFED6),
-               UINT64_C(0x0AECF9B01B0CE297), UINT64_C(0xC181932151EDE9A8)
-       }, {
-               UINT64_C(0x0000000000000000), UINT64_C(0xDCA12C225E8AEE1D),
-               UINT64_C(0xB8435944BC14DD3B), UINT64_C(0x64E27566E29E3326),
-               UINT64_C(0x7087B2887829BA77), UINT64_C(0xAC269EAA26A3546A),
-               UINT64_C(0xC8C4EBCCC43D674C), UINT64_C(0x1465C7EE9AB78951),
-               UINT64_C(0xE00E6511F15274EF), UINT64_C(0x3CAF4933AFD89AF2),
-               UINT64_C(0x584D3C554D46A9D4), UINT64_C(0x84EC107713CC47C9),
-               UINT64_C(0x9089D799897BCE98), UINT64_C(0x4C28FBBBD7F12085),
-               UINT64_C(0x28CA8EDD356F13A3), UINT64_C(0xF46BA2FF6BE5FDBE),
-               UINT64_C(0x4503C48DC90A304C), UINT64_C(0x99A2E8AF9780DE51),
-               UINT64_C(0xFD409DC9751EED77), UINT64_C(0x21E1B1EB2B94036A),
-               UINT64_C(0x35847605B1238A3B), UINT64_C(0xE9255A27EFA96426),
-               UINT64_C(0x8DC72F410D375700), UINT64_C(0x5166036353BDB91D),
-               UINT64_C(0xA50DA19C385844A3), UINT64_C(0x79AC8DBE66D2AABE),
-               UINT64_C(0x1D4EF8D8844C9998), UINT64_C(0xC1EFD4FADAC67785),
-               UINT64_C(0xD58A13144071FED4), UINT64_C(0x092B3F361EFB10C9),
-               UINT64_C(0x6DC94A50FC6523EF), UINT64_C(0xB1686672A2EFCDF2),
-               UINT64_C(0x8A06881B93156098), UINT64_C(0x56A7A439CD9F8E85),
-               UINT64_C(0x3245D15F2F01BDA3), UINT64_C(0xEEE4FD7D718B53BE),
-               UINT64_C(0xFA813A93EB3CDAEF), UINT64_C(0x262016B1B5B634F2),
-               UINT64_C(0x42C263D7572807D4), UINT64_C(0x9E634FF509A2E9C9),
-               UINT64_C(0x6A08ED0A62471477), UINT64_C(0xB6A9C1283CCDFA6A),
-               UINT64_C(0xD24BB44EDE53C94C), UINT64_C(0x0EEA986C80D92751),
-               UINT64_C(0x1A8F5F821A6EAE00), UINT64_C(0xC62E73A044E4401D),
-               UINT64_C(0xA2CC06C6A67A733B), UINT64_C(0x7E6D2AE4F8F09D26),
-               UINT64_C(0xCF054C965A1F50D4), UINT64_C(0x13A460B40495BEC9),
-               UINT64_C(0x774615D2E60B8DEF), UINT64_C(0xABE739F0B88163F2),
-               UINT64_C(0xBF82FE1E2236EAA3), UINT64_C(0x6323D23C7CBC04BE),
-               UINT64_C(0x07C1A75A9E223798), UINT64_C(0xDB608B78C0A8D985),
-               UINT64_C(0x2F0B2987AB4D243B), UINT64_C(0xF3AA05A5F5C7CA26),
-               UINT64_C(0x974870C31759F900), UINT64_C(0x4BE95CE149D3171D),
-               UINT64_C(0x5F8C9B0FD3649E4C), UINT64_C(0x832DB72D8DEE7051),
-               UINT64_C(0xE7CFC24B6F704377), UINT64_C(0x3B6EEE6931FAAD6A),
-               UINT64_C(0x91131E980D8418A2), UINT64_C(0x4DB232BA530EF6BF),
-               UINT64_C(0x295047DCB190C599), UINT64_C(0xF5F16BFEEF1A2B84),
-               UINT64_C(0xE194AC1075ADA2D5), UINT64_C(0x3D3580322B274CC8),
-               UINT64_C(0x59D7F554C9B97FEE), UINT64_C(0x8576D976973391F3),
-               UINT64_C(0x711D7B89FCD66C4D), UINT64_C(0xADBC57ABA25C8250),
-               UINT64_C(0xC95E22CD40C2B176), UINT64_C(0x15FF0EEF1E485F6B),
-               UINT64_C(0x019AC90184FFD63A), UINT64_C(0xDD3BE523DA753827),
-               UINT64_C(0xB9D9904538EB0B01), UINT64_C(0x6578BC676661E51C),
-               UINT64_C(0xD410DA15C48E28EE), UINT64_C(0x08B1F6379A04C6F3),
-               UINT64_C(0x6C538351789AF5D5), UINT64_C(0xB0F2AF7326101BC8),
-               UINT64_C(0xA497689DBCA79299), UINT64_C(0x783644BFE22D7C84),
-               UINT64_C(0x1CD431D900B34FA2), UINT64_C(0xC0751DFB5E39A1BF),
-               UINT64_C(0x341EBF0435DC5C01), UINT64_C(0xE8BF93266B56B21C),
-               UINT64_C(0x8C5DE64089C8813A), UINT64_C(0x50FCCA62D7426F27),
-               UINT64_C(0x44990D8C4DF5E676), UINT64_C(0x983821AE137F086B),
-               UINT64_C(0xFCDA54C8F1E13B4D), UINT64_C(0x207B78EAAF6BD550),
-               UINT64_C(0x1B1596839E91783A), UINT64_C(0xC7B4BAA1C01B9627),
-               UINT64_C(0xA356CFC72285A501), UINT64_C(0x7FF7E3E57C0F4B1C),
-               UINT64_C(0x6B92240BE6B8C24D), UINT64_C(0xB7330829B8322C50),
-               UINT64_C(0xD3D17D4F5AAC1F76), UINT64_C(0x0F70516D0426F16B),
-               UINT64_C(0xFB1BF3926FC30CD5), UINT64_C(0x27BADFB03149E2C8),
-               UINT64_C(0x4358AAD6D3D7D1EE), UINT64_C(0x9FF986F48D5D3FF3),
-               UINT64_C(0x8B9C411A17EAB6A2), UINT64_C(0x573D6D38496058BF),
-               UINT64_C(0x33DF185EABFE6B99), UINT64_C(0xEF7E347CF5748584),
-               UINT64_C(0x5E16520E579B4876), UINT64_C(0x82B77E2C0911A66B),
-               UINT64_C(0xE6550B4AEB8F954D), UINT64_C(0x3AF42768B5057B50),
-               UINT64_C(0x2E91E0862FB2F201), UINT64_C(0xF230CCA471381C1C),
-               UINT64_C(0x96D2B9C293A62F3A), UINT64_C(0x4A7395E0CD2CC127),
-               UINT64_C(0xBE18371FA6C93C99), UINT64_C(0x62B91B3DF843D284),
-               UINT64_C(0x065B6E5B1ADDE1A2), UINT64_C(0xDAFA427944570FBF),
-               UINT64_C(0xCE9F8597DEE086EE), UINT64_C(0x123EA9B5806A68F3),
-               UINT64_C(0x76DCDCD362F45BD5), UINT64_C(0xAA7DF0F13C7EB5C8),
-               UINT64_C(0xA739329F30A7E9D6), UINT64_C(0x7B981EBD6E2D07CB),
-               UINT64_C(0x1F7A6BDB8CB334ED), UINT64_C(0xC3DB47F9D239DAF0),
-               UINT64_C(0xD7BE8017488E53A1), UINT64_C(0x0B1FAC351604BDBC),
-               UINT64_C(0x6FFDD953F49A8E9A), UINT64_C(0xB35CF571AA106087),
-               UINT64_C(0x4737578EC1F59D39), UINT64_C(0x9B967BAC9F7F7324),
-               UINT64_C(0xFF740ECA7DE14002), UINT64_C(0x23D522E8236BAE1F),
-               UINT64_C(0x37B0E506B9DC274E), UINT64_C(0xEB11C924E756C953),
-               UINT64_C(0x8FF3BC4205C8FA75), UINT64_C(0x535290605B421468),
-               UINT64_C(0xE23AF612F9ADD99A), UINT64_C(0x3E9BDA30A7273787),
-               UINT64_C(0x5A79AF5645B904A1), UINT64_C(0x86D883741B33EABC),
-               UINT64_C(0x92BD449A818463ED), UINT64_C(0x4E1C68B8DF0E8DF0),
-               UINT64_C(0x2AFE1DDE3D90BED6), UINT64_C(0xF65F31FC631A50CB),
-               UINT64_C(0x0234930308FFAD75), UINT64_C(0xDE95BF2156754368),
-               UINT64_C(0xBA77CA47B4EB704E), UINT64_C(0x66D6E665EA619E53),
-               UINT64_C(0x72B3218B70D61702), UINT64_C(0xAE120DA92E5CF91F),
-               UINT64_C(0xCAF078CFCCC2CA39), UINT64_C(0x165154ED92482424),
-               UINT64_C(0x2D3FBA84A3B2894E), UINT64_C(0xF19E96A6FD386753),
-               UINT64_C(0x957CE3C01FA65475), UINT64_C(0x49DDCFE2412CBA68),
-               UINT64_C(0x5DB8080CDB9B3339), UINT64_C(0x8119242E8511DD24),
-               UINT64_C(0xE5FB5148678FEE02), UINT64_C(0x395A7D6A3905001F),
-               UINT64_C(0xCD31DF9552E0FDA1), UINT64_C(0x1190F3B70C6A13BC),
-               UINT64_C(0x757286D1EEF4209A), UINT64_C(0xA9D3AAF3B07ECE87),
-               UINT64_C(0xBDB66D1D2AC947D6), UINT64_C(0x6117413F7443A9CB),
-               UINT64_C(0x05F5345996DD9AED), UINT64_C(0xD954187BC85774F0),
-               UINT64_C(0x683C7E096AB8B902), UINT64_C(0xB49D522B3432571F),
-               UINT64_C(0xD07F274DD6AC6439), UINT64_C(0x0CDE0B6F88268A24),
-               UINT64_C(0x18BBCC8112910375), UINT64_C(0xC41AE0A34C1BED68),
-               UINT64_C(0xA0F895C5AE85DE4E), UINT64_C(0x7C59B9E7F00F3053),
-               UINT64_C(0x88321B189BEACDED), UINT64_C(0x5493373AC56023F0),
-               UINT64_C(0x3071425C27FE10D6), UINT64_C(0xECD06E7E7974FECB),
-               UINT64_C(0xF8B5A990E3C3779A), UINT64_C(0x241485B2BD499987),
-               UINT64_C(0x40F6F0D45FD7AAA1), UINT64_C(0x9C57DCF6015D44BC),
-               UINT64_C(0x362A2C073D23F174), UINT64_C(0xEA8B002563A91F69),
-               UINT64_C(0x8E69754381372C4F), UINT64_C(0x52C85961DFBDC252),
-               UINT64_C(0x46AD9E8F450A4B03), UINT64_C(0x9A0CB2AD1B80A51E),
-               UINT64_C(0xFEEEC7CBF91E9638), UINT64_C(0x224FEBE9A7947825),
-               UINT64_C(0xD6244916CC71859B), UINT64_C(0x0A85653492FB6B86),
-               UINT64_C(0x6E671052706558A0), UINT64_C(0xB2C63C702EEFB6BD),
-               UINT64_C(0xA6A3FB9EB4583FEC), UINT64_C(0x7A02D7BCEAD2D1F1),
-               UINT64_C(0x1EE0A2DA084CE2D7), UINT64_C(0xC2418EF856C60CCA),
-               UINT64_C(0x7329E88AF429C138), UINT64_C(0xAF88C4A8AAA32F25),
-               UINT64_C(0xCB6AB1CE483D1C03), UINT64_C(0x17CB9DEC16B7F21E),
-               UINT64_C(0x03AE5A028C007B4F), UINT64_C(0xDF0F7620D28A9552),
-               UINT64_C(0xBBED03463014A674), UINT64_C(0x674C2F646E9E4869),
-               UINT64_C(0x93278D9B057BB5D7), UINT64_C(0x4F86A1B95BF15BCA),
-               UINT64_C(0x2B64D4DFB96F68EC), UINT64_C(0xF7C5F8FDE7E586F1),
-               UINT64_C(0xE3A03F137D520FA0), UINT64_C(0x3F01133123D8E1BD),
-               UINT64_C(0x5BE36657C146D29B), UINT64_C(0x87424A759FCC3C86),
-               UINT64_C(0xBC2CA41CAE3691EC), UINT64_C(0x608D883EF0BC7FF1),
-               UINT64_C(0x046FFD5812224CD7), UINT64_C(0xD8CED17A4CA8A2CA),
-               UINT64_C(0xCCAB1694D61F2B9B), UINT64_C(0x100A3AB68895C586),
-               UINT64_C(0x74E84FD06A0BF6A0), UINT64_C(0xA84963F2348118BD),
-               UINT64_C(0x5C22C10D5F64E503), UINT64_C(0x8083ED2F01EE0B1E),
-               UINT64_C(0xE4619849E3703838), UINT64_C(0x38C0B46BBDFAD625),
-               UINT64_C(0x2CA57385274D5F74), UINT64_C(0xF0045FA779C7B169),
-               UINT64_C(0x94E62AC19B59824F), UINT64_C(0x484706E3C5D36C52),
-               UINT64_C(0xF92F6091673CA1A0), UINT64_C(0x258E4CB339B64FBD),
-               UINT64_C(0x416C39D5DB287C9B), UINT64_C(0x9DCD15F785A29286),
-               UINT64_C(0x89A8D2191F151BD7), UINT64_C(0x5509FE3B419FF5CA),
-               UINT64_C(0x31EB8B5DA301C6EC), UINT64_C(0xED4AA77FFD8B28F1),
-               UINT64_C(0x19210580966ED54F), UINT64_C(0xC58029A2C8E43B52),
-               UINT64_C(0xA1625CC42A7A0874), UINT64_C(0x7DC370E674F0E669),
-               UINT64_C(0x69A6B708EE476F38), UINT64_C(0xB5079B2AB0CD8125),
-               UINT64_C(0xD1E5EE4C5253B203), UINT64_C(0x0D44C26E0CD95C1E)
-       }
-};
diff --git a/contrib/xz/src/liblzma/check/crc64_tablegen.c b/contrib/xz/src/liblzma/check/crc64_tablegen.c
deleted file mode 100644 (file)
index fddaa7e..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file       crc64_tablegen.c
-/// \brief      Generate crc64_table_le.h and crc64_table_be.h
-///
-/// Compiling: gcc -std=c99 -o crc64_tablegen crc64_tablegen.c
-/// Add -DWORDS_BIGENDIAN to generate big endian table.
-//
-//  Author:     Lasse Collin
-//
-//  This file has been put into the public domain.
-//  You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <stdio.h>
-#include "../../common/tuklib_integer.h"
-
-
-static uint64_t crc64_table[4][256];
-
-
-extern void
-init_crc64_table(void)
-{
-       static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
-
-       for (size_t s = 0; s < 4; ++s) {
-               for (size_t b = 0; b < 256; ++b) {
-                       uint64_t r = s == 0 ? b : crc64_table[s - 1][b];
-
-                       for (size_t i = 0; i < 8; ++i) {
-                               if (r & 1)
-                                       r = (r >> 1) ^ poly64;
-                               else
-                                       r >>= 1;
-                       }
-
-                       crc64_table[s][b] = r;
-               }
-       }
-
-#ifdef WORDS_BIGENDIAN
-       for (size_t s = 0; s < 4; ++s)
-               for (size_t b = 0; b < 256; ++b)
-                       crc64_table[s][b] = bswap64(crc64_table[s][b]);
-#endif
-
-       return;
-}
-
-
-static void
-print_crc64_table(void)
-{
-       printf("/* This file has been automatically generated by "
-                       "crc64_tablegen.c. */\n\n"
-                       "const uint64_t lzma_crc64_table[4][256] = {\n\t{");
-
-       for (size_t s = 0; s < 4; ++s) {
-               for (size_t b = 0; b < 256; ++b) {
-                       if ((b % 2) == 0)
-                               printf("\n\t\t");
-
-                       printf("UINT64_C(0x%016" PRIX64 ")",
-                                       crc64_table[s][b]);
-
-                       if (b != 255)
-                               printf(",%s", (b+1) % 2 == 0 ? "" : " ");
-               }
-
-               if (s == 3)
-                       printf("\n\t}\n};\n");
-               else
-                       printf("\n\t}, {");
-       }
-
-       return;
-}
-
-
-int
-main(void)
-{
-       init_crc64_table();
-       print_crc64_table();
-       return 0;
-}
diff --git a/contrib/xz/src/liblzma/check/crc64_x86.S b/contrib/xz/src/liblzma/check/crc64_x86.S
deleted file mode 100644 (file)
index f5bb84b..0000000
+++ /dev/null
@@ -1,287 +0,0 @@
-/*
- * Speed-optimized CRC64 using slicing-by-four algorithm
- *
- * This uses only i386 instructions, but it is optimized for i686 and later
- * (including e.g. Pentium II/III/IV, Athlon XP, and Core 2).
- *
- * Authors: Igor Pavlov (original CRC32 assembly code)
- *          Lasse Collin (CRC64 adaptation of the modified CRC32 code)
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- *
- * This code needs lzma_crc64_table, which can be created using the
- * following C code:
-
-uint64_t lzma_crc64_table[4][256];
-
-void
-init_table(void)
-{
-       // ECMA-182
-       static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
-
-       for (size_t s = 0; s < 4; ++s) {
-               for (size_t b = 0; b < 256; ++b) {
-                       uint64_t r = s == 0 ? b : lzma_crc64_table[s - 1][b];
-
-                       for (size_t i = 0; i < 8; ++i) {
-                               if (r & 1)
-                                       r = (r >> 1) ^ poly64;
-                               else
-                                       r >>= 1;
-                       }
-
-                       lzma_crc64_table[s][b] = r;
-               }
-       }
-}
-
- * The prototype of the CRC64 function:
- * extern uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc);
- */
-
-/*
- * On some systems, the functions need to be prefixed. The prefix is
- * usually an underscore.
- */
-#ifndef __USER_LABEL_PREFIX__
-#      define __USER_LABEL_PREFIX__
-#endif
-#define MAKE_SYM_CAT(prefix, sym) prefix ## sym
-#define MAKE_SYM(prefix, sym) MAKE_SYM_CAT(prefix, sym)
-#define LZMA_CRC64 MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc64)
-#define LZMA_CRC64_TABLE MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc64_table)
-
-/*
- * Solaris assembler doesn't have .p2align, and Darwin uses .align
- * differently than GNU/Linux and Solaris.
- */
-#if defined(__APPLE__) || defined(__MSDOS__)
-#      define ALIGN(pow2, abs) .align pow2
-#else
-#      define ALIGN(pow2, abs) .align abs
-#endif
-
-       .text
-       .globl  LZMA_CRC64
-
-#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) \
-               && !defined(__MSDOS__)
-       .type   LZMA_CRC64, @function
-#endif
-
-       ALIGN(4, 16)
-LZMA_CRC64:
-       /*
-        * Register usage:
-        * %eax crc LSB
-        * %edx crc MSB
-        * %esi buf
-        * %edi size or buf + size
-        * %ebx lzma_crc64_table
-        * %ebp Table index
-        * %ecx Temporary
-        */
-       pushl   %ebx
-       pushl   %esi
-       pushl   %edi
-       pushl   %ebp
-       movl    0x14(%esp), %esi /* buf */
-       movl    0x18(%esp), %edi /* size */
-       movl    0x1C(%esp), %eax /* crc LSB */
-       movl    0x20(%esp), %edx /* crc MSB */
-
-       /*
-        * Store the address of lzma_crc64_table to %ebx. This is needed to
-        * get position-independent code (PIC).
-        *
-        * The PIC macro is defined by libtool, while __PIC__ is defined
-        * by GCC but only on some systems. Testing for both makes it simpler
-        * to test this code without libtool, and keeps the code working also
-        * when built with libtool but using something else than GCC.
-        *
-        * I understood that libtool may define PIC on Windows even though
-        * the code in Windows DLLs is not PIC in sense that it is in ELF
-        * binaries, so we need a separate check to always use the non-PIC
-        * code on Windows.
-        */
-#if (!defined(PIC) && !defined(__PIC__)) \
-               || (defined(_WIN32) || defined(__CYGWIN__))
-       /* Not PIC */
-       movl    $ LZMA_CRC64_TABLE, %ebx
-#elif defined(__APPLE__)
-       /* Mach-O */
-       call    .L_get_pc
-.L_pic:
-       leal    .L_lzma_crc64_table$non_lazy_ptr-.L_pic(%ebx), %ebx
-       movl    (%ebx), %ebx
-#else
-       /* ELF */
-       call    .L_get_pc
-       addl    $_GLOBAL_OFFSET_TABLE_, %ebx
-       movl    LZMA_CRC64_TABLE@GOT(%ebx), %ebx
-#endif
-
-       /* Complement the initial value. */
-       notl    %eax
-       notl    %edx
-
-.L_align:
-       /*
-        * Check if there is enough input to use slicing-by-four.
-        * We need eight bytes, because the loop pre-reads four bytes.
-        */
-       cmpl    $8, %edi
-       jb      .L_rest
-
-       /* Check if we have reached alignment of four bytes. */
-       testl   $3, %esi
-       jz      .L_slice
-
-       /* Calculate CRC of the next input byte. */
-       movzbl  (%esi), %ebp
-       incl    %esi
-       movzbl  %al, %ecx
-       xorl    %ecx, %ebp
-       shrdl   $8, %edx, %eax
-       xorl    (%ebx, %ebp, 8), %eax
-       shrl    $8, %edx
-       xorl    4(%ebx, %ebp, 8), %edx
-       decl    %edi
-       jmp     .L_align
-
-.L_slice:
-       /*
-        * If we get here, there's at least eight bytes of aligned input
-        * available. Make %edi multiple of four bytes. Store the possible
-        * remainder over the "size" variable in the argument stack.
-        */
-       movl    %edi, 0x18(%esp)
-       andl    $-4, %edi
-       subl    %edi, 0x18(%esp)
-
-       /*
-        * Let %edi be buf + size - 4 while running the main loop. This way
-        * we can compare for equality to determine when exit the loop.
-        */
-       addl    %esi, %edi
-       subl    $4, %edi
-
-       /* Read in the first four aligned bytes. */
-       movl    (%esi), %ecx
-
-.L_loop:
-       xorl    %eax, %ecx
-       movzbl  %cl, %ebp
-       movl    0x1800(%ebx, %ebp, 8), %eax
-       xorl    %edx, %eax
-       movl    0x1804(%ebx, %ebp, 8), %edx
-       movzbl  %ch, %ebp
-       xorl    0x1000(%ebx, %ebp, 8), %eax
-       xorl    0x1004(%ebx, %ebp, 8), %edx
-       shrl    $16, %ecx
-       movzbl  %cl, %ebp
-       xorl    0x0800(%ebx, %ebp, 8), %eax
-       xorl    0x0804(%ebx, %ebp, 8), %edx
-       movzbl  %ch, %ebp
-       addl    $4, %esi
-       xorl    (%ebx, %ebp, 8), %eax
-       xorl    4(%ebx, %ebp, 8), %edx
-
-       /* Check for end of aligned input. */
-       cmpl    %edi, %esi
-
-       /*
-        * Copy the next input byte to %ecx. It is slightly faster to
-        * read it here than at the top of the loop.
-        */
-       movl    (%esi), %ecx
-       jb      .L_loop
-
-       /*
-        * Process the remaining four bytes, which we have already
-        * copied to %ecx.
-        */
-       xorl    %eax, %ecx
-       movzbl  %cl, %ebp
-       movl    0x1800(%ebx, %ebp, 8), %eax
-       xorl    %edx, %eax
-       movl    0x1804(%ebx, %ebp, 8), %edx
-       movzbl  %ch, %ebp
-       xorl    0x1000(%ebx, %ebp, 8), %eax
-       xorl    0x1004(%ebx, %ebp, 8), %edx
-       shrl    $16, %ecx
-       movzbl  %cl, %ebp
-       xorl    0x0800(%ebx, %ebp, 8), %eax
-       xorl    0x0804(%ebx, %ebp, 8), %edx
-       movzbl  %ch, %ebp
-       addl    $4, %esi
-       xorl    (%ebx, %ebp, 8), %eax
-       xorl    4(%ebx, %ebp, 8), %edx
-
-       /* Copy the number of remaining bytes to %edi. */
-       movl    0x18(%esp), %edi
-
-.L_rest:
-       /* Check for end of input. */
-       testl   %edi, %edi
-       jz      .L_return
-
-       /* Calculate CRC of the next input byte. */
-       movzbl  (%esi), %ebp
-       incl    %esi
-       movzbl  %al, %ecx
-       xorl    %ecx, %ebp
-       shrdl   $8, %edx, %eax
-       xorl    (%ebx, %ebp, 8), %eax
-       shrl    $8, %edx
-       xorl    4(%ebx, %ebp, 8), %edx
-       decl    %edi
-       jmp     .L_rest
-
-.L_return:
-       /* Complement the final value. */
-       notl    %eax
-       notl    %edx
-
-       popl    %ebp
-       popl    %edi
-       popl    %esi
-       popl    %ebx
-       ret
-
-#if defined(PIC) || defined(__PIC__)
-       ALIGN(4, 16)
-.L_get_pc:
-       movl    (%esp), %ebx
-       ret
-#endif
-
-#if defined(__APPLE__) && (defined(PIC) || defined(__PIC__))
-       /* Mach-O PIC */
-       .section __IMPORT,__pointers,non_lazy_symbol_pointers
-.L_lzma_crc64_table$non_lazy_ptr:
-       .indirect_symbol LZMA_CRC64_TABLE
-       .long 0
-
-#elif defined(_WIN32) || defined(__CYGWIN__)
-#      ifdef DLL_EXPORT
-       /* This is equivalent of __declspec(dllexport). */
-       .section .drectve
-       .ascii " -export:lzma_crc64"
-#      endif
-
-#elif !defined(__MSDOS__)
-       /* ELF */
-       .size   LZMA_CRC64, .-LZMA_CRC64
-#endif
-
-/*
- * This is needed to support non-executable stack. It's ugly to
- * use __linux__ here, but I don't know a way to detect when
- * we are using GNU assembler.
- */
-#if defined(__ELF__) && defined(__linux__)
-       .section        .note.GNU-stack,"",@progbits
-#endif
index c1360ca..77d0a9b 100644 (file)
@@ -15,7 +15,7 @@
 #include "lz_decoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        lzma_next_coder next;
 
        enum {
@@ -46,17 +46,19 @@ struct lzma_coder_s {
        /// Options decoded from the header needed to initialize
        /// the LZMA decoder
        lzma_options_lzma options;
-};
+} lzma_alone_coder;
 
 
 static lzma_ret
-alone_decode(lzma_coder *coder,
+alone_decode(void *coder_ptr,
                const lzma_allocator *allocator lzma_attribute((__unused__)),
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size,
                lzma_action action)
 {
+       lzma_alone_coder *coder = coder_ptr;
+
        while (*out_pos < out_size
                        && (coder->sequence == SEQ_CODE || *in_pos < in_size))
        switch (coder->sequence) {
@@ -166,8 +168,9 @@ alone_decode(lzma_coder *coder,
 
 
 static void
-alone_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+alone_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_alone_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder, allocator);
        return;
@@ -175,9 +178,11 @@ alone_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+alone_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
                uint64_t *old_memlimit, uint64_t new_memlimit)
 {
+       lzma_alone_coder *coder = coder_ptr;
+
        *memusage = coder->memusage;
        *old_memlimit = coder->memlimit;
 
@@ -198,29 +203,29 @@ lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 {
        lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
 
-       if (memlimit == 0)
-               return LZMA_PROG_ERROR;
+       lzma_alone_coder *coder = next->coder;
 
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &alone_decode;
                next->end = &alone_decoder_end;
                next->memconfig = &alone_decoder_memconfig;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
-       next->coder->sequence = SEQ_PROPERTIES;
-       next->coder->picky = picky;
-       next->coder->pos = 0;
-       next->coder->options.dict_size = 0;
-       next->coder->options.preset_dict = NULL;
-       next->coder->options.preset_dict_size = 0;
-       next->coder->uncompressed_size = 0;
-       next->coder->memlimit = memlimit;
-       next->coder->memusage = LZMA_MEMUSAGE_BASE;
+       coder->sequence = SEQ_PROPERTIES;
+       coder->picky = picky;
+       coder->pos = 0;
+       coder->options.dict_size = 0;
+       coder->options.preset_dict = NULL;
+       coder->options.preset_dict_size = 0;
+       coder->uncompressed_size = 0;
+       coder->memlimit = my_max(1, memlimit);
+       coder->memusage = LZMA_MEMUSAGE_BASE;
 
        return LZMA_OK;
 }
index a2bc9ee..4853cfd 100644 (file)
@@ -17,7 +17,7 @@
 #define ALONE_HEADER_SIZE (1 + 4 + 8)
 
 
-struct lzma_coder_s {
+typedef struct {
        lzma_next_coder next;
 
        enum {
@@ -27,17 +27,19 @@ struct lzma_coder_s {
 
        size_t header_pos;
        uint8_t header[ALONE_HEADER_SIZE];
-};
+} lzma_alone_coder;
 
 
 static lzma_ret
-alone_encode(lzma_coder *coder,
+alone_encode(void *coder_ptr,
                const lzma_allocator *allocator lzma_attribute((__unused__)),
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size,
                lzma_action action)
 {
+       lzma_alone_coder *coder = coder_ptr;
+
        while (*out_pos < out_size)
        switch (coder->sequence) {
        case SEQ_HEADER:
@@ -65,8 +67,9 @@ alone_encode(lzma_coder *coder,
 
 
 static void
-alone_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+alone_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_alone_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder, allocator);
        return;
@@ -80,23 +83,26 @@ alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 {
        lzma_next_coder_init(&alone_encoder_init, next, allocator);
 
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_alone_coder *coder = next->coder;
+
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_alone_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &alone_encode;
                next->end = &alone_encoder_end;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
        // Basic initializations
-       next->coder->sequence = SEQ_HEADER;
-       next->coder->header_pos = 0;
+       coder->sequence = SEQ_HEADER;
+       coder->header_pos = 0;
 
        // Encode the header:
        // - Properties (1 byte)
-       if (lzma_lzma_lclppb_encode(options, next->coder->header))
+       if (lzma_lzma_lclppb_encode(options, coder->header))
                return LZMA_OPTIONS_ERROR;
 
        // - Dictionary size (4 bytes)
@@ -116,10 +122,10 @@ alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
        if (d != UINT32_MAX)
                ++d;
 
-       unaligned_write32le(next->coder->header + 1, d);
+       unaligned_write32le(coder->header + 1, d);
 
        // - Uncompressed size (always unknown and using EOPM)
-       memset(next->coder->header + 1 + 4, 0xFF, 8);
+       memset(coder->header + 1 + 4, 0xFF, 8);
 
        // Initialize the LZMA encoder.
        const lzma_filter_info filters[2] = {
@@ -131,7 +137,7 @@ alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                }
        };
 
-       return lzma_next_filter_init(&next->coder->next, allocator, filters);
+       return lzma_next_filter_init(&coder->next, allocator, filters);
 }
 
 
index bf35507..6895c7c 100644 (file)
@@ -14,7 +14,7 @@
 #include "alone_decoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        /// Stream decoder or LZMA_Alone decoder
        lzma_next_coder next;
 
@@ -26,15 +26,17 @@ struct lzma_coder_s {
                SEQ_CODE,
                SEQ_FINISH,
        } sequence;
-};
+} lzma_auto_coder;
 
 
 static lzma_ret
-auto_decode(lzma_coder *coder, const lzma_allocator *allocator,
+auto_decode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_auto_coder *coder = coder_ptr;
+
        switch (coder->sequence) {
        case SEQ_INIT:
                if (*in_pos >= in_size)
@@ -100,8 +102,9 @@ auto_decode(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-auto_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+auto_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_auto_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder, allocator);
        return;
@@ -109,8 +112,10 @@ auto_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_check
-auto_decoder_get_check(const lzma_coder *coder)
+auto_decoder_get_check(const void *coder_ptr)
 {
+       const lzma_auto_coder *coder = coder_ptr;
+
        // It is LZMA_Alone if get_check is NULL.
        return coder->next.get_check == NULL ? LZMA_CHECK_NONE
                        : coder->next.get_check(coder->next.coder);
@@ -118,9 +123,11 @@ auto_decoder_get_check(const lzma_coder *coder)
 
 
 static lzma_ret
-auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+auto_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
                uint64_t *old_memlimit, uint64_t new_memlimit)
 {
+       lzma_auto_coder *coder = coder_ptr;
+
        lzma_ret ret;
 
        if (coder->next.memconfig != NULL) {
@@ -132,7 +139,10 @@ auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
                // the current memory usage.
                *memusage = LZMA_MEMUSAGE_BASE;
                *old_memlimit = coder->memlimit;
+
                ret = LZMA_OK;
+               if (new_memlimit != 0 && new_memlimit < *memusage)
+                       ret = LZMA_MEMLIMIT_ERROR;
        }
 
        if (ret == LZMA_OK && new_memlimit != 0)
@@ -148,27 +158,26 @@ auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 {
        lzma_next_coder_init(&auto_decoder_init, next, allocator);
 
-       if (memlimit == 0)
-               return LZMA_PROG_ERROR;
-
        if (flags & ~LZMA_SUPPORTED_FLAGS)
                return LZMA_OPTIONS_ERROR;
 
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_auto_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_auto_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &auto_decode;
                next->end = &auto_decoder_end;
                next->get_check = &auto_decoder_get_check;
                next->memconfig = &auto_decoder_memconfig;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
-       next->coder->memlimit = memlimit;
-       next->coder->flags = flags;
-       next->coder->sequence = SEQ_INIT;
+       coder->memlimit = my_max(1, memlimit);
+       coder->flags = flags;
+       coder->sequence = SEQ_INIT;
 
        return LZMA_OK;
 }
index 685c3b0..075bd27 100644 (file)
@@ -15,7 +15,7 @@
 #include "check.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum {
                SEQ_CODE,
                SEQ_PADDING,
@@ -48,7 +48,7 @@ struct lzma_coder_s {
 
        /// True if the integrity check won't be calculated and verified.
        bool ignore_check;
-};
+} lzma_block_coder;
 
 
 static inline bool
@@ -74,11 +74,13 @@ is_size_valid(lzma_vli size, lzma_vli reference)
 
 
 static lzma_ret
-block_decode(lzma_coder *coder, const lzma_allocator *allocator,
+block_decode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_block_coder *coder = coder_ptr;
+
        switch (coder->sequence) {
        case SEQ_CODE: {
                const size_t in_start = *in_pos;
@@ -177,8 +179,9 @@ block_decode(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-block_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+block_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_block_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder, allocator);
        return;
@@ -198,27 +201,29 @@ lzma_block_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                        || !lzma_vli_is_valid(block->uncompressed_size))
                return LZMA_PROG_ERROR;
 
-       // Allocate and initialize *next->coder if needed.
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       // Allocate *next->coder if needed.
+       lzma_block_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_block_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &block_decode;
                next->end = &block_decoder_end;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
        // Basic initializations
-       next->coder->sequence = SEQ_CODE;
-       next->coder->block = block;
-       next->coder->compressed_size = 0;
-       next->coder->uncompressed_size = 0;
+       coder->sequence = SEQ_CODE;
+       coder->block = block;
+       coder->compressed_size = 0;
+       coder->uncompressed_size = 0;
 
        // If Compressed Size is not known, we calculate the maximum allowed
        // value so that encoded size of the Block (including Block Padding)
        // is still a valid VLI and a multiple of four.
-       next->coder->compressed_limit
+       coder->compressed_limit
                        = block->compressed_size == LZMA_VLI_UNKNOWN
                                ? (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
                                        - block->header_size
@@ -228,14 +233,14 @@ lzma_block_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
        // Initialize the check. It's caller's problem if the Check ID is not
        // supported, and the Block decoder cannot verify the Check field.
        // Caller can test lzma_check_is_supported(block->check).
-       next->coder->check_pos = 0;
-       lzma_check_init(&next->coder->check, block->check);
+       coder->check_pos = 0;
+       lzma_check_init(&coder->check, block->check);
 
-       next->coder->ignore_check = block->version >= 1
+       coder->ignore_check = block->version >= 1
                        ? block->ignore_check : false;
 
        // Initialize the filter chain.
-       return lzma_raw_decoder_init(&next->coder->next, allocator,
+       return lzma_raw_decoder_init(&coder->next, allocator,
                        block->filters);
 }
 
index def5864..168846a 100644 (file)
@@ -15,7 +15,7 @@
 #include "check.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        /// The filters in the chain; initialized with lzma_raw_decoder_init().
        lzma_next_coder next;
 
@@ -41,15 +41,17 @@ struct lzma_coder_s {
 
        /// Check of the uncompressed data
        lzma_check_state check;
-};
+} lzma_block_coder;
 
 
 static lzma_ret
-block_encode(lzma_coder *coder, const lzma_allocator *allocator,
+block_encode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_block_coder *coder = coder_ptr;
+
        // Check that our amount of input stays in proper limits.
        if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos)
                return LZMA_DATA_ERROR;
@@ -134,8 +136,9 @@ block_encode(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-block_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+block_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_block_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder, allocator);
        return;
@@ -143,10 +146,12 @@ block_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-block_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
+block_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
                const lzma_filter *filters lzma_attribute((__unused__)),
                const lzma_filter *reversed_filters)
 {
+       lzma_block_coder *coder = coder_ptr;
+
        if (coder->sequence != SEQ_CODE)
                return LZMA_PROG_ERROR;
 
@@ -178,30 +183,31 @@ lzma_block_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                return LZMA_UNSUPPORTED_CHECK;
 
        // Allocate and initialize *next->coder if needed.
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_block_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_block_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &block_encode;
                next->end = &block_encoder_end;
                next->update = &block_encoder_update;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
        // Basic initializations
-       next->coder->sequence = SEQ_CODE;
-       next->coder->block = block;
-       next->coder->compressed_size = 0;
-       next->coder->uncompressed_size = 0;
-       next->coder->pos = 0;
+       coder->sequence = SEQ_CODE;
+       coder->block = block;
+       coder->compressed_size = 0;
+       coder->uncompressed_size = 0;
+       coder->pos = 0;
 
        // Initialize the check
-       lzma_check_init(&next->coder->check, block->check);
+       lzma_check_init(&coder->check, block->check);
 
        // Initialize the requested filters.
-       return lzma_raw_encoder_init(&next->coder->next, allocator,
-                       block->filters);
+       return lzma_raw_encoder_init(&coder->next, allocator, block->filters);
 }
 
 
index 28aa2b7..57e3f8e 100644 (file)
@@ -435,8 +435,10 @@ lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
                        || strm->internal->next.memconfig == NULL)
                return LZMA_PROG_ERROR;
 
-       if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
-               return LZMA_MEMLIMIT_ERROR;
+       // Zero is a special value that cannot be used as an actual limit.
+       // If 0 was specified, use 1 instead.
+       if (new_memlimit == 0)
+               new_memlimit = 1;
 
        return strm->internal->next.memconfig(strm->internal->next.coder,
                        &memusage, &old_memlimit, new_memlimit);
index 955d784..b3d3b7a 100644 (file)
 #define LZMA_TIMED_OUT 32
 
 
-/// Type of encoder/decoder specific data; the actual structure is defined
-/// differently in different coders.
-typedef struct lzma_coder_s lzma_coder;
-
 typedef struct lzma_next_coder_s lzma_next_coder;
 
 typedef struct lzma_filter_info_s lzma_filter_info;
@@ -107,7 +103,7 @@ typedef lzma_ret (*lzma_init_function)(
 /// input and output buffers, but for simplicity they still use this same
 /// function prototype.
 typedef lzma_ret (*lzma_code_function)(
-               lzma_coder *coder, const lzma_allocator *allocator,
+               void *coder, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size,
@@ -115,7 +111,7 @@ typedef lzma_ret (*lzma_code_function)(
 
 /// Type of a function to free the memory allocated for the coder
 typedef void (*lzma_end_function)(
-               lzma_coder *coder, const lzma_allocator *allocator);
+               void *coder, const lzma_allocator *allocator);
 
 
 /// Raw coder validates and converts an array of lzma_filter structures to
@@ -138,7 +134,7 @@ struct lzma_filter_info_s {
 /// Hold data and function pointers of the next filter in the chain.
 struct lzma_next_coder_s {
        /// Pointer to coder-specific data
-       lzma_coder *coder;
+       void *coder;
 
        /// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't
        /// point to a filter coder.
@@ -160,21 +156,21 @@ struct lzma_next_coder_s {
 
        /// Pointer to a function to get progress information. If this is NULL,
        /// lzma_stream.total_in and .total_out are used instead.
-       void (*get_progress)(lzma_coder *coder,
+       void (*get_progress)(void *coder,
                        uint64_t *progress_in, uint64_t *progress_out);
 
        /// Pointer to function to return the type of the integrity check.
        /// Most coders won't support this.
-       lzma_check (*get_check)(const lzma_coder *coder);
+       lzma_check (*get_check)(const void *coder);
 
        /// Pointer to function to get and/or change the memory usage limit.
        /// If new_memlimit == 0, the limit is not changed.
-       lzma_ret (*memconfig)(lzma_coder *coder, uint64_t *memusage,
+       lzma_ret (*memconfig)(void *coder, uint64_t *memusage,
                        uint64_t *old_memlimit, uint64_t new_memlimit);
 
        /// Update the filter-specific options or the whole filter chain
        /// in the encoder.
-       lzma_ret (*update)(lzma_coder *coder, const lzma_allocator *allocator,
+       lzma_ret (*update)(void *coder, const lzma_allocator *allocator,
                        const lzma_filter *filters,
                        const lzma_filter *reversed_filters);
 };
index e897646..26e4e51 100644 (file)
@@ -202,22 +202,21 @@ index_tree_node_end(index_tree_node *node, const lzma_allocator *allocator,
        if (node->right != NULL)
                index_tree_node_end(node->right, allocator, free_func);
 
-       if (free_func != NULL)
-               free_func(node, allocator);
-
-       lzma_free(node, allocator);
+       free_func(node, allocator);
        return;
 }
 
 
-/// Free the meory allocated for a tree. If free_func is not NULL,
-/// it is called on each node before freeing the node. This is used
-/// to free the Record groups from each index_stream before freeing
-/// the index_stream itself.
+/// Free the memory allocated for a tree. Each node is freed using the
+/// given free_func which is either &lzma_free or &index_stream_end.
+/// The latter is used to free the Record groups from each index_stream
+/// before freeing the index_stream itself.
 static void
 index_tree_end(index_tree *tree, const lzma_allocator *allocator,
                void (*free_func)(void *node, const lzma_allocator *allocator))
 {
+       assert(free_func != NULL);
+
        if (tree->root != NULL)
                index_tree_node_end(tree->root, allocator, free_func);
 
@@ -371,7 +370,8 @@ static void
 index_stream_end(void *node, const lzma_allocator *allocator)
 {
        index_stream *s = node;
-       index_tree_end(&s->groups, allocator, NULL);
+       index_tree_end(&s->groups, allocator, &lzma_free);
+       lzma_free(s, allocator);
        return;
 }
 
@@ -829,6 +829,9 @@ lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
                                s->groups.rightmost = &newg->node;
 
                        lzma_free(g, allocator);
+
+                       // NOTE: newg isn't leaked here because
+                       // newg == (void *)&newg->node.
                }
        }
 
@@ -869,11 +872,8 @@ index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
        index_stream *dest = index_stream_init(src->node.compressed_base,
                        src->node.uncompressed_base, src->number,
                        src->block_number_base, allocator);
-
-       // Return immediately if allocation failed or if there are
-       // no groups to duplicate.
-       if (dest == NULL || src->groups.leftmost == NULL)
-               return dest;
+       if (dest == NULL)
+               return NULL;
 
        // Copy the overall information.
        dest->record_count = src->record_count;
@@ -881,6 +881,10 @@ index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
        dest->stream_flags = src->stream_flags;
        dest->stream_padding = src->stream_padding;
 
+       // Return if there are no groups to duplicate.
+       if (src->groups.leftmost == NULL)
+               return dest;
+
        // Allocate memory for the Records. We put all the Records into
        // a single group. It's simplest and also tends to make
        // lzma_index_locate() a little bit faster with very big Indexes.
index 795d183..cc07a1b 100644 (file)
@@ -14,7 +14,7 @@
 #include "check.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum {
                SEQ_INDICATOR,
                SEQ_COUNT,
@@ -50,11 +50,11 @@ struct lzma_coder_s {
 
        /// CRC32 of the List of Records field
        uint32_t crc32;
-};
+} lzma_index_coder;
 
 
 static lzma_ret
-index_decode(lzma_coder *coder, const lzma_allocator *allocator,
+index_decode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size,
                uint8_t *restrict out lzma_attribute((__unused__)),
@@ -62,6 +62,8 @@ index_decode(lzma_coder *coder, const lzma_allocator *allocator,
                size_t out_size lzma_attribute((__unused__)),
                lzma_action action lzma_attribute((__unused__)))
 {
+       lzma_index_coder *coder = coder_ptr;
+
        // Similar optimization as in index_encoder.c
        const size_t in_start = *in_pos;
        lzma_ret ret = LZMA_OK;
@@ -207,8 +209,9 @@ out:
 
 
 static void
-index_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+index_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_index_coder *coder = coder_ptr;
        lzma_index_end(coder->index, allocator);
        lzma_free(coder, allocator);
        return;
@@ -216,9 +219,11 @@ index_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+index_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
                uint64_t *old_memlimit, uint64_t new_memlimit)
 {
+       lzma_index_coder *coder = coder_ptr;
+
        *memusage = lzma_index_memusage(1, coder->count);
        *old_memlimit = coder->memlimit;
 
@@ -234,7 +239,7 @@ index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
 
 
 static lzma_ret
-index_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator,
+index_decoder_reset(lzma_index_coder *coder, const lzma_allocator *allocator,
                lzma_index **i, uint64_t memlimit)
 {
        // Remember the pointer given by the application. We will set it
@@ -251,7 +256,7 @@ index_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator,
 
        // Initialize the rest.
        coder->sequence = SEQ_INDICATOR;
-       coder->memlimit = memlimit;
+       coder->memlimit = my_max(1, memlimit);
        coder->count = 0; // Needs to be initialized due to _memconfig().
        coder->pos = 0;
        coder->crc32 = 0;
@@ -266,23 +271,25 @@ index_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 {
        lzma_next_coder_init(&index_decoder_init, next, allocator);
 
-       if (i == NULL || memlimit == 0)
+       if (i == NULL)
                return LZMA_PROG_ERROR;
 
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_index_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &index_decode;
                next->end = &index_decoder_end;
                next->memconfig = &index_decoder_memconfig;
-               next->coder->index = NULL;
+               coder->index = NULL;
        } else {
-               lzma_index_end(next->coder->index, allocator);
+               lzma_index_end(coder->index, allocator);
        }
 
-       return index_decoder_reset(next->coder, allocator, i, memlimit);
+       return index_decoder_reset(coder, allocator, i, memlimit);
 }
 
 
@@ -309,7 +316,7 @@ lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit,
                return LZMA_PROG_ERROR;
 
        // Initialize the decoder.
-       lzma_coder coder;
+       lzma_index_coder coder;
        return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit));
 
        // Store the input start position so that we can restore it in case
index d25ac7d..ac97d0c 100644 (file)
@@ -15,7 +15,7 @@
 #include "check.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum {
                SEQ_INDICATOR,
                SEQ_COUNT,
@@ -37,11 +37,11 @@ struct lzma_coder_s {
 
        /// CRC32 of the List of Records field
        uint32_t crc32;
-};
+} lzma_index_coder;
 
 
 static lzma_ret
-index_encode(lzma_coder *coder,
+index_encode(void *coder_ptr,
                const lzma_allocator *allocator lzma_attribute((__unused__)),
                const uint8_t *restrict in lzma_attribute((__unused__)),
                size_t *restrict in_pos lzma_attribute((__unused__)),
@@ -50,6 +50,8 @@ index_encode(lzma_coder *coder,
                size_t out_size,
                lzma_action action lzma_attribute((__unused__)))
 {
+       lzma_index_coder *coder = coder_ptr;
+
        // Position where to start calculating CRC32. The idea is that we
        // need to call lzma_crc32() only once per call to index_encode().
        const size_t out_start = *out_pos;
@@ -159,7 +161,7 @@ out:
 
 
 static void
-index_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+index_encoder_end(void *coder, const lzma_allocator *allocator)
 {
        lzma_free(coder, allocator);
        return;
@@ -167,7 +169,7 @@ index_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static void
-index_encoder_reset(lzma_coder *coder, const lzma_index *i)
+index_encoder_reset(lzma_index_coder *coder, const lzma_index *i)
 {
        lzma_index_iter_init(&coder->iter, i);
 
@@ -190,7 +192,7 @@ lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                return LZMA_PROG_ERROR;
 
        if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
+               next->coder = lzma_alloc(sizeof(lzma_index_coder), allocator);
                if (next->coder == NULL)
                        return LZMA_MEM_ERROR;
 
@@ -230,7 +232,7 @@ lzma_index_buffer_encode(const lzma_index *i,
 
        // The Index encoder needs just one small data structure so we can
        // allocate it on stack.
-       lzma_coder coder;
+       lzma_index_coder coder;
        index_encoder_reset(&coder, i);
 
        // Do the actual encoding. This should never fail, but store
index 3ab938c..fdd8ff2 100644 (file)
@@ -14,7 +14,7 @@
 #include "block_decoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum {
                SEQ_STREAM_HEADER,
                SEQ_BLOCK_HEADER,
@@ -80,11 +80,11 @@ struct lzma_coder_s {
        /// Buffer to hold Stream Header, Block Header, and Stream Footer.
        /// Block Header has biggest maximum size.
        uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX];
-};
+} lzma_stream_coder;
 
 
 static lzma_ret
-stream_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator)
+stream_decoder_reset(lzma_stream_coder *coder, const lzma_allocator *allocator)
 {
        // Initialize the Index hash used to verify the Index.
        coder->index_hash = lzma_index_hash_init(coder->index_hash, allocator);
@@ -100,11 +100,13 @@ stream_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-stream_decode(lzma_coder *coder, const lzma_allocator *allocator,
+stream_decode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        // When decoding the actual Block, it may be able to produce more
        // output even if we don't give it any new input.
        while (true)
@@ -375,8 +377,9 @@ stream_decode(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-stream_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+stream_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_stream_coder *coder = coder_ptr;
        lzma_next_end(&coder->block_decoder, allocator);
        lzma_index_hash_end(coder->index_hash, allocator);
        lzma_free(coder, allocator);
@@ -385,16 +388,19 @@ stream_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_check
-stream_decoder_get_check(const lzma_coder *coder)
+stream_decoder_get_check(const void *coder_ptr)
 {
+       const lzma_stream_coder *coder = coder_ptr;
        return coder->stream_flags.check;
 }
 
 
 static lzma_ret
-stream_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
+stream_decoder_memconfig(void *coder_ptr, uint64_t *memusage,
                uint64_t *old_memlimit, uint64_t new_memlimit)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        *memusage = coder->memusage;
        *old_memlimit = coder->memlimit;
 
@@ -416,37 +422,36 @@ lzma_stream_decoder_init(
 {
        lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator);
 
-       if (memlimit == 0)
-               return LZMA_PROG_ERROR;
-
        if (flags & ~LZMA_SUPPORTED_FLAGS)
                return LZMA_OPTIONS_ERROR;
 
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_stream_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_stream_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &stream_decode;
                next->end = &stream_decoder_end;
                next->get_check = &stream_decoder_get_check;
                next->memconfig = &stream_decoder_memconfig;
 
-               next->coder->block_decoder = LZMA_NEXT_CODER_INIT;
-               next->coder->index_hash = NULL;
+               coder->block_decoder = LZMA_NEXT_CODER_INIT;
+               coder->index_hash = NULL;
        }
 
-       next->coder->memlimit = memlimit;
-       next->coder->memusage = LZMA_MEMUSAGE_BASE;
-       next->coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0;
-       next->coder->tell_unsupported_check
+       coder->memlimit = my_max(1, memlimit);
+       coder->memusage = LZMA_MEMUSAGE_BASE;
+       coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0;
+       coder->tell_unsupported_check
                        = (flags & LZMA_TELL_UNSUPPORTED_CHECK) != 0;
-       next->coder->tell_any_check = (flags & LZMA_TELL_ANY_CHECK) != 0;
-       next->coder->ignore_check = (flags & LZMA_IGNORE_CHECK) != 0;
-       next->coder->concatenated = (flags & LZMA_CONCATENATED) != 0;
-       next->coder->first_stream = true;
+       coder->tell_any_check = (flags & LZMA_TELL_ANY_CHECK) != 0;
+       coder->ignore_check = (flags & LZMA_IGNORE_CHECK) != 0;
+       coder->concatenated = (flags & LZMA_CONCATENATED) != 0;
+       coder->first_stream = true;
 
-       return stream_decoder_reset(next->coder, allocator);
+       return stream_decoder_reset(coder, allocator);
 }
 
 
index a7663bc..858cba4 100644 (file)
@@ -14,7 +14,7 @@
 #include "index_encoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum {
                SEQ_STREAM_HEADER,
                SEQ_BLOCK_INIT,
@@ -55,11 +55,11 @@ struct lzma_coder_s {
        /// Buffer to hold Stream Header, Block Header, and Stream Footer.
        /// Block Header has biggest maximum size.
        uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX];
-};
+} lzma_stream_coder;
 
 
 static lzma_ret
-block_encoder_init(lzma_coder *coder, const lzma_allocator *allocator)
+block_encoder_init(lzma_stream_coder *coder, const lzma_allocator *allocator)
 {
        // Prepare the Block options. Even though Block encoder doesn't need
        // compressed_size, uncompressed_size, and header_size to be
@@ -78,11 +78,13 @@ block_encoder_init(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-stream_encode(lzma_coder *coder, const lzma_allocator *allocator,
+stream_encode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        // Main loop
        while (*out_pos < out_size)
        switch (coder->sequence) {
@@ -209,8 +211,10 @@ stream_encode(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-stream_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+stream_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        lzma_next_end(&coder->block_encoder, allocator);
        lzma_next_end(&coder->index_encoder, allocator);
        lzma_index_end(coder->index, allocator);
@@ -224,10 +228,12 @@ stream_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-stream_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
+stream_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
                const lzma_filter *filters,
                const lzma_filter *reversed_filters)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        if (coder->sequence <= SEQ_BLOCK_INIT) {
                // There is no incomplete Block waiting to be finished,
                // thus we can change the whole filter chain. Start by
@@ -271,30 +277,33 @@ stream_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
        if (filters == NULL)
                return LZMA_PROG_ERROR;
 
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_stream_coder *coder = next->coder;
+
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_stream_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &stream_encode;
                next->end = &stream_encoder_end;
                next->update = &stream_encoder_update;
 
-               next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
-               next->coder->block_encoder = LZMA_NEXT_CODER_INIT;
-               next->coder->index_encoder = LZMA_NEXT_CODER_INIT;
-               next->coder->index = NULL;
+               coder->filters[0].id = LZMA_VLI_UNKNOWN;
+               coder->block_encoder = LZMA_NEXT_CODER_INIT;
+               coder->index_encoder = LZMA_NEXT_CODER_INIT;
+               coder->index = NULL;
        }
 
        // Basic initializations
-       next->coder->sequence = SEQ_STREAM_HEADER;
-       next->coder->block_options.version = 0;
-       next->coder->block_options.check = check;
+       coder->sequence = SEQ_STREAM_HEADER;
+       coder->block_options.version = 0;
+       coder->block_options.check = check;
 
        // Initialize the Index
-       lzma_index_end(next->coder->index, allocator);
-       next->coder->index = lzma_index_init(allocator);
-       if (next->coder->index == NULL)
+       lzma_index_end(coder->index, allocator);
+       coder->index = lzma_index_init(allocator);
+       if (coder->index == NULL)
                return LZMA_MEM_ERROR;
 
        // Encode the Stream Header
@@ -303,16 +312,15 @@ stream_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                .check = check,
        };
        return_if_error(lzma_stream_header_encode(
-                       &stream_flags, next->coder->buffer));
+                       &stream_flags, coder->buffer));
 
-       next->coder->buffer_pos = 0;
-       next->coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
+       coder->buffer_pos = 0;
+       coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
 
        // Initialize the Block encoder. This way we detect unsupported
        // filter chains when initializing the Stream encoder instead of
        // giving an error after Stream Header has already written out.
-       return stream_encoder_update(
-                       next->coder, allocator, filters, NULL);
+       return stream_encoder_update(coder, allocator, filters, NULL);
 }
 
 
index 9780ed0..2efe44c 100644 (file)
@@ -44,6 +44,7 @@ typedef enum {
 
 } worker_state;
 
+typedef struct lzma_stream_coder_s lzma_stream_coder;
 
 typedef struct worker_thread_s worker_thread;
 struct worker_thread_s {
@@ -65,7 +66,7 @@ struct worker_thread_s {
 
        /// Pointer to the main structure is needed when putting this
        /// thread back to the stack of free threads.
-       lzma_coder *coder;
+       lzma_stream_coder *coder;
 
        /// The allocator is set by the main thread. Since a copy of the
        /// pointer is kept here, the application must not change the
@@ -96,7 +97,7 @@ struct worker_thread_s {
 };
 
 
-struct lzma_coder_s {
+struct lzma_stream_coder_s {
        enum {
                SEQ_STREAM_HEADER,
                SEQ_BLOCK,
@@ -417,7 +418,7 @@ worker_start(void *thr_ptr)
 
 /// Make the threads stop but not exit. Optionally wait for them to stop.
 static void
-threads_stop(lzma_coder *coder, bool wait_for_threads)
+threads_stop(lzma_stream_coder *coder, bool wait_for_threads)
 {
        // Tell the threads to stop.
        for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
@@ -446,7 +447,7 @@ threads_stop(lzma_coder *coder, bool wait_for_threads)
 /// Stop the threads and free the resources associated with them.
 /// Wait until the threads have exited.
 static void
-threads_end(lzma_coder *coder, const lzma_allocator *allocator)
+threads_end(lzma_stream_coder *coder, const lzma_allocator *allocator)
 {
        for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
                mythread_sync(coder->threads[i].mutex) {
@@ -468,7 +469,8 @@ threads_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 /// Initialize a new worker_thread structure and create a new thread.
 static lzma_ret
-initialize_new_thread(lzma_coder *coder, const lzma_allocator *allocator)
+initialize_new_thread(lzma_stream_coder *coder,
+               const lzma_allocator *allocator)
 {
        worker_thread *thr = &coder->threads[coder->threads_initialized];
 
@@ -510,7 +512,7 @@ error_mutex:
 
 
 static lzma_ret
-get_thread(lzma_coder *coder, const lzma_allocator *allocator)
+get_thread(lzma_stream_coder *coder, const lzma_allocator *allocator)
 {
        // If there are no free output subqueues, there is no
        // point to try getting a thread.
@@ -548,7 +550,7 @@ get_thread(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-stream_encode_in(lzma_coder *coder, const lzma_allocator *allocator,
+stream_encode_in(lzma_stream_coder *coder, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, lzma_action action)
 {
@@ -616,7 +618,7 @@ stream_encode_in(lzma_coder *coder, const lzma_allocator *allocator,
 /// Wait until more input can be consumed, more output can be read, or
 /// an optional timeout is reached.
 static bool
-wait_for_work(lzma_coder *coder, mythread_condtime *wait_abs,
+wait_for_work(lzma_stream_coder *coder, mythread_condtime *wait_abs,
                bool *has_blocked, bool has_input)
 {
        if (coder->timeout != 0 && !*has_blocked) {
@@ -662,11 +664,13 @@ wait_for_work(lzma_coder *coder, mythread_condtime *wait_abs,
 
 
 static lzma_ret
-stream_encode_mt(lzma_coder *coder, const lzma_allocator *allocator,
+stream_encode_mt(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        switch (coder->sequence) {
        case SEQ_STREAM_HEADER:
                lzma_bufcpy(coder->header, &coder->header_pos,
@@ -834,8 +838,10 @@ stream_encode_mt(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-stream_encoder_mt_end(lzma_coder *coder, const lzma_allocator *allocator)
+stream_encoder_mt_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        // Threads must be killed before the output queue can be freed.
        threads_end(coder, allocator);
        lzma_outq_end(&coder->outq, allocator);
@@ -907,10 +913,12 @@ get_options(const lzma_mt *options, lzma_options_easy *opt_easy,
 
 
 static void
-get_progress(lzma_coder *coder, uint64_t *progress_in, uint64_t *progress_out)
+get_progress(void *coder_ptr, uint64_t *progress_in, uint64_t *progress_out)
 {
+       lzma_stream_coder *coder = coder_ptr;
+
        // Lock coder->mutex to prevent finishing threads from moving their
-       // progress info from the worker_thread structure to lzma_coder.
+       // progress info from the worker_thread structure to lzma_stream_coder.
        mythread_sync(coder->mutex) {
                *progress_in = coder->progress_in;
                *progress_out = coder->progress_out;
@@ -962,24 +970,27 @@ stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator,
                return LZMA_UNSUPPORTED_CHECK;
 
        // Allocate and initialize the base structure if needed.
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_stream_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_stream_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
+
                // For the mutex and condition variable initializations
                // the error handling has to be done here because
                // stream_encoder_mt_end() doesn't know if they have
                // already been initialized or not.
-               if (mythread_mutex_init(&next->coder->mutex)) {
-                       lzma_free(next->coder, allocator);
+               if (mythread_mutex_init(&coder->mutex)) {
+                       lzma_free(coder, allocator);
                        next->coder = NULL;
                        return LZMA_MEM_ERROR;
                }
 
-               if (mythread_cond_init(&next->coder->cond)) {
-                       mythread_mutex_destroy(&next->coder->mutex);
-                       lzma_free(next->coder, allocator);
+               if (mythread_cond_init(&coder->cond)) {
+                       mythread_mutex_destroy(&coder->mutex);
+                       lzma_free(coder, allocator);
                        next->coder = NULL;
                        return LZMA_MEM_ERROR;
                }
@@ -989,76 +1000,76 @@ stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator,
                next->get_progress = &get_progress;
 //             next->update = &stream_encoder_mt_update;
 
-               next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
-               next->coder->index_encoder = LZMA_NEXT_CODER_INIT;
-               next->coder->index = NULL;
-               memzero(&next->coder->outq, sizeof(next->coder->outq));
-               next->coder->threads = NULL;
-               next->coder->threads_max = 0;
-               next->coder->threads_initialized = 0;
+               coder->filters[0].id = LZMA_VLI_UNKNOWN;
+               coder->index_encoder = LZMA_NEXT_CODER_INIT;
+               coder->index = NULL;
+               memzero(&coder->outq, sizeof(coder->outq));
+               coder->threads = NULL;
+               coder->threads_max = 0;
+               coder->threads_initialized = 0;
        }
 
        // Basic initializations
-       next->coder->sequence = SEQ_STREAM_HEADER;
-       next->coder->block_size = (size_t)(block_size);
-       next->coder->thread_error = LZMA_OK;
-       next->coder->thr = NULL;
+       coder->sequence = SEQ_STREAM_HEADER;
+       coder->block_size = (size_t)(block_size);
+       coder->thread_error = LZMA_OK;
+       coder->thr = NULL;
 
        // Allocate the thread-specific base structures.
        assert(options->threads > 0);
-       if (next->coder->threads_max != options->threads) {
-               threads_end(next->coder, allocator);
+       if (coder->threads_max != options->threads) {
+               threads_end(coder, allocator);
 
-               next->coder->threads = NULL;
-               next->coder->threads_max = 0;
+               coder->threads = NULL;
+               coder->threads_max = 0;
 
-               next->coder->threads_initialized = 0;
-               next->coder->threads_free = NULL;
+               coder->threads_initialized = 0;
+               coder->threads_free = NULL;
 
-               next->coder->threads = lzma_alloc(
+               coder->threads = lzma_alloc(
                                options->threads * sizeof(worker_thread),
                                allocator);
-               if (next->coder->threads == NULL)
+               if (coder->threads == NULL)
                        return LZMA_MEM_ERROR;
 
-               next->coder->threads_max = options->threads;
+               coder->threads_max = options->threads;
        } else {
                // Reuse the old structures and threads. Tell the running
                // threads to stop and wait until they have stopped.
-               threads_stop(next->coder, true);
+               threads_stop(coder, true);
        }
 
        // Output queue
-       return_if_error(lzma_outq_init(&next->coder->outq, allocator,
+       return_if_error(lzma_outq_init(&coder->outq, allocator,
                        outbuf_size_max, options->threads));
 
        // Timeout
-       next->coder->timeout = options->timeout;
+       coder->timeout = options->timeout;
 
        // Free the old filter chain and copy the new one.
-       for (size_t i = 0; next->coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
-               lzma_free(next->coder->filters[i].options, allocator);
+       for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
+               lzma_free(coder->filters[i].options, allocator);
 
        return_if_error(lzma_filters_copy(
-                       filters, next->coder->filters, allocator));
+                       filters, coder->filters, allocator));
 
        // Index
-       lzma_index_end(next->coder->index, allocator);
-       next->coder->index = lzma_index_init(allocator);
-       if (next->coder->index == NULL)
+       lzma_index_end(coder->index, allocator);
+       coder->index = lzma_index_init(allocator);
+       if (coder->index == NULL)
                return LZMA_MEM_ERROR;
 
        // Stream Header
-       next->coder->stream_flags.version = 0;
-       next->coder->stream_flags.check = options->check;
+       coder->stream_flags.version = 0;
+       coder->stream_flags.check = options->check;
        return_if_error(lzma_stream_header_encode(
-                       &next->coder->stream_flags, next->coder->header));
+                       &coder->stream_flags, coder->header));
 
-       next->coder->header_pos = 0;
+       coder->header_pos = 0;
 
        // Progress info
-       next->coder->progress_in = 0;
-       next->coder->progress_out = LZMA_STREAM_HEADER_SIZE;
+       coder->progress_in = 0;
+       coder->progress_out = LZMA_STREAM_HEADER_SIZE;
 
        return LZMA_OK;
 }
@@ -1111,7 +1122,8 @@ lzma_stream_encoder_mt_memusage(const lzma_mt *options)
                return UINT64_MAX;
 
        // Sum them with overflow checking.
-       uint64_t total_memusage = LZMA_MEMUSAGE_BASE + sizeof(lzma_coder)
+       uint64_t total_memusage = LZMA_MEMUSAGE_BASE
+                       + sizeof(lzma_stream_coder)
                        + options->threads * sizeof(worker_thread);
 
        if (UINT64_MAX - total_memusage < inbuf_memusage)
index 13dd468..4768201 100644 (file)
@@ -15,8 +15,9 @@
 
 
 static void
-delta_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
+delta_coder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_delta_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder, allocator);
        return;
@@ -28,14 +29,17 @@ lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                const lzma_filter_info *filters)
 {
        // Allocate memory for the decoder if needed.
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_delta_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_delta_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
+
                // End function is the same for encoder and decoder.
                next->end = &delta_coder_end;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
        // Validate the options.
@@ -44,15 +48,14 @@ lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 
        // Set the delta distance.
        const lzma_options_delta *opt = filters[0].options;
-       next->coder->distance = opt->dist;
+       coder->distance = opt->dist;
 
        // Initialize the rest of the variables.
-       next->coder->pos = 0;
-       memzero(next->coder->history, LZMA_DELTA_DIST_MAX);
+       coder->pos = 0;
+       memzero(coder->history, LZMA_DELTA_DIST_MAX);
 
        // Initialize the next decoder in the chain, if any.
-       return lzma_next_filter_init(&next->coder->next,
-                       allocator, filters + 1);
+       return lzma_next_filter_init(&coder->next, allocator, filters + 1);
 }
 
 
@@ -66,5 +69,5 @@ lzma_delta_coder_memusage(const void *options)
                        || opt->dist > LZMA_DELTA_DIST_MAX)
                return UINT64_MAX;
 
-       return sizeof(lzma_coder);
+       return sizeof(lzma_delta_coder);
 }
index 726d023..6859afa 100644 (file)
@@ -15,7 +15,7 @@
 
 
 static void
-decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size)
+decode_buffer(lzma_delta_coder *coder, uint8_t *buffer, size_t size)
 {
        const size_t distance = coder->distance;
 
@@ -27,11 +27,13 @@ decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size)
 
 
 static lzma_ret
-delta_decode(lzma_coder *coder, const lzma_allocator *allocator,
+delta_decode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_delta_coder *coder = coder_ptr;
+
        assert(coder->next.code != NULL);
 
        const size_t out_start = *out_pos;
index 5a84263..3841651 100644 (file)
@@ -18,7 +18,7 @@
 /// is the first filter in the chain (and thus the last filter in the
 /// encoder's filter stack).
 static void
-copy_and_encode(lzma_coder *coder,
+copy_and_encode(lzma_delta_coder *coder,
                const uint8_t *restrict in, uint8_t *restrict out, size_t size)
 {
        const size_t distance = coder->distance;
@@ -35,7 +35,7 @@ copy_and_encode(lzma_coder *coder,
 /// Encodes the data in place. This is used when we are the last filter
 /// in the chain (and thus non-last filter in the encoder's filter stack).
 static void
-encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size)
+encode_in_place(lzma_delta_coder *coder, uint8_t *buffer, size_t size)
 {
        const size_t distance = coder->distance;
 
@@ -49,11 +49,13 @@ encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size)
 
 
 static lzma_ret
-delta_encode(lzma_coder *coder, const lzma_allocator *allocator,
+delta_encode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_delta_coder *coder = coder_ptr;
+
        lzma_ret ret;
 
        if (coder->next.code == NULL) {
@@ -84,10 +86,12 @@ delta_encode(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static lzma_ret
-delta_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
+delta_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
                const lzma_filter *filters_null lzma_attribute((__unused__)),
                const lzma_filter *reversed_filters)
 {
+       lzma_delta_coder *coder = coder_ptr;
+
        // Delta doesn't and will never support changing the options in
        // the middle of encoding. If the app tries to change them, we
        // simply ignore them.
index 46ce0c6..0d6cb38 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "delta_common.h"
 
-struct lzma_coder_s {
+typedef struct {
        /// Next coder in the chain
        lzma_next_coder next;
 
@@ -27,7 +27,7 @@ struct lzma_coder_s {
 
        /// Buffer to hold history of the original data
        uint8_t history[LZMA_DELTA_DIST_MAX];
-};
+} lzma_delta_coder;
 
 
 extern lzma_ret lzma_delta_coder_init(
index 2328a8e..c708644 100644 (file)
@@ -20,7 +20,7 @@
 #include "lz_decoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        /// Dictionary (history buffer)
        lzma_dict dict;
 
@@ -48,7 +48,7 @@ struct lzma_coder_s {
                size_t size;
                uint8_t buffer[LZMA_BUFFER_SIZE];
        } temp;
-};
+} lzma_coder;
 
 
 static void
@@ -125,13 +125,15 @@ decode_buffer(lzma_coder *coder,
 
 
 static lzma_ret
-lz_decode(lzma_coder *coder,
+lz_decode(void *coder_ptr,
                const lzma_allocator *allocator lzma_attribute((__unused__)),
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size,
                lzma_action action)
 {
+       lzma_coder *coder = coder_ptr;
+
        if (coder->next.code == NULL)
                return decode_buffer(coder, in, in_pos, in_size,
                                out, out_pos, out_size);
@@ -184,8 +186,10 @@ lz_decode(lzma_coder *coder,
 
 
 static void
-lz_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+lz_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_coder *coder = coder_ptr;
+
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder->dict.buf, allocator);
 
@@ -207,24 +211,26 @@ lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                        lzma_lz_options *lz_options))
 {
        // Allocate the base structure if it isn't already allocated.
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &lz_decode;
                next->end = &lz_decoder_end;
 
-               next->coder->dict.buf = NULL;
-               next->coder->dict.size = 0;
-               next->coder->lz = LZMA_LZ_DECODER_INIT;
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->dict.buf = NULL;
+               coder->dict.size = 0;
+               coder->lz = LZMA_LZ_DECODER_INIT;
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
        // Allocate and initialize the LZ-based decoder. It will also give
        // us the dictionary size.
        lzma_lz_options lz_options;
-       return_if_error(lz_init(&next->coder->lz, allocator,
+       return_if_error(lz_init(&coder->lz, allocator,
                        filters[0].options, &lz_options));
 
        // If the dictionary size is very small, increase it to 4096 bytes.
@@ -248,14 +254,14 @@ lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
        lz_options.dict_size = (lz_options.dict_size + 15) & ~((size_t)(15));
 
        // Allocate and initialize the dictionary.
-       if (next->coder->dict.size != lz_options.dict_size) {
-               lzma_free(next->coder->dict.buf, allocator);
-               next->coder->dict.buf
+       if (coder->dict.size != lz_options.dict_size) {
+               lzma_free(coder->dict.buf, allocator);
+               coder->dict.buf
                                = lzma_alloc(lz_options.dict_size, allocator);
-               if (next->coder->dict.buf == NULL)
+               if (coder->dict.buf == NULL)
                        return LZMA_MEM_ERROR;
 
-               next->coder->dict.size = lz_options.dict_size;
+               coder->dict.size = lz_options.dict_size;
        }
 
        lz_decoder_reset(next->coder);
@@ -268,21 +274,20 @@ lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                const size_t copy_size = my_min(lz_options.preset_dict_size,
                                lz_options.dict_size);
                const size_t offset = lz_options.preset_dict_size - copy_size;
-               memcpy(next->coder->dict.buf, lz_options.preset_dict + offset,
+               memcpy(coder->dict.buf, lz_options.preset_dict + offset,
                                copy_size);
-               next->coder->dict.pos = copy_size;
-               next->coder->dict.full = copy_size;
+               coder->dict.pos = copy_size;
+               coder->dict.full = copy_size;
        }
 
        // Miscellaneous initializations
-       next->coder->next_finished = false;
-       next->coder->this_finished = false;
-       next->coder->temp.pos = 0;
-       next->coder->temp.size = 0;
+       coder->next_finished = false;
+       coder->this_finished = false;
+       coder->temp.pos = 0;
+       coder->temp.size = 0;
 
        // Initialize the next filter in the chain, if any.
-       return lzma_next_filter_init(&next->coder->next, allocator,
-                       filters + 1);
+       return lzma_next_filter_init(&coder->next, allocator, filters + 1);
 }
 
 
@@ -294,7 +299,8 @@ lzma_lz_decoder_memusage(size_t dictionary_size)
 
 
 extern void
-lzma_lz_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
+lzma_lz_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
 {
+       lzma_coder *coder = coder_ptr;
        coder->lz.set_uncompressed(coder->lz.coder, uncompressed_size);
 }
index 277900a..754ccf3 100644 (file)
@@ -53,21 +53,20 @@ typedef struct {
 
 typedef struct {
        /// Data specific to the LZ-based decoder
-       lzma_coder *coder;
+       void *coder;
 
        /// Function to decode from in[] to *dict
-       lzma_ret (*code)(lzma_coder *restrict coder,
+       lzma_ret (*code)(void *coder,
                        lzma_dict *restrict dict, const uint8_t *restrict in,
                        size_t *restrict in_pos, size_t in_size);
 
-       void (*reset)(lzma_coder *coder, const void *options);
+       void (*reset)(void *coder, const void *options);
 
        /// Set the uncompressed size
-       void (*set_uncompressed)(lzma_coder *coder,
-                       lzma_vli uncompressed_size);
+       void (*set_uncompressed)(void *coder, lzma_vli uncompressed_size);
 
        /// Free allocated resources
-       void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
+       void (*end)(void *coder, const lzma_allocator *allocator);
 
 } lzma_lz_decoder;
 
@@ -92,7 +91,7 @@ extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next,
 extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size);
 
 extern void lzma_lz_decoder_uncompressed(
-               lzma_coder *coder, lzma_vli uncompressed_size);
+               void *coder, lzma_vli uncompressed_size);
 
 
 //////////////////////
index 48bc487..9a74b7c 100644 (file)
@@ -23,7 +23,7 @@
 #include "memcmplen.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        /// LZ-based encoder e.g. LZMA
        lzma_lz_encoder lz;
 
@@ -32,7 +32,7 @@ struct lzma_coder_s {
 
        /// Next coder in the chain
        lzma_next_coder next;
-};
+} lzma_coder;
 
 
 /// \brief      Moves the data in the input window to free space for new data
@@ -157,12 +157,14 @@ fill_window(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static lzma_ret
-lz_encode(lzma_coder *coder, const lzma_allocator *allocator,
+lz_encode(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size,
                uint8_t *restrict out, size_t *restrict out_pos,
                size_t out_size, lzma_action action)
 {
+       lzma_coder *coder = coder_ptr;
+
        while (*out_pos < out_size
                        && (*in_pos < in_size || action != LZMA_RUN)) {
                // Read more data to coder->mf.buffer if needed.
@@ -481,8 +483,10 @@ lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
 
 
 static void
-lz_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+lz_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_coder *coder = coder_ptr;
+
        lzma_next_end(&coder->next, allocator);
 
        lzma_free(coder->mf.son, allocator);
@@ -500,10 +504,12 @@ lz_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-lz_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
+lz_encoder_update(void *coder_ptr, const lzma_allocator *allocator,
                const lzma_filter *filters_null lzma_attribute((__unused__)),
                const lzma_filter *reversed_filters)
 {
+       lzma_coder *coder = coder_ptr;
+
        if (coder->lz.options_update == NULL)
                return LZMA_PROG_ERROR;
 
@@ -528,46 +534,51 @@ lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 #endif
 
        // Allocate and initialize the base data structure.
-       if (next->coder == NULL) {
-               next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (next->coder == NULL)
+       lzma_coder *coder = next->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &lz_encode;
                next->end = &lz_encoder_end;
                next->update = &lz_encoder_update;
 
-               next->coder->lz.coder = NULL;
-               next->coder->lz.code = NULL;
-               next->coder->lz.end = NULL;
-
-               next->coder->mf.buffer = NULL;
-               next->coder->mf.hash = NULL;
-               next->coder->mf.son = NULL;
-               next->coder->mf.hash_count = 0;
-               next->coder->mf.sons_count = 0;
-
-               next->coder->next = LZMA_NEXT_CODER_INIT;
+               coder->lz.coder = NULL;
+               coder->lz.code = NULL;
+               coder->lz.end = NULL;
+
+               // mf.size is initialized to silence Valgrind
+               // when used on optimized binaries (GCC may reorder
+               // code in a way that Valgrind gets unhappy).
+               coder->mf.buffer = NULL;
+               coder->mf.size = 0;
+               coder->mf.hash = NULL;
+               coder->mf.son = NULL;
+               coder->mf.hash_count = 0;
+               coder->mf.sons_count = 0;
+
+               coder->next = LZMA_NEXT_CODER_INIT;
        }
 
        // Initialize the LZ-based encoder.
        lzma_lz_options lz_options;
-       return_if_error(lz_init(&next->coder->lz, allocator,
+       return_if_error(lz_init(&coder->lz, allocator,
                        filters[0].options, &lz_options));
 
-       // Setup the size information into next->coder->mf and deallocate
+       // Setup the size information into coder->mf and deallocate
        // old buffers if they have wrong size.
-       if (lz_encoder_prepare(&next->coder->mf, allocator, &lz_options))
+       if (lz_encoder_prepare(&coder->mf, allocator, &lz_options))
                return LZMA_OPTIONS_ERROR;
 
        // Allocate new buffers if needed, and do the rest of
        // the initialization.
-       if (lz_encoder_init(&next->coder->mf, allocator, &lz_options))
+       if (lz_encoder_init(&coder->mf, allocator, &lz_options))
                return LZMA_MEM_ERROR;
 
        // Initialize the next filter in the chain, if any.
-       return lzma_next_filter_init(&next->coder->next, allocator,
-                       filters + 1);
+       return lzma_next_filter_init(&coder->next, allocator, filters + 1);
 }
 
 
index dad9c6b..426dcd8 100644 (file)
@@ -191,19 +191,18 @@ typedef struct {
 
 typedef struct {
        /// Data specific to the LZ-based encoder
-       lzma_coder *coder;
+       void *coder;
 
        /// Function to encode from *dict to out[]
-       lzma_ret (*code)(lzma_coder *restrict coder,
+       lzma_ret (*code)(void *coder,
                        lzma_mf *restrict mf, uint8_t *restrict out,
                        size_t *restrict out_pos, size_t out_size);
 
        /// Free allocated resources
-       void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
+       void (*end)(void *coder, const lzma_allocator *allocator);
 
        /// Update the options in the middle of the encoding.
-       lzma_ret (*options_update)(lzma_coder *coder,
-                       const lzma_filter *filter);
+       lzma_ret (*options_update)(void *coder, const lzma_filter *filter);
 
 } lzma_lz_encoder;
 
diff --git a/contrib/xz/src/liblzma/lz/lz_encoder_hash_table.h b/contrib/xz/src/liblzma/lz/lz_encoder_hash_table.h
deleted file mode 100644 (file)
index 8c51717..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-/* This file has been automatically generated by crc32_tablegen.c. */
-
-const uint32_t lzma_lz_hash_table[256] = {
-       0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
-       0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
-       0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
-       0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
-       0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
-       0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
-       0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
-       0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
-       0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
-       0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
-       0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
-       0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
-       0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
-       0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
-       0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
-       0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
-       0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
-       0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
-       0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
-       0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
-       0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
-       0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
-       0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
-       0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
-       0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
-       0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
-       0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
-       0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
-       0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
-       0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
-       0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
-       0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
-       0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
-       0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
-       0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
-       0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
-       0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
-       0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
-       0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
-       0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
-       0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
-       0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
-       0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
-       0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
-       0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
-       0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
-       0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
-       0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
-       0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
-       0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
-       0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
-       0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
-       0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
-       0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
-       0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
-       0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
-       0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
-       0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
-       0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
-       0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
-       0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
-       0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
-       0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
-       0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
-};
diff --git a/contrib/xz/src/liblzma/lzma/fastpos_tablegen.c b/contrib/xz/src/liblzma/lzma/fastpos_tablegen.c
deleted file mode 100644 (file)
index c97e6f4..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file       fastpos_tablegen.c
-/// \brief      Generates the lzma_fastpos[] lookup table
-///
-//  Authors:    Igor Pavlov
-//              Lasse Collin
-//
-//  This file has been put into the public domain.
-//  You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <sys/types.h>
-#include <inttypes.h>
-#include <stdio.h>
-#include "fastpos.h"
-
-
-int
-main(void)
-{
-       uint8_t fastpos[1 << FASTPOS_BITS];
-
-       const uint8_t fast_slots = 2 * FASTPOS_BITS;
-       uint32_t c = 2;
-
-       fastpos[0] = 0;
-       fastpos[1] = 1;
-
-       for (uint8_t slot_fast = 2; slot_fast < fast_slots; ++slot_fast) {
-               const uint32_t k = 1 << ((slot_fast >> 1) - 1);
-               for (uint32_t j = 0; j < k; ++j, ++c)
-                       fastpos[c] = slot_fast;
-       }
-
-       printf("/* This file has been automatically generated "
-                       "by fastpos_tablegen.c. */\n\n"
-                       "#include \"common.h\"\n"
-                       "#include \"fastpos.h\"\n\n"
-                       "const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {");
-
-       for (size_t i = 0; i < (1 << FASTPOS_BITS); ++i) {
-               if (i % 16 == 0)
-                       printf("\n\t");
-
-               printf("%3u", (unsigned int)(fastpos[i]));
-
-               if (i != (1 << FASTPOS_BITS) - 1)
-                       printf(",");
-       }
-
-       printf("\n};\n");
-
-       return 0;
-}
index 84982d2..878c870 100644 (file)
@@ -16,7 +16,7 @@
 #include "lzma_decoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum sequence {
                SEQ_CONTROL,
                SEQ_UNCOMPRESSED_1,
@@ -50,14 +50,16 @@ struct lzma_coder_s {
        bool need_dictionary_reset;
 
        lzma_options_lzma options;
-};
+} lzma_lzma2_coder;
 
 
 static lzma_ret
-lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
+lzma2_decode(void *coder_ptr, lzma_dict *restrict dict,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size)
 {
+       lzma_lzma2_coder *restrict coder = coder_ptr;
+
        // With SEQ_LZMA it is possible that no new input is needed to do
        // some progress. The rest of the sequences assume that there is
        // at least one byte of input.
@@ -209,8 +211,10 @@ lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
 
 
 static void
-lzma2_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+lzma2_decoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_lzma2_coder *coder = coder_ptr;
+
        assert(coder->lzma.end == NULL);
        lzma_free(coder->lzma.coder, allocator);
 
@@ -224,25 +228,27 @@ static lzma_ret
 lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
                const void *opt, lzma_lz_options *lz_options)
 {
-       if (lz->coder == NULL) {
-               lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (lz->coder == NULL)
+       lzma_lzma2_coder *coder = lz->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_lzma2_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               lz->coder = coder;
                lz->code = &lzma2_decode;
                lz->end = &lzma2_decoder_end;
 
-               lz->coder->lzma = LZMA_LZ_DECODER_INIT;
+               coder->lzma = LZMA_LZ_DECODER_INIT;
        }
 
        const lzma_options_lzma *options = opt;
 
-       lz->coder->sequence = SEQ_CONTROL;
-       lz->coder->need_properties = true;
-       lz->coder->need_dictionary_reset = options->preset_dict == NULL
+       coder->sequence = SEQ_CONTROL;
+       coder->need_properties = true;
+       coder->need_dictionary_reset = options->preset_dict == NULL
                        || options->preset_dict_size == 0;
 
-       return lzma_lzma_decoder_create(&lz->coder->lzma,
+       return lzma_lzma_decoder_create(&coder->lzma,
                        allocator, options, lz_options);
 }
 
@@ -263,7 +269,7 @@ lzma_lzma2_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
 extern uint64_t
 lzma_lzma2_decoder_memusage(const void *options)
 {
-       return sizeof(lzma_coder)
+       return sizeof(lzma_lzma2_coder)
                        + lzma_lzma_decoder_memusage_nocheck(options);
 }
 
index b6756bf..63588ee 100644 (file)
@@ -17,7 +17,7 @@
 #include "lzma2_encoder.h"
 
 
-struct lzma_coder_s {
+typedef struct {
        enum {
                SEQ_INIT,
                SEQ_LZMA_ENCODE,
@@ -27,7 +27,7 @@ struct lzma_coder_s {
        } sequence;
 
        /// LZMA encoder
-       lzma_coder *lzma;
+       void *lzma;
 
        /// LZMA options currently in use.
        lzma_options_lzma opt_cur;
@@ -48,11 +48,11 @@ struct lzma_coder_s {
 
        /// Buffer to hold the chunk header and LZMA compressed data
        uint8_t buf[LZMA2_HEADER_MAX + LZMA2_CHUNK_MAX];
-};
+} lzma_lzma2_coder;
 
 
 static void
-lzma2_header_lzma(lzma_coder *coder)
+lzma2_header_lzma(lzma_lzma2_coder *coder)
 {
        assert(coder->uncompressed_size > 0);
        assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX);
@@ -108,7 +108,7 @@ lzma2_header_lzma(lzma_coder *coder)
 
 
 static void
-lzma2_header_uncompressed(lzma_coder *coder)
+lzma2_header_uncompressed(lzma_lzma2_coder *coder)
 {
        assert(coder->uncompressed_size > 0);
        assert(coder->uncompressed_size <= LZMA2_CHUNK_MAX);
@@ -133,10 +133,12 @@ lzma2_header_uncompressed(lzma_coder *coder)
 
 
 static lzma_ret
-lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
+lzma2_encode(void *coder_ptr, lzma_mf *restrict mf,
                uint8_t *restrict out, size_t *restrict out_pos,
                size_t out_size)
 {
+       lzma_lzma2_coder *restrict coder = coder_ptr;
+
        while (*out_pos < out_size)
        switch (coder->sequence) {
        case SEQ_INIT:
@@ -262,8 +264,9 @@ lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
 
 
 static void
-lzma2_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
+lzma2_encoder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_lzma2_coder *coder = coder_ptr;
        lzma_free(coder->lzma, allocator);
        lzma_free(coder, allocator);
        return;
@@ -271,8 +274,10 @@ lzma2_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter)
+lzma2_encoder_options_update(void *coder_ptr, const lzma_filter *filter)
 {
+       lzma_lzma2_coder *coder = coder_ptr;
+
        // New options can be set only when there is no incomplete chunk.
        // This is the case at the beginning of the raw stream and right
        // after LZMA_SYNC_FLUSH.
@@ -310,30 +315,32 @@ lzma2_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
        if (options == NULL)
                return LZMA_PROG_ERROR;
 
-       if (lz->coder == NULL) {
-               lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
-               if (lz->coder == NULL)
+       lzma_lzma2_coder *coder = lz->coder;
+       if (coder == NULL) {
+               coder = lzma_alloc(sizeof(lzma_lzma2_coder), allocator);
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               lz->coder = coder;
                lz->code = &lzma2_encode;
                lz->end = &lzma2_encoder_end;
                lz->options_update = &lzma2_encoder_options_update;
 
-               lz->coder->lzma = NULL;
+               coder->lzma = NULL;
        }
 
-       lz->coder->opt_cur = *(const lzma_options_lzma *)(options);
+       coder->opt_cur = *(const lzma_options_lzma *)(options);
 
-       lz->coder->sequence = SEQ_INIT;
-       lz->coder->need_properties = true;
-       lz->coder->need_state_reset = false;
-       lz->coder->need_dictionary_reset
-                       = lz->coder->opt_cur.preset_dict == NULL
-                       || lz->coder->opt_cur.preset_dict_size == 0;
+       coder->sequence = SEQ_INIT;
+       coder->need_properties = true;
+       coder->need_state_reset = false;
+       coder->need_dictionary_reset
+                       = coder->opt_cur.preset_dict == NULL
+                       || coder->opt_cur.preset_dict_size == 0;
 
        // Initialize LZMA encoder
-       return_if_error(lzma_lzma_encoder_create(&lz->coder->lzma, allocator,
-                       &lz->coder->opt_cur, lz_options));
+       return_if_error(lzma_lzma_encoder_create(&coder->lzma, allocator,
+                       &coder->opt_cur, lz_options));
 
        // Make sure that we will always have enough history available in
        // case we need to use uncompressed chunks. They are used when the
@@ -364,7 +371,7 @@ lzma_lzma2_encoder_memusage(const void *options)
        if (lzma_mem == UINT64_MAX)
                return UINT64_MAX;
 
-       return sizeof(lzma_coder) + lzma_mem;
+       return sizeof(lzma_lzma2_coder) + lzma_mem;
 }
 
 
index b8f9317..d0f29b7 100644 (file)
 #include "lzma_decoder.h"
 #include "range_decoder.h"
 
+// The macros unroll loops with switch statements.
+// Silence warnings about missing fall-through comments.
+#if TUKLIB_GNUC_REQ(7, 0)
+#      pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
+#endif
+
 
 #ifdef HAVE_SMALL
 
@@ -161,7 +167,7 @@ typedef struct {
 } lzma_length_decoder;
 
 
-struct lzma_coder_s {
+typedef struct {
        ///////////////////
        // Probabilities //
        ///////////////////
@@ -277,14 +283,16 @@ struct lzma_coder_s {
        /// If decoding a literal: match byte.
        /// If decoding a match: length of the match.
        uint32_t len;
-};
+} lzma_lzma1_decoder;
 
 
 static lzma_ret
-lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr,
+lzma_decode(void *coder_ptr, lzma_dict *restrict dictptr,
                const uint8_t *restrict in,
                size_t *restrict in_pos, size_t in_size)
 {
+       lzma_lzma1_decoder *restrict coder = coder_ptr;
+
        ////////////////////
        // Initialization //
        ////////////////////
@@ -840,23 +848,17 @@ out:
 
 
 static void
-lzma_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
+lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
 {
+       lzma_lzma1_decoder *coder = coder_ptr;
        coder->uncompressed_size = uncompressed_size;
 }
 
-/*
-extern void
-lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
-{
-       // This is hack.
-       (*(lzma_coder **)(coder))->uncompressed_size = uncompressed_size;
-}
-*/
 
 static void
-lzma_decoder_reset(lzma_coder *coder, const void *opt)
+lzma_decoder_reset(void *coder_ptr, const void *opt)
 {
+       lzma_lzma1_decoder *coder = coder_ptr;
        const lzma_options_lzma *options = opt;
 
        // NOTE: We assume that lc/lp/pb are valid since they were
@@ -941,7 +943,7 @@ lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
                const void *opt, lzma_lz_options *lz_options)
 {
        if (lz->coder == NULL) {
-               lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
+               lz->coder = lzma_alloc(sizeof(lzma_lzma1_decoder), allocator);
                if (lz->coder == NULL)
                        return LZMA_MEM_ERROR;
 
@@ -1014,7 +1016,8 @@ extern uint64_t
 lzma_lzma_decoder_memusage_nocheck(const void *options)
 {
        const lzma_options_lzma *const opt = options;
-       return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size);
+       return sizeof(lzma_lzma1_decoder)
+                       + lzma_lz_decoder_memusage(opt->dict_size);
 }
 
 
index 4c5f99c..ba9ce69 100644 (file)
@@ -43,7 +43,7 @@ literal_matched(lzma_range_encoder *rc, probability *subcoder,
 
 
 static inline void
-literal(lzma_coder *coder, lzma_mf *mf, uint32_t position)
+literal(lzma_lzma1_encoder *coder, lzma_mf *mf, uint32_t position)
 {
        // Locate the literal byte to be encoded and the subcoder.
        const uint8_t cur_byte = mf->buffer[
@@ -140,7 +140,7 @@ length(lzma_range_encoder *rc, lzma_length_encoder *lc,
 ///////////
 
 static inline void
-match(lzma_coder *coder, const uint32_t pos_state,
+match(lzma_lzma1_encoder *coder, const uint32_t pos_state,
                const uint32_t distance, const uint32_t len)
 {
        update_match(coder->state);
@@ -187,7 +187,7 @@ match(lzma_coder *coder, const uint32_t pos_state,
 ////////////////////
 
 static inline void
-rep_match(lzma_coder *coder, const uint32_t pos_state,
+rep_match(lzma_lzma1_encoder *coder, const uint32_t pos_state,
                const uint32_t rep, const uint32_t len)
 {
        if (rep == 0) {
@@ -231,7 +231,7 @@ rep_match(lzma_coder *coder, const uint32_t pos_state,
 //////////
 
 static void
-encode_symbol(lzma_coder *coder, lzma_mf *mf,
+encode_symbol(lzma_lzma1_encoder *coder, lzma_mf *mf,
                uint32_t back, uint32_t len, uint32_t position)
 {
        const uint32_t pos_state = position & coder->pos_mask;
@@ -265,7 +265,7 @@ encode_symbol(lzma_coder *coder, lzma_mf *mf,
 
 
 static bool
-encode_init(lzma_coder *coder, lzma_mf *mf)
+encode_init(lzma_lzma1_encoder *coder, lzma_mf *mf)
 {
        assert(mf_position(mf) == 0);
 
@@ -293,7 +293,7 @@ encode_init(lzma_coder *coder, lzma_mf *mf)
 
 
 static void
-encode_eopm(lzma_coder *coder, uint32_t position)
+encode_eopm(lzma_lzma1_encoder *coder, uint32_t position)
 {
        const uint32_t pos_state = position & coder->pos_mask;
        rc_bit(&coder->rc, &coder->is_match[coder->state][pos_state], 1);
@@ -309,7 +309,7 @@ encode_eopm(lzma_coder *coder, uint32_t position)
 
 
 extern lzma_ret
-lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
+lzma_lzma_encode(lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf,
                uint8_t *restrict out, size_t *restrict out_pos,
                size_t out_size, uint32_t limit)
 {
@@ -402,7 +402,7 @@ lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
 
 
 static lzma_ret
-lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
+lzma_encode(void *coder, lzma_mf *restrict mf,
                uint8_t *restrict out, size_t *restrict out_pos,
                size_t out_size)
 {
@@ -473,7 +473,8 @@ length_encoder_reset(lzma_length_encoder *lencoder,
 
 
 extern lzma_ret
-lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
+lzma_lzma_encoder_reset(lzma_lzma1_encoder *coder,
+               const lzma_options_lzma *options)
 {
        if (!is_options_valid(options))
                return LZMA_OPTIONS_ERROR;
@@ -545,18 +546,18 @@ lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
 
 
 extern lzma_ret
-lzma_lzma_encoder_create(lzma_coder **coder_ptr,
+lzma_lzma_encoder_create(void **coder_ptr,
                const lzma_allocator *allocator,
                const lzma_options_lzma *options, lzma_lz_options *lz_options)
 {
-       // Allocate lzma_coder if it wasn't already allocated.
+       // Allocate lzma_lzma1_encoder if it wasn't already allocated.
        if (*coder_ptr == NULL) {
-               *coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator);
+               *coder_ptr = lzma_alloc(sizeof(lzma_lzma1_encoder), allocator);
                if (*coder_ptr == NULL)
                        return LZMA_MEM_ERROR;
        }
 
-       lzma_coder *coder = *coder_ptr;
+       lzma_lzma1_encoder *coder = *coder_ptr;
 
        // Set compression mode. We haven't validates the options yet,
        // but it's OK here, since nothing bad happens with invalid
@@ -636,7 +637,7 @@ lzma_lzma_encoder_memusage(const void *options)
        if (lz_memusage == UINT64_MAX)
                return UINT64_MAX;
 
-       return (uint64_t)(sizeof(lzma_coder)) + lz_memusage;
+       return (uint64_t)(sizeof(lzma_lzma1_encoder)) + lz_memusage;
 }
 
 
index cc9cc2f..6cfdf22 100644 (file)
@@ -17,6 +17,9 @@
 #include "common.h"
 
 
+typedef struct lzma_lzma1_encoder_s lzma_lzma1_encoder;
+
+
 extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next,
                const lzma_allocator *allocator,
                const lzma_filter_info *filters);
@@ -36,16 +39,16 @@ extern bool lzma_lzma_lclppb_encode(
 
 /// Initializes raw LZMA encoder; this is used by LZMA2.
 extern lzma_ret lzma_lzma_encoder_create(
-               lzma_coder **coder_ptr, const lzma_allocator *allocator,
+               void **coder_ptr, const lzma_allocator *allocator,
                const lzma_options_lzma *options, lzma_lz_options *lz_options);
 
 
 /// Resets an already initialized LZMA encoder; this is used by LZMA2.
 extern lzma_ret lzma_lzma_encoder_reset(
-               lzma_coder *coder, const lzma_options_lzma *options);
+               lzma_lzma1_encoder *coder, const lzma_options_lzma *options);
 
 
-extern lzma_ret lzma_lzma_encode(lzma_coder *restrict coder,
+extern lzma_ret lzma_lzma_encode(lzma_lzma1_encoder *restrict coder,
                lzma_mf *restrict mf, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size,
                uint32_t read_limit);
index 9b30347..6c53d2b 100644 (file)
@@ -18,7 +18,8 @@
 
 
 extern void
-lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf,
+lzma_lzma_optimum_fast(lzma_lzma1_encoder *restrict coder,
+               lzma_mf *restrict mf,
                uint32_t *restrict back_res, uint32_t *restrict len_res)
 {
        const uint32_t nice_len = mf->nice_len;
index a360579..59f7734 100644 (file)
@@ -19,7 +19,7 @@
 ////////////
 
 static uint32_t
-get_literal_price(const lzma_coder *const coder, const uint32_t pos,
+get_literal_price(const lzma_lzma1_encoder *const coder, const uint32_t pos,
                const uint32_t prev_byte, const bool match_mode,
                uint32_t match_byte, uint32_t symbol)
 {
@@ -65,7 +65,7 @@ get_len_price(const lzma_length_encoder *const lencoder,
 
 
 static inline uint32_t
-get_short_rep_price(const lzma_coder *const coder,
+get_short_rep_price(const lzma_lzma1_encoder *const coder,
                const lzma_lzma_state state, const uint32_t pos_state)
 {
        return rc_bit_0_price(coder->is_rep0[state])
@@ -74,7 +74,7 @@ get_short_rep_price(const lzma_coder *const coder,
 
 
 static inline uint32_t
-get_pure_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
+get_pure_rep_price(const lzma_lzma1_encoder *const coder, const uint32_t rep_index,
                const lzma_lzma_state state, uint32_t pos_state)
 {
        uint32_t price;
@@ -99,7 +99,7 @@ get_pure_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
 
 
 static inline uint32_t
-get_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
+get_rep_price(const lzma_lzma1_encoder *const coder, const uint32_t rep_index,
                const uint32_t len, const lzma_lzma_state state,
                const uint32_t pos_state)
 {
@@ -109,7 +109,7 @@ get_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
 
 
 static inline uint32_t
-get_dist_len_price(const lzma_coder *const coder, const uint32_t dist,
+get_dist_len_price(const lzma_lzma1_encoder *const coder, const uint32_t dist,
                const uint32_t len, const uint32_t pos_state)
 {
        const uint32_t dist_state = get_dist_state(len);
@@ -130,7 +130,7 @@ get_dist_len_price(const lzma_coder *const coder, const uint32_t dist,
 
 
 static void
-fill_dist_prices(lzma_coder *coder)
+fill_dist_prices(lzma_lzma1_encoder *coder)
 {
        for (uint32_t dist_state = 0; dist_state < DIST_STATES; ++dist_state) {
 
@@ -185,7 +185,7 @@ fill_dist_prices(lzma_coder *coder)
 
 
 static void
-fill_align_prices(lzma_coder *coder)
+fill_align_prices(lzma_lzma1_encoder *coder)
 {
        for (uint32_t i = 0; i < ALIGN_SIZE; ++i)
                coder->align_prices[i] = rc_bittree_reverse_price(
@@ -221,7 +221,7 @@ make_short_rep(lzma_optimal *optimal)
 
 
 static void
-backward(lzma_coder *restrict coder, uint32_t *restrict len_res,
+backward(lzma_lzma1_encoder *restrict coder, uint32_t *restrict len_res,
                uint32_t *restrict back_res, uint32_t cur)
 {
        coder->opts_end_index = cur;
@@ -269,7 +269,7 @@ backward(lzma_coder *restrict coder, uint32_t *restrict len_res,
 //////////
 
 static inline uint32_t
-helper1(lzma_coder *restrict coder, lzma_mf *restrict mf,
+helper1(lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf,
                uint32_t *restrict back_res, uint32_t *restrict len_res,
                uint32_t position)
 {
@@ -441,7 +441,7 @@ helper1(lzma_coder *restrict coder, lzma_mf *restrict mf,
 
 
 static inline uint32_t
-helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
+helper2(lzma_lzma1_encoder *coder, uint32_t *reps, const uint8_t *buf,
                uint32_t len_end, uint32_t position, const uint32_t cur,
                const uint32_t nice_len, const uint32_t buf_avail_full)
 {
@@ -797,7 +797,8 @@ helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
 
 
 extern void
-lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf,
+lzma_lzma_optimum_normal(lzma_lzma1_encoder *restrict coder,
+               lzma_mf *restrict mf,
                uint32_t *restrict back_res, uint32_t *restrict len_res,
                uint32_t position)
 {
index 8484b77..711df02 100644 (file)
@@ -2,6 +2,7 @@
 //
 /// \file       lzma_encoder_presets.c
 /// \brief      Encoder presets
+/// \note       xz needs this even when only decoding is enabled.
 //
 //  Author:     Lasse Collin
 //
index 2f62d6c..a2da969 100644 (file)
@@ -69,7 +69,7 @@ typedef struct {
 } lzma_optimal;
 
 
-struct lzma_coder_s {
+struct lzma_lzma1_encoder_s {
        /// Range encoder
        lzma_range_encoder rc;
 
@@ -138,10 +138,10 @@ struct lzma_coder_s {
 
 
 extern void lzma_lzma_optimum_fast(
-               lzma_coder *restrict coder, lzma_mf *restrict mf,
+               lzma_lzma1_encoder *restrict coder, lzma_mf *restrict mf,
                uint32_t *restrict back_res, uint32_t *restrict len_res);
 
-extern void lzma_lzma_optimum_normal(lzma_coder *restrict coder,
+extern void lzma_lzma_optimum_normal(lzma_lzma1_encoder *restrict coder,
                lzma_mf *restrict mf, uint32_t *restrict back_res,
                uint32_t *restrict len_res, uint32_t position);
 
diff --git a/contrib/xz/src/liblzma/rangecoder/price_tablegen.c b/contrib/xz/src/liblzma/rangecoder/price_tablegen.c
deleted file mode 100644 (file)
index bf08ce3..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-//
-/// \file       price_tablegen.c
-/// \brief      Probability price table generator
-///
-/// Compiling: gcc -std=c99 -o price_tablegen price_tablegen.c
-///
-//  Authors:    Igor Pavlov
-//              Lasse Collin
-//
-//  This file has been put into the public domain.
-//  You can do whatever you want with this file.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#include <inttypes.h>
-#include <stdio.h>
-#include "range_common.h"
-#include "price.h"
-
-
-static uint32_t rc_prices[RC_PRICE_TABLE_SIZE];
-
-
-static void
-init_price_table(void)
-{
-       for (uint32_t i = (UINT32_C(1) << RC_MOVE_REDUCING_BITS) / 2;
-                       i < RC_BIT_MODEL_TOTAL;
-                       i += (UINT32_C(1) << RC_MOVE_REDUCING_BITS)) {
-               const uint32_t cycles_bits = RC_BIT_PRICE_SHIFT_BITS;
-               uint32_t w = i;
-               uint32_t bit_count = 0;
-
-               for (uint32_t j = 0; j < cycles_bits; ++j) {
-                       w *= w;
-                       bit_count <<= 1;
-
-                       while (w >= (UINT32_C(1) << 16)) {
-                               w >>= 1;
-                               ++bit_count;
-                       }
-               }
-
-               rc_prices[i >> RC_MOVE_REDUCING_BITS]
-                               = (RC_BIT_MODEL_TOTAL_BITS << cycles_bits)
-                               - 15 - bit_count;
-       }
-
-       return;
-}
-
-
-static void
-print_price_table(void)
-{
-       printf("/* This file has been automatically generated by "
-                       "price_tablegen.c. */\n\n"
-                       "#include \"range_encoder.h\"\n\n"
-                       "const uint8_t lzma_rc_prices["
-                       "RC_PRICE_TABLE_SIZE] = {");
-
-       const size_t array_size = sizeof(lzma_rc_prices)
-                       / sizeof(lzma_rc_prices[0]);
-       for (size_t i = 0; i < array_size; ++i) {
-               if (i % 8 == 0)
-                       printf("\n\t");
-
-               printf("%4" PRIu32, rc_prices[i]);
-
-               if (i != array_size - 1)
-                       printf(",");
-       }
-
-       printf("\n};\n");
-
-       return;
-}
-
-
-int
-main(void)
-{
-       init_price_table();
-       print_price_table();
-       return 0;
-}
index 0e64241..2c74dc1 100644 (file)
@@ -14,9 +14,7 @@
 #ifndef LZMA_RANGE_COMMON_H
 #define LZMA_RANGE_COMMON_H
 
-#ifdef HAVE_CONFIG_H
-#      include "common.h"
-#endif
+#include "common.h"
 
 
 ///////////////
index 258d870..181d0e3 100644 (file)
@@ -15,7 +15,7 @@
 
 
 static size_t
-arm_code(lzma_simple *simple lzma_attribute((__unused__)),
+arm_code(void *simple lzma_attribute((__unused__)),
                uint32_t now_pos, bool is_encoder,
                uint8_t *buffer, size_t size)
 {
index 06c21e4..eab4862 100644 (file)
@@ -15,7 +15,7 @@
 
 
 static size_t
-armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
+armthumb_code(void *simple lzma_attribute((__unused__)),
                uint32_t now_pos, bool is_encoder,
                uint8_t *buffer, size_t size)
 {
index ba7249c..580529e 100644 (file)
@@ -15,7 +15,7 @@
 
 
 static size_t
-ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
+ia64_code(void *simple lzma_attribute((__unused__)),
                uint32_t now_pos, bool is_encoder,
                uint8_t *buffer, size_t size)
 {
index 4689919..54dfbf1 100644 (file)
@@ -15,7 +15,7 @@
 
 
 static size_t
-powerpc_code(lzma_simple *simple lzma_attribute((__unused__)),
+powerpc_code(void *simple lzma_attribute((__unused__)),
                uint32_t now_pos, bool is_encoder,
                uint8_t *buffer, size_t size)
 {
index dba5417..13ebabc 100644 (file)
@@ -18,7 +18,7 @@
 
 /// Copied or encodes/decodes more data to out[].
 static lzma_ret
-copy_or_code(lzma_coder *coder, const lzma_allocator *allocator,
+copy_or_code(lzma_simple_coder *coder, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
@@ -55,7 +55,7 @@ copy_or_code(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static size_t
-call_filter(lzma_coder *coder, uint8_t *buffer, size_t size)
+call_filter(lzma_simple_coder *coder, uint8_t *buffer, size_t size)
 {
        const size_t filtered = coder->filter(coder->simple,
                        coder->now_pos, coder->is_encoder,
@@ -66,11 +66,13 @@ call_filter(lzma_coder *coder, uint8_t *buffer, size_t size)
 
 
 static lzma_ret
-simple_code(lzma_coder *coder, const lzma_allocator *allocator,
+simple_code(void *coder_ptr, const lzma_allocator *allocator,
                const uint8_t *restrict in, size_t *restrict in_pos,
                size_t in_size, uint8_t *restrict out,
                size_t *restrict out_pos, size_t out_size, lzma_action action)
 {
+       lzma_simple_coder *coder = coder_ptr;
+
        // TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it
        // in cases when the filter is able to filter everything. With most
        // simple filters it can be done at offset that is a multiple of 2,
@@ -198,8 +200,9 @@ simple_code(lzma_coder *coder, const lzma_allocator *allocator,
 
 
 static void
-simple_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
+simple_coder_end(void *coder_ptr, const lzma_allocator *allocator)
 {
+       lzma_simple_coder *coder = coder_ptr;
        lzma_next_end(&coder->next, allocator);
        lzma_free(coder->simple, allocator);
        lzma_free(coder, allocator);
@@ -208,10 +211,12 @@ simple_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
 
 
 static lzma_ret
-simple_coder_update(lzma_coder *coder, const lzma_allocator *allocator,
+simple_coder_update(void *coder_ptr, const lzma_allocator *allocator,
                const lzma_filter *filters_null lzma_attribute((__unused__)),
                const lzma_filter *reversed_filters)
 {
+       lzma_simple_coder *coder = coder_ptr;
+
        // No update support, just call the next filter in the chain.
        return lzma_next_filter_update(
                        &coder->next, allocator, reversed_filters + 1);
@@ -221,57 +226,57 @@ simple_coder_update(lzma_coder *coder, const lzma_allocator *allocator,
 extern lzma_ret
 lzma_simple_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                const lzma_filter_info *filters,
-               size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
+               size_t (*filter)(void *simple, uint32_t now_pos,
                        bool is_encoder, uint8_t *buffer, size_t size),
                size_t simple_size, size_t unfiltered_max,
                uint32_t alignment, bool is_encoder)
 {
-       // Allocate memory for the lzma_coder structure if needed.
-       if (next->coder == NULL) {
+       // Allocate memory for the lzma_simple_coder structure if needed.
+       lzma_simple_coder *coder = next->coder;
+       if (coder == NULL) {
                // Here we allocate space also for the temporary buffer. We
                // need twice the size of unfiltered_max, because then it
                // is always possible to filter at least unfiltered_max bytes
                // more data in coder->buffer[] if it can be filled completely.
-               next->coder = lzma_alloc(sizeof(lzma_coder)
+               coder = lzma_alloc(sizeof(lzma_simple_coder)
                                + 2 * unfiltered_max, allocator);
-               if (next->coder == NULL)
+               if (coder == NULL)
                        return LZMA_MEM_ERROR;
 
+               next->coder = coder;
                next->code = &simple_code;
                next->end = &simple_coder_end;
                next->update = &simple_coder_update;
 
-               next->coder->next = LZMA_NEXT_CODER_INIT;
-               next->coder->filter = filter;
-               next->coder->allocated = 2 * unfiltered_max;
+               coder->next = LZMA_NEXT_CODER_INIT;
+               coder->filter = filter;
+               coder->allocated = 2 * unfiltered_max;
 
                // Allocate memory for filter-specific data structure.
                if (simple_size > 0) {
-                       next->coder->simple = lzma_alloc(
-                                       simple_size, allocator);
-                       if (next->coder->simple == NULL)
+                       coder->simple = lzma_alloc(simple_size, allocator);
+                       if (coder->simple == NULL)
                                return LZMA_MEM_ERROR;
                } else {
-                       next->coder->simple = NULL;
+                       coder->simple = NULL;
                }
        }
 
        if (filters[0].options != NULL) {
                const lzma_options_bcj *simple = filters[0].options;
-               next->coder->now_pos = simple->start_offset;
-               if (next->coder->now_pos & (alignment - 1))
+               coder->now_pos = simple->start_offset;
+               if (coder->now_pos & (alignment - 1))
                        return LZMA_OPTIONS_ERROR;
        } else {
-               next->coder->now_pos = 0;
+               coder->now_pos = 0;
        }
 
        // Reset variables.
-       next->coder->is_encoder = is_encoder;
-       next->coder->end_was_reached = false;
-       next->coder->pos = 0;
-       next->coder->filtered = 0;
-       next->coder->size = 0;
-
-       return lzma_next_filter_init(
-                       &next->coder->next, allocator, filters + 1);
+       coder->is_encoder = is_encoder;
+       coder->end_was_reached = false;
+       coder->pos = 0;
+       coder->filtered = 0;
+       coder->size = 0;
+
+       return lzma_next_filter_init(&coder->next, allocator, filters + 1);
 }
index bb20cb4..9d2c0fd 100644 (file)
@@ -16,9 +16,7 @@
 #include "simple_coder.h"
 
 
-typedef struct lzma_simple_s lzma_simple;
-
-struct lzma_coder_s {
+typedef struct {
        /// Next filter in the chain
        lzma_next_coder next;
 
@@ -33,12 +31,12 @@ struct lzma_coder_s {
 
        /// Pointer to filter-specific function, which does
        /// the actual filtering.
-       size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
+       size_t (*filter)(void *simple, uint32_t now_pos,
                        bool is_encoder, uint8_t *buffer, size_t size);
 
        /// Pointer to filter-specific data, or NULL if filter doesn't need
        /// any extra data.
-       lzma_simple *simple;
+       void *simple;
 
        /// The lowest 32 bits of the current position in the data. Most
        /// filters need this to do conversions between absolute and relative
@@ -62,13 +60,13 @@ struct lzma_coder_s {
 
        /// Temporary buffer
        uint8_t buffer[];
-};
+} lzma_simple_coder;
 
 
 extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,
                const lzma_allocator *allocator,
                const lzma_filter_info *filters,
-               size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
+               size_t (*filter)(void *simple, uint32_t now_pos,
                        bool is_encoder, uint8_t *buffer, size_t size),
                size_t simple_size, size_t unfiltered_max,
                uint32_t alignment, bool is_encoder);
index 53ee49d..74b2655 100644 (file)
@@ -15,7 +15,7 @@
 
 
 static size_t
-sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
+sparc_code(void *simple lzma_attribute((__unused__)),
                uint32_t now_pos, bool is_encoder,
                uint8_t *buffer, size_t size)
 {
index 3b2b4f8..0b14807 100644 (file)
 #define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
 
 
-struct lzma_simple_s {
+typedef struct {
        uint32_t prev_mask;
        uint32_t prev_pos;
-};
+} lzma_simple_x86;
 
 
 static size_t
-x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
+x86_code(void *simple_ptr, uint32_t now_pos, bool is_encoder,
                uint8_t *buffer, size_t size)
 {
        static const bool MASK_TO_ALLOWED_STATUS[8]
@@ -33,6 +33,7 @@ x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
        static const uint32_t MASK_TO_BIT_NUMBER[8]
                        = { 0, 1, 2, 2, 3, 3, 3, 3 };
 
+       lzma_simple_x86 *simple = simple_ptr;
        uint32_t prev_mask = simple->prev_mask;
        uint32_t prev_pos = simple->prev_pos;
 
@@ -127,11 +128,13 @@ x86_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
                const lzma_filter_info *filters, bool is_encoder)
 {
        const lzma_ret ret = lzma_simple_coder_init(next, allocator, filters,
-                       &x86_code, sizeof(lzma_simple), 5, 1, is_encoder);
+                       &x86_code, sizeof(lzma_simple_x86), 5, 1, is_encoder);
 
        if (ret == LZMA_OK) {
-               next->coder->simple->prev_mask = 0;
-               next->coder->simple->prev_pos = (uint32_t)(-5);
+               lzma_simple_coder *coder = next->coder;
+               lzma_simple_x86 *simple = coder->simple;
+               simple->prev_mask = 0;
+               simple->prev_pos = (uint32_t)(-5);
        }
 
        return ret;
index 041c800..341f29e 100644 (file)
@@ -635,6 +635,22 @@ args_parse(args_info *args, int argc, char **argv)
        // Then from the command line
        parse_real(args, argc, argv);
 
+       // If encoder or decoder support was omitted at build time,
+       // show an error now so that the rest of the code can rely on
+       // that whatever is in opt_mode is also supported.
+#ifndef HAVE_ENCODERS
+       if (opt_mode == MODE_COMPRESS)
+               message_fatal(_("Compression support was disabled "
+                               "at build time"));
+#endif
+#ifndef HAVE_DECODERS
+       // Even MODE_LIST cannot work without decoder support so MODE_COMPRESS
+       // is the only valid choice.
+       if (opt_mode != MODE_COMPRESS)
+               message_fatal(_("Decompression support was disabled "
+                               "at build time"));
+#endif
+
        // Never remove the source file when the destination is not on disk.
        // In test mode the data is written nowhere, but setting opt_stdout
        // will make the rest of the code behave well.
index a94bdb8..3c6a01c 100644 (file)
@@ -51,7 +51,7 @@ static lzma_check check;
 /// This becomes false if the --check=CHECK option is used.
 static bool check_default = true;
 
-#ifdef MYTHREAD_ENABLED
+#if defined(HAVE_ENCODERS) && defined(MYTHREAD_ENABLED)
 static lzma_mt mt_options = {
        .flags = 0,
        .timeout = 300,
@@ -221,9 +221,10 @@ coder_set_compression_settings(void)
        // Get the memory usage. Note that if --format=raw was used,
        // we can be decompressing.
        const uint64_t memory_limit = hardware_memlimit_get(opt_mode);
-       uint64_t memory_usage;
+       uint64_t memory_usage = UINT64_MAX;
        if (opt_mode == MODE_COMPRESS) {
-#ifdef MYTHREAD_ENABLED
+#ifdef HAVE_ENCODERS
+#      ifdef MYTHREAD_ENABLED
                if (opt_format == FORMAT_XZ && hardware_threads_get() > 1) {
                        mt_options.threads = hardware_threads_get();
                        mt_options.block_size = opt_block_size;
@@ -235,12 +236,15 @@ coder_set_compression_settings(void)
                                                " threads."),
                                                mt_options.threads);
                } else
-#endif
+#      endif
                {
                        memory_usage = lzma_raw_encoder_memusage(filters);
                }
+#endif
        } else {
+#ifdef HAVE_DECODERS
                memory_usage = lzma_raw_decoder_memusage(filters);
+#endif
        }
 
        if (memory_usage == UINT64_MAX)
@@ -248,7 +252,11 @@ coder_set_compression_settings(void)
 
        // Print memory usage info before possible dictionary
        // size auto-adjusting.
+       //
+       // NOTE: If only encoder support was built, we cannot show the
+       // what the decoder memory usage will be.
        message_mem_needed(V_DEBUG, memory_usage);
+#ifdef HAVE_DECODERS
        if (opt_mode == MODE_COMPRESS) {
                const uint64_t decmem = lzma_raw_decoder_memusage(filters);
                if (decmem != UINT64_MAX)
@@ -256,6 +264,7 @@ coder_set_compression_settings(void)
                                        "%s MiB of memory."), uint64_to_str(
                                                round_up_to_mib(decmem), 0));
        }
+#endif
 
        if (memory_usage <= memory_limit)
                return;
@@ -268,7 +277,8 @@ coder_set_compression_settings(void)
 
        assert(opt_mode == MODE_COMPRESS);
 
-#ifdef MYTHREAD_ENABLED
+#ifdef HAVE_ENCODERS
+#      ifdef MYTHREAD_ENABLED
        if (opt_format == FORMAT_XZ && mt_options.threads > 1) {
                // Try to reduce the number of threads before
                // adjusting the compression settings down.
@@ -295,7 +305,7 @@ coder_set_compression_settings(void)
                        uint64_to_str(round_up_to_mib(
                                memory_limit), 2));
        }
-#endif
+#      endif
 
        if (memory_usage <= memory_limit)
                return;
@@ -349,11 +359,13 @@ coder_set_compression_settings(void)
                        uint64_to_str(orig_dict_size >> 20, 0),
                        uint64_to_str(opt->dict_size >> 20, 1),
                        uint64_to_str(round_up_to_mib(memory_limit), 2));
+#endif
 
        return;
 }
 
 
+#ifdef HAVE_DECODERS
 /// Return true if the data in in_buf seems to be in the .xz format.
 static bool
 is_format_xz(void)
@@ -411,6 +423,7 @@ is_format_lzma(void)
 
        return true;
 }
+#endif
 
 
 /// Detect the input file type (for now, this done only when decompressing),
@@ -424,6 +437,7 @@ coder_init(file_pair *pair)
        lzma_ret ret = LZMA_PROG_ERROR;
 
        if (opt_mode == MODE_COMPRESS) {
+#ifdef HAVE_ENCODERS
                switch (opt_format) {
                case FORMAT_AUTO:
                        // args.c ensures this.
@@ -431,12 +445,12 @@ coder_init(file_pair *pair)
                        break;
 
                case FORMAT_XZ:
-#ifdef MYTHREAD_ENABLED
+#      ifdef MYTHREAD_ENABLED
                        if (hardware_threads_get() > 1)
                                ret = lzma_stream_encoder_mt(
                                                &strm, &mt_options);
                        else
-#endif
+#      endif
                                ret = lzma_stream_encoder(
                                                &strm, filters, check);
                        break;
@@ -449,7 +463,9 @@ coder_init(file_pair *pair)
                        ret = lzma_raw_encoder(&strm, filters);
                        break;
                }
+#endif
        } else {
+#ifdef HAVE_DECODERS
                uint32_t flags = 0;
 
                // It seems silly to warn about unsupported check if the
@@ -531,6 +547,7 @@ coder_init(file_pair *pair)
                        strm.avail_out = 0;
                        ret = lzma_code(&strm, LZMA_RUN);
                }
+#endif
        }
 
        if (ret != LZMA_OK) {
index 9bd515d..041bed8 100644 (file)
@@ -23,10 +23,20 @@ static bool warn_fchown;
 
 #if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES)
 #      include <sys/time.h>
+#elif defined(HAVE__FUTIME)
+#      include <sys/utime.h>
 #elif defined(HAVE_UTIME)
 #      include <utime.h>
 #endif
 
+#ifdef HAVE_CAPSICUM
+#      ifdef HAVE_SYS_CAPSICUM_H
+#              include <sys/capsicum.h>
+#      else
+#              include <sys/capability.h>
+#      endif
+#endif
+
 #include "tuklib_open_stdxxx.h"
 
 #ifndef O_BINARY
@@ -37,6 +47,14 @@ static bool warn_fchown;
 #      define O_NOCTTY 0
 #endif
 
+// Using this macro to silence a warning from gcc -Wlogical-op.
+#if EAGAIN == EWOULDBLOCK
+#      define IS_EAGAIN_OR_EWOULDBLOCK(e) ((e) == EAGAIN)
+#else
+#      define IS_EAGAIN_OR_EWOULDBLOCK(e) \
+               ((e) == EAGAIN || (e) == EWOULDBLOCK)
+#endif
+
 
 typedef enum {
        IO_WAIT_MORE,    // Reading or writing is possible.
@@ -48,6 +66,11 @@ typedef enum {
 /// If true, try to create sparse files when decompressing.
 static bool try_sparse = true;
 
+#ifdef ENABLE_SANDBOX
+/// True if the conditions for sandboxing (described in main()) have been met.
+static bool sandbox_allowed = false;
+#endif
+
 #ifndef TUKLIB_DOSLIKE
 /// File status flags of standard input. This is used by io_open_src()
 /// and io_close_src().
@@ -132,6 +155,73 @@ io_no_sparse(void)
 }
 
 
+#ifdef ENABLE_SANDBOX
+extern void
+io_allow_sandbox(void)
+{
+       sandbox_allowed = true;
+       return;
+}
+
+
+/// Enables operating-system-specific sandbox if it is possible.
+/// src_fd is the file descriptor of the input file.
+static void
+io_sandbox_enter(int src_fd)
+{
+       if (!sandbox_allowed) {
+               message(V_DEBUG, _("Sandbox is disabled due "
+                               "to incompatible command line arguments"));
+               return;
+       }
+
+       const char dummy_str[] = "x";
+
+       // Try to ensure that both libc and xz locale files have been
+       // loaded when NLS is enabled.
+       snprintf(NULL, 0, "%s%s", _(dummy_str), strerror(EINVAL));
+
+       // Try to ensure that iconv data files needed for handling multibyte
+       // characters have been loaded. This is needed at least with glibc.
+       tuklib_mbstr_width(dummy_str, NULL);
+
+#ifdef HAVE_CAPSICUM
+       // Capsicum needs FreeBSD 10.0 or later.
+       cap_rights_t rights;
+
+       if (cap_rights_limit(src_fd, cap_rights_init(&rights,
+                       CAP_EVENT, CAP_FCNTL, CAP_LOOKUP, CAP_READ, CAP_SEEK)))
+               goto error;
+
+       if (cap_rights_limit(STDOUT_FILENO, cap_rights_init(&rights,
+                       CAP_EVENT, CAP_FCNTL, CAP_FSTAT, CAP_LOOKUP,
+                       CAP_WRITE, CAP_SEEK)))
+               goto error;
+
+       if (cap_rights_limit(user_abort_pipe[0], cap_rights_init(&rights,
+                       CAP_EVENT)))
+               goto error;
+
+       if (cap_rights_limit(user_abort_pipe[1], cap_rights_init(&rights,
+                       CAP_WRITE)))
+               goto error;
+
+       if (cap_enter())
+               goto error;
+
+#else
+#      error ENABLE_SANDBOX is defined but no sandboxing method was found.
+#endif
+
+       message(V_DEBUG, _("Sandbox was successfully enabled"));
+       return;
+
+error:
+       message(V_DEBUG, _("Failed to enable the sandbox"));
+}
+#endif // ENABLE_SANDBOX
+
+
 #ifndef TUKLIB_DOSLIKE
 /// \brief      Waits for input or output to become available or for a signal
 ///
@@ -369,6 +459,22 @@ io_copy_attrs(const file_pair *pair)
        (void)utimes(pair->dest_name,