Mercurial > hg > octave-shane
changeset 11580:e306683a7e97
read_mat5_binary_element: improve diagnostic if uncompress fails
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 04:05:18 -0500 |
parents | 5c680b69b4e2 |
children | 6006ca07410d |
files | src/ChangeLog src/ls-mat5.cc |
diffstat | 2 files changed, 43 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,8 @@ 2011-01-20 John W. Eaton <jwe@octave.org> + * ls-mat5.cc (read_mat5_binary_element): + Improve diagnositc if uncompress fails. + * load-path.cc (strip_trailing_separators): New static function. (load_path::do_add, load_path::do_remove): Call it on directory arg.
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -547,7 +547,46 @@ element_length); if (err != Z_OK) - error ("load: error uncompressing data element"); + { + 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: + 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 ()); + } else { std::istringstream gz_is (outbuf);