|
Packit |
08bd4c |
/*-
|
|
Packit |
08bd4c |
* Copyright (c) 2003-2011 Tim Kientzle
|
|
Packit |
08bd4c |
* All rights reserved.
|
|
Packit |
08bd4c |
*
|
|
Packit |
08bd4c |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
08bd4c |
* modification, are permitted provided that the following conditions
|
|
Packit |
08bd4c |
* are met:
|
|
Packit |
08bd4c |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit |
08bd4c |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
08bd4c |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
08bd4c |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit |
08bd4c |
* documentation and/or other materials provided with the distribution.
|
|
Packit |
08bd4c |
*
|
|
Packit |
08bd4c |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
|
Packit |
08bd4c |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Packit |
08bd4c |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Packit |
08bd4c |
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Packit |
08bd4c |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Packit |
08bd4c |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
08bd4c |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
08bd4c |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
08bd4c |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Packit |
08bd4c |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
08bd4c |
*/
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
#include "archive_platform.h"
|
|
Packit |
08bd4c |
__FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_all.c 174991 2007-12-30 04:58:22Z kientzle $");
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
#include "archive.h"
|
|
Packit |
08bd4c |
#include "archive_private.h"
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
int
|
|
Packit |
08bd4c |
archive_read_support_format_all(struct archive *a)
|
|
Packit |
08bd4c |
{
|
|
Packit |
08bd4c |
archive_check_magic(a, ARCHIVE_READ_MAGIC,
|
|
Packit |
08bd4c |
ARCHIVE_STATE_NEW, "archive_read_support_format_all");
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
/* TODO: It would be nice to compute the ordering
|
|
Packit |
08bd4c |
* here automatically so that people who enable just
|
|
Packit |
08bd4c |
* a few formats can still get the benefits. That
|
|
Packit |
08bd4c |
* may just require the format registration to include
|
|
Packit |
08bd4c |
* a "maximum read-ahead" value (anything that uses seek
|
|
Packit |
08bd4c |
* would be essentially infinite read-ahead). The core
|
|
Packit |
08bd4c |
* bid management can then sort the bidders before calling
|
|
Packit |
08bd4c |
* them.
|
|
Packit |
08bd4c |
*
|
|
Packit |
08bd4c |
* If you implement the above, please return the list below
|
|
Packit |
08bd4c |
* to alphabetic order.
|
|
Packit |
08bd4c |
*/
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
/*
|
|
Packit |
08bd4c |
* These bidders are all pretty cheap; they just examine a
|
|
Packit |
08bd4c |
* small initial part of the archive. If one of these bids
|
|
Packit |
08bd4c |
* high, we can maybe avoid running any of the more expensive
|
|
Packit |
08bd4c |
* bidders below.
|
|
Packit |
08bd4c |
*/
|
|
Packit |
08bd4c |
archive_read_support_format_ar(a);
|
|
Packit |
08bd4c |
archive_read_support_format_cpio(a);
|
|
Packit |
08bd4c |
archive_read_support_format_empty(a);
|
|
Packit |
08bd4c |
archive_read_support_format_lha(a);
|
|
Packit |
08bd4c |
archive_read_support_format_mtree(a);
|
|
Packit |
08bd4c |
archive_read_support_format_tar(a);
|
|
Packit |
08bd4c |
archive_read_support_format_xar(a);
|
|
Packit |
08bd4c |
archive_read_support_format_warc(a);
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
/*
|
|
Packit |
08bd4c |
* Install expensive bidders last. By doing them last, we
|
|
Packit |
08bd4c |
* increase the chance that a high bid from someone else will
|
|
Packit |
08bd4c |
* make it unnecessary for these to do anything at all.
|
|
Packit |
08bd4c |
*/
|
|
Packit |
08bd4c |
/* These three have potentially large look-ahead. */
|
|
Packit |
08bd4c |
archive_read_support_format_7zip(a);
|
|
Packit |
08bd4c |
archive_read_support_format_cab(a);
|
|
Packit |
08bd4c |
archive_read_support_format_rar(a);
|
|
Packit |
08bd4c |
archive_read_support_format_iso9660(a);
|
|
Packit |
08bd4c |
/* Seek is really bad, since it forces the read-ahead
|
|
Packit |
08bd4c |
* logic to discard buffered data. */
|
|
Packit |
08bd4c |
archive_read_support_format_zip(a);
|
|
Packit |
08bd4c |
|
|
Packit |
08bd4c |
/* Note: We always return ARCHIVE_OK here, even if some of the
|
|
Packit |
08bd4c |
* above return ARCHIVE_WARN. The intent here is to enable
|
|
Packit |
08bd4c |
* "as much as possible." Clients who need specific
|
|
Packit |
08bd4c |
* compression should enable those individually so they can
|
|
Packit |
08bd4c |
* verify the level of support. */
|
|
Packit |
08bd4c |
/* Clear any warning messages set by the above functions. */
|
|
Packit |
08bd4c |
archive_clear_error(a);
|
|
Packit |
08bd4c |
return (ARCHIVE_OK);
|
|
Packit |
08bd4c |
}
|