]>
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>
17 #include "compress_gz.h"
18 #include "compress_bz.h"
20 /* In case you are wondering why the file magic is not in one place:
21 * It could be. But there is little (any?) benefit.
22 * What is important is that the file magic required for any _task_ is centralised.
23 * One such task is identifying compresss
25 * to federate into each class one might add a magic parameter to the constructor, which
26 * the class could test itself.
29 #define longest_magic 3
32 compress::decompress (io_stream
* original
)
36 char magic
[longest_magic
];
37 if (original
->peek (magic
, longest_magic
) > 0)
39 if (memcmp (magic
, "\037\213", 2) == 0)
42 compress_gz
*rv
= new compress_gz (original
);
47 else if (memcmp (magic
, "BZh", 3) == 0)
49 compress_bz
*rv
= new compress_bz (original
);
58 compress::~compress () {}
This page took 0.040833 seconds and 6 git commands to generate.