# HG changeset patch # User David Bateman # Date 1297031356 -3600 # Node ID c60eaf7dac31b6f53305ae115173e39e63412bf8 # Parent 6ba430a7555351bf2acd37c9a4bba5ea802d5df3 Remove parts of previous changset that weren't supposed to be committed diff -r 6ba430a75553 -r c60eaf7dac31 src/ls-mat5.cc --- a/src/ls-mat5.cc Sun Feb 06 23:25:31 2011 +0100 +++ b/src/ls-mat5.cc Sun Feb 06 23:29:16 2011 +0100 @@ -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 + (const_cast (outbuf.c_str ())), + &destLen, reinterpret_cast (inbuf), + element_length); + if (err != Z_OK) { - // FIXME -- find a way to avoid casting away const here! - int err = uncompress (reinterpret_cast - (const_cast (outbuf.c_str ())), - &destLen, reinterpret_cast (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 diff -r 6ba430a75553 -r c60eaf7dac31 src/txt-eng.h --- a/src/txt-eng.h Sun Feb 06 23:25:31 2011 +0100 +++ b/src/txt-eng.h Sun Feb 06 23:29:16 2011 +0100 @@ -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