Skip to content

Commit

Permalink
make sure gzip works if bzip2 is missing (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbaakman authored May 10, 2019
1 parent 910a35e commit fb0eb7c
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/hssp-convert-3to1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

#ifdef HAVE_LIBBZ2
#include <boost/iostreams/filter/bzip2.hpp>
#endif
#ifdef HAVE_LIBZ
#include <boost/iostreams/filter/gzip.hpp>
#endif

Expand Down
10 changes: 8 additions & 2 deletions src/hsspconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#ifdef HAVE_LIBBZ2
#include <boost/iostreams/filter/bzip2.hpp>
#endif
#ifdef HAVE_LIBZ
#include <boost/iostreams/filter/gzip.hpp>
#endif

Expand Down Expand Up @@ -91,7 +93,9 @@ int main(int argc, char* const argv[])
#ifdef HAVE_LIBBZ2
if (input.extension() == ".bz2")
in.push(io::bzip2_decompressor());
else if (input.extension() == ".gz")
#endif
#ifdef HAVE_LIBZ
if (input.extension() == ".gz")
in.push(io::gzip_decompressor());
#endif
in.push(ifs);
Expand All @@ -113,7 +117,9 @@ int main(int argc, char* const argv[])
#ifdef HAVE_LIBBZ2
if (output.extension() == ".bz2")
out.push(io::bzip2_compressor());
else if (output.extension() == ".gz")
#endif
#ifdef HAVE_LIBZ
if (output.extension() == ".gz")
out.push(io::gzip_compressor());
#endif
out.push(ofs);
Expand Down
10 changes: 8 additions & 2 deletions src/mkdssp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

#ifdef HAVE_LIBBZ2
#include <boost/iostreams/filter/bzip2.hpp>
#endif
#ifdef HAVE_LIBZ
#include <boost/iostreams/filter/gzip.hpp>
#endif

Expand Down Expand Up @@ -127,7 +129,9 @@ int main(int argc, char* argv[])
in.push(io::bzip2_decompressor());
input.erase(input.length() - 4);
}
else if (ba::ends_with(input, ".gz"))
#endif
#ifdef HAVE_LIBZ
if (ba::ends_with(input, ".gz"))
{
in.push(io::gzip_decompressor());
input.erase(input.length() - 3);
Expand Down Expand Up @@ -163,7 +167,9 @@ int main(int argc, char* argv[])
#ifdef HAVE_LIBBZ2
if (ba::ends_with(output, ".bz2"))
out.push(io::bzip2_compressor());
else if (ba::ends_with(output, ".gz"))
#endif
#ifdef HAVE_LIBZ
if (ba::ends_with(output, ".gz"))
out.push(io::gzip_compressor());
#endif
out.push(outfile);
Expand Down
11 changes: 9 additions & 2 deletions src/mkhssp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#ifdef HAVE_LIBBZ2
#include <boost/iostreams/filter/bzip2.hpp>
#endif
#ifdef HAVE_LIBZ
#include <boost/iostreams/filter/gzip.hpp>
#endif

Expand Down Expand Up @@ -190,7 +192,9 @@ int main(int argc, char* argv[])
in.push(io::bzip2_decompressor());
input.erase(input.length() - 4, std::string::npos);
}
else if (ba::ends_with(input, ".gz"))
#endif
#ifdef HAVE_LIBZ
if (ba::ends_with(input, ".gz"))
{
in.push(io::gzip_decompressor());
input.erase(input.length() - 3, std::string::npos);
Expand All @@ -214,9 +218,12 @@ int main(int argc, char* argv[])
#ifdef HAVE_LIBBZ2
if (ba::ends_with(outfilename.string(), ".bz2"))
out.push(io::bzip2_compressor());
else if (ba::ends_with(outfilename.string(), ".gz"))
#endif
#ifdef HAVE_LIBZ
if (ba::ends_with(outfilename.string(), ".gz"))
out.push(io::gzip_compressor());
#endif

out.push(outfile);
}
else
Expand Down

0 comments on commit fb0eb7c

Please sign in to comment.