]>
cygwin.com Git - cygwin-apps/setup.git/blob - compress.cc
2 * Copyright (c) 2001, Robert Collins.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * A copy of the GNU General Public License can be found at
12 * Written by Robert Collins <rbtcollins@hotmail.com>
16 /* Archive IO operations
20 static const char *cvsid
=
29 #include "io_stream.h"
31 #include "zlib/zlib.h"
32 #include "compress_gz.h"
33 #include "compress_bz.h"
35 /* In case you are wondering why the file magic is not in one place:
36 * It could be. But there is little (any?) benefit.
37 * What is important is that the file magic required for any _task_ is centralised.
38 * One such task is identifying compresss
40 * to federate into each class one might add a magic parameter to the constructor, which
41 * the class could test itself.
44 #define longest_magic 3
47 compress::decompress (io_stream
* original
)
51 char magic
[longest_magic
];
52 if (original
->peek (magic
, longest_magic
) > 0)
54 if (memcmp (magic
, "\037\213", 2) == 0)
57 compress_gz
*rv
= new compress_gz (original
);
62 else if (memcmp (magic
, "BZh", 3) == 0)
64 compress_bz
*rv
= new compress_bz (original
);
74 compress::read (void *buffer
, size_t len
)
76 log (LOG_TIMESTAMP
, "compress::read called");
81 compress::write (void *buffer
, size_t len
)
83 log (LOG_TIMESTAMP
, "compress::write called");
88 compress::peek (void *buffer
, size_t len
)
90 log (LOG_TIMESTAMP
, "compress::peek called");
97 log (LOG_TIMESTAMP
, "bz::tell called");
104 log (LOG_TIMESTAMP
, "compress::error called");
109 compress::next_file_name ()
111 log (LOG_TIMESTAMP
, "compress::next_file_name called");
115 compress::~compress ()
117 log (LOG_TIMESTAMP
, "compress::~compress called");
This page took 0.045584 seconds and 6 git commands to generate.