From 0de22c86f8b444caf8d66f597ef7c8b538c99c22 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Thu, 20 Jan 2005 21:34:23 +0000 Subject: [PATCH] use USE_COMPRESSION to guard code. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9516 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/ChangeLog | 7 +++++++ src/buffer.C | 9 +++++++-- src/lyxlex_pimpl.C | 4 ++++ src/lyxlex_pimpl.h | 8 +++++++- src/output_plaintext.C | 3 ++- 5 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 73b407350e..fe359efd19 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,10 @@ +2005-01-20 Asger Ottar Alstrup + + * buffer.C: + * lyxlex_pimpl.[Ch]: use USE_COMPRESSION guard. + + * output_plaintext.C: remove unneeded #include gzstream.h. + 2005-01-20 Angus Leeming * SpellBase.h: rename some of the elements of the Result enum. diff --git a/src/buffer.C b/src/buffer.C index d93d9ac832..fabaa9e0ed 100644 --- a/src/buffer.C +++ b/src/buffer.C @@ -65,7 +65,9 @@ #include "support/FileInfo.h" #include "support/filetools.h" -#include "support/gzstream.h" +#ifdef USE_COMPRESSION +# include "support/gzstream.h" +#endif #include "support/lyxlib.h" #include "support/os.h" #include "support/path.h" @@ -759,12 +761,15 @@ bool Buffer::writeFile(string const & fname) const bool retval = false; if (params().compressed) { +#ifdef USE_COMPRESSION gz::ogzstream ofs(fname.c_str()); if (!ofs) return false; retval = do_writeFile(ofs); - +#else + return false; +#endif } else { ofstream ofs(fname.c_str()); if (!ofs) diff --git a/src/lyxlex_pimpl.C b/src/lyxlex_pimpl.C index 81a6e65c01..292778761a 100644 --- a/src/lyxlex_pimpl.C +++ b/src/lyxlex_pimpl.C @@ -140,6 +140,7 @@ bool LyXLex::Pimpl::setFile(string const & filename) if (format == "gzip" || format == "zip" || format == "compress") { lyxerr[Debug::LYXLEX] << "lyxlex: compressed" << endl; +#ifdef USE_COMPRESSION // The check only outputs a debug message, because it triggers // a bug in compaq cxx 6.2, where is_open() returns 'true' for // a fresh new filebuf. (JMarc) @@ -151,6 +152,9 @@ bool LyXLex::Pimpl::setFile(string const & filename) name = filename; lineno = 0; return gz_.is_open() && is.good(); +#else + return false; +#endif } else { lyxerr[Debug::LYXLEX] << "lyxlex: UNcompressed" << endl; diff --git a/src/lyxlex_pimpl.h b/src/lyxlex_pimpl.h index 681c0a746f..d95367f75d 100644 --- a/src/lyxlex_pimpl.h +++ b/src/lyxlex_pimpl.h @@ -14,10 +14,13 @@ #include "lyxlex.h" -#include "support/gzstream.h" +#ifdef USE_COMPRESSION +# include "support/gzstream.h" +#endif #include +#include #include #include @@ -56,8 +59,11 @@ public: void pushToken(std::string const &); /// fb_ is only used to open files, the stream is accessed through is. std::filebuf fb_; + +#ifdef HAVE_COMPRESSION /// gz_ is only used to open files, the stream is accessed through is. gz::gzstreambuf gz_; +#endif /// the stream that we use. std::istream is; diff --git a/src/output_plaintext.C b/src/output_plaintext.C index d0da1d04dc..4b4be01ad1 100644 --- a/src/output_plaintext.C +++ b/src/output_plaintext.C @@ -22,9 +22,10 @@ #include "ParagraphList_fwd.h" #include "ParagraphParameters.h" -#include "support/gzstream.h" #include "support/lstrings.h" +#include + using lyx::support::ascii_lowercase; using lyx::support::compare_ascii_no_case; using lyx::support::compare_no_case; -- 2.39.2