# HG changeset patch # User jwe # Date 1155924320 0 # Node ID 117052c2b53c7b20d32794a117b51f9531f61ddc # Parent 0dd8428bb2609e8d7e60d493067a6a78f6a4d320 [project @ 2006-08-18 18:05:20 by jwe] diff -r 0dd8428bb260 -r 117052c2b53c src/ChangeLog --- a/src/ChangeLog Fri Aug 18 17:50:23 2006 +0000 +++ b/src/ChangeLog Fri Aug 18 18:05:20 2006 +0000 @@ -1,3 +1,8 @@ +2006-08-18 Benjamin Lindner + + * ls-mat5.cc (read_mat5_tag): Declare type as int32_t, not int. + (read_mat5_binary_element): Likewise, for len and element_length. + 2006-08-18 John W. Eaton * load-save.h (enum load_save_format): New element, LS_MAT_ASCII_LONG. diff -r 0dd8428bb260 -r 117052c2b53c src/ls-mat5.cc --- a/src/ls-mat5.cc Fri Aug 18 17:50:23 2006 +0000 +++ b/src/ls-mat5.cc Fri Aug 18 18:05:20 2006 +0000 @@ -342,7 +342,7 @@ // place the type code in TYPE and the byte count in BYTES // return nonzero on error static int -read_mat5_tag (std::istream& is, bool swap, int& type, int& bytes) +read_mat5_tag (std::istream& is, bool swap, int32_t& type, int& bytes) { unsigned int upper; int32_t temp; @@ -404,15 +404,15 @@ // initialization of variable. oct_mach_info::float_format flt_fmt = oct_mach_info::flt_fmt_unknown; - int type = 0; + int32_t type = 0; bool imag; bool logicalvar; enum arrayclasstype arrayclass; int32_t nzmax; int32_t flags; dim_vector dims; - int len; - int element_length; + int32_t len; + int32_t element_length; std::streampos pos; int16_t number; number = *(int16_t *)"\x00\x01"; @@ -1646,8 +1646,10 @@ SparseComplexMatrix m = tc.sparse_complex_matrix_value (); int nc = m.cols (); - write_mat5_integer_data (os, m.ridx (), - sizeof(int), nnz); - write_mat5_integer_data (os, m.cidx (), - sizeof(int), nc + 1); + int tmp = sizeof (int); + + write_mat5_integer_data (os, m.ridx (), -tmp, nnz); + write_mat5_integer_data (os, m.cidx (), -tmp, nc + 1); NDArray buf (dim_vector (nnz, 1)); @@ -1666,8 +1668,10 @@ SparseMatrix m = tc.sparse_matrix_value (); int nc = m.cols (); - write_mat5_integer_data (os, m.ridx (), - sizeof(int), nnz); - write_mat5_integer_data (os, m.cidx (), - sizeof(int), nc + 1); + int tmp = sizeof (int); + + write_mat5_integer_data (os, m.ridx (), -tmp, nnz); + write_mat5_integer_data (os, m.cidx (), -tmp, nc + 1); // FIXME // Is there a way to easily do without this buffer