]> git.saurik.com Git - apt.git/blame - apt-inst/contrib/extracttar.h
tests: don't do boundless string compares with data()
[apt.git] / apt-inst / contrib / extracttar.h
CommitLineData
b2e465d6
AL
1// -*- mode: cpp; mode: fold -*-
2// Description /*{{{*/
3// $Id: extracttar.h,v 1.2 2001/02/20 07:03:17 jgg Exp $
4/* ######################################################################
5
6 Extract a Tar - Tar Extractor
7
8 The tar extractor takes an ordinary gzip compressed tar stream from
9 the given file and explodes it, passing the individual items to the
10 given Directory Stream for processing.
11
12 ##################################################################### */
13 /*}}}*/
14#ifndef PKGLIB_EXTRACTTAR_H
15#define PKGLIB_EXTRACTTAR_H
16
b2e465d6 17#include <apt-pkg/fileutl.h>
60b64ffc 18#include <apt-pkg/macros.h>
b2e465d6 19
472ff00e
DK
20#include <string>
21
a4f6bdc8 22#ifndef APT_8_CLEANER_HEADERS
b9dadc24
DK
23#include <apt-pkg/dirstream.h>
24#include <algorithm>
a4f6bdc8
DK
25using std::min;
26#endif
27
472ff00e 28class pkgDirStream;
42ab8223 29
b2e465d6
AL
30class ExtractTar
31{
32 protected:
33
34 struct TarHeader;
35
36 // The varios types items can be
37 enum ItemType {NormalFile0 = '\0',NormalFile = '0',HardLink = '1',
38 SymbolicLink = '2',CharacterDevice = '3',
39 BlockDevice = '4',Directory = '5',FIFO = '6',
40 GNU_LongLink = 'K',GNU_LongName = 'L'};
41
42 FileFd &File;
3621b1c7 43 unsigned long long MaxInSize;
b2e465d6
AL
44 int GZPid;
45 FileFd InFd;
46 bool Eof;
8f3ba4e8 47 std::string DecompressProg;
b2e465d6
AL
48
49 // Fork and reap gzip
50 bool StartGzip();
b830f576 51 bool Done();
5dd00edb 52 APT_DEPRECATED_MSG("Parameter Force is ignored, use Done() instead.") bool Done(bool Force);
b830f576 53
b2e465d6
AL
54 public:
55
56 bool Go(pkgDirStream &Stream);
60b64ffc 57
3621b1c7 58 ExtractTar(FileFd &Fd,unsigned long long Max,std::string DecompressionProgram);
b2e465d6
AL
59 virtual ~ExtractTar();
60};
61
62#endif