Mercurial > hg > octave-terminal
changeset 12405:80666cb91c4c release-3-4-x
Remove parts of previous changset that weren't supposed to be committed
author | David Bateman <dbateman@free.fr> |
---|---|
date | Sun, 06 Feb 2011 23:29:16 +0100 |
parents | 6001e10ce152 |
children | bc945da1289b |
files | src/ls-mat5.cc src/txt-eng.h |
diffstat | 2 files changed, 48 insertions(+), 92 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -525,8 +525,6 @@ OCTAVE_LOCAL_BUFFER (char, inbuf, element_length); is.read (inbuf, element_length); - std::cerr << "len: " << element_length << "\n"; - // We uncompress the first 8 bytes of the header to get the buffer length // This will fail with an error Z_MEM_ERROR uLongf destLen = 8; @@ -539,75 +537,61 @@ if (swap) swap_bytes<4> (tmp, 2); - destLen = tmp[1] + 32; + destLen = tmp[1] + 8; std::string outbuf (destLen, ' '); - // Try reading the compressed file with 8 different lengthes - // to account for the zero padding that are added to matlab - // files - for (int k = 0; k < 8; k++) + // FIXME -- find a way to avoid casting away const here! + int err = uncompress (reinterpret_cast<Bytef *> + (const_cast<char *> (outbuf.c_str ())), + &destLen, reinterpret_cast<Bytef *> (inbuf), + element_length); + if (err != Z_OK) { - // FIXME -- find a way to avoid casting away const here! - int err = uncompress (reinterpret_cast<Bytef *> - (const_cast<char *> (outbuf.c_str ())), - &destLen, reinterpret_cast<Bytef *> (inbuf), - element_length - k); - - if (err != Z_OK) + std::string msg; + switch (err) { - std::string msg; - switch (err) - { - case Z_STREAM_END: - msg = "stream end"; - break; - - case Z_NEED_DICT: - msg = "need dict"; - break; - - case Z_ERRNO: - msg = "errno case"; - break; - - case Z_STREAM_ERROR: - msg = "stream error"; - break; - - case Z_DATA_ERROR: - if (k != 7) - { - std::cerr << "k = " << k << "\n"; - continue; - } - else - msg = "data error"; - break; - - case Z_MEM_ERROR: - msg = "mem error"; - break; - - case Z_BUF_ERROR: - msg = "buf error"; - break; - - case Z_VERSION_ERROR: - msg = "version error"; - break; - } - - error ("load: error uncompressing data element (%s from zlib)", - msg.c_str ()); + case Z_STREAM_END: + msg = "stream end"; + break; + + case Z_NEED_DICT: + msg = "need dict"; + break; + + case Z_ERRNO: + msg = "errno case"; + break; + + case Z_STREAM_ERROR: + msg = "stream error"; + break; + + case Z_DATA_ERROR: + msg = "data error"; + break; + + case Z_MEM_ERROR: + msg = "mem error"; + break; + + case Z_BUF_ERROR: + msg = "buf error"; + break; + + case Z_VERSION_ERROR: + msg = "version error"; break; } - else - { - std::istringstream gz_is (outbuf); - retval = read_mat5_binary_element (gz_is, filename, + + error ("load: error uncompressing data element (%s from zlib)", + msg.c_str ()); + break; + } + else + { + std::istringstream gz_is (outbuf); + retval = read_mat5_binary_element (gz_is, filename, swap, global, tc); - break; - } } } else
--- a/src/txt-eng.h +++ b/src/txt-eng.h @@ -190,32 +190,4 @@ } }; -class -OCTINTERP_API -text_parser_tex : public text_parser -{ -public: - text_parser_tex (void) : text_parser () { } - - ~text_parser_tex (void) { } - - // FIXME: is it possible to use reference counting to manage the - // memory for the object returned by the text parser? That would be - // preferable to having to know when and where to delete the object it - // creates... - - text_element* parse (const std::string& s); - - private: - text_element_list lst; - mutable size_t anchor; - - std::string getargument(const std::string& s, size_t start) const; - - size_t matchbrace(const std::string& s, size_t start) const; - - - -}; - #endif