Mercurial > hg > octave-nkf
changeset 5351:05adf9de7657
[project @ 2005-05-16 20:07:36 by dbateman]
author | dbateman |
---|---|
date | Mon, 16 May 2005 20:07:36 +0000 |
parents | ad44a165950d |
children | ac4a7df431d4 |
files | ChangeLog configure.in liboctave/CSparse.h liboctave/ChangeLog liboctave/dSparse.h src/ChangeLog src/load-save.cc src/ls-hdf5.cc src/ls-hdf5.h src/ls-mat5.cc src/ov-bool-sparse.cc src/ov-cell.cc src/ov-cx-sparse.cc src/ov-re-sparse.cc |
diffstat | 14 files changed, 188 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2005-05-16 David Bateman <dbateman@free.fr> + + * configure.in: Change UMFPACK_LONG_IDX to IDX_TYPE_LONG. + 2005-05-04 John W. Eaton <jwe@octave.org> * configure.in (AC_CHECK_LIB($zlib_lib, ...)): Check for
--- a/configure.in +++ b/configure.in @@ -29,7 +29,7 @@ EXTERN_CXXFLAGS="$CXXFLAGS" AC_INIT -AC_REVISION($Revision: 1.477 $) +AC_REVISION($Revision: 1.478 $) AC_PREREQ(2.57) AC_CONFIG_SRCDIR([src/octave.cc]) AC_CONFIG_HEADER(config.h) @@ -160,7 +160,7 @@ OCTAVE_IDX_TYPE=int elif test $ac_cv_sizeof_long -eq 8; then OCTAVE_IDX_TYPE=long - AC_DEFINE(UMFPACK_LONG_IDX, 1, [Define to 1 to use long int versions of UMFPACK]) + AC_DEFINE(IDX_TYPE_LONG, 1, [Define to 1 if octave index type is long]) else AC_MSG_WARN([no suitable type found for octave_idx_type so disabling 64-bit features]) USE_64_BIT_IDX_T=false
--- a/liboctave/CSparse.h +++ b/liboctave/CSparse.h @@ -423,7 +423,7 @@ SPARSE_FORWARD_DEFS (MSparse, SparseComplexMatrix, ComplexMatrix, Complex) -#ifdef UMFPACK_LONG_IDX +#ifdef IDX_TYPE_LONG #define UMFPACK_ZNAME(name) umfpack_zl_ ## name #else #define UMFPACK_ZNAME(name) umfpack_zi_ ## name
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2005-05-16 David Bateman <dbateman@free.fr> + + * dSparse.h: Change UMFPACK_LONG_IDX to IDX_TYPE_LONG. + * CSparse.h: ditto. + 2005-05-10 David Bateman <dbateman@free.fr> * dSparse.cc (determinant): Free numeric factorization after
--- a/liboctave/dSparse.h +++ b/liboctave/dSparse.h @@ -404,7 +404,7 @@ SPARSE_FORWARD_DEFS (MSparse, SparseMatrix, Matrix, double) -#ifdef UMFPACK_LONG_IDX +#ifdef IDX_TYPE_LONG #define UMFPACK_DNAME(name) umfpack_dl_ ## name #else #define UMFPACK_DNAME(name) umfpack_di_ ## name
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,25 @@ +2005-05-16 David Bateman <dbateman@free.fr> + + * ls-mat.cc (save_mat5_binary_element): Increase size of + compression buffer. + (load_mat5_binary_element): Allow ASCII encoded as UTF8, + and give error messages for multi-byte UTF8 and UTF16 and UTF32 + encodings. + + * ls-hdf5.h (H5T_NATIVE_IDX): New macro defining native indexing + type for HDF5 files + + * ls-hdf5.cc (save_hdf5_empty, load_hdf5_empty): Use + H5T_NATIVE_IDX to allow 64-bit indexing. + * ov-bool-sparse.cc (save_hdf5, load_hdf5): ditto. + * ov-re-sparse.cc (save_hdf5, load_hdf5): ditto. + * ov-cx-sparse.cc (save_hdf5, load_hdf5): ditto. + * ov-cell.cc (save_hdf5, load_hdf5): ditto. + + * load-save.cc (parse_save_options): Remove -nozip option. + (Fsave): If user defines file format, ignore completely the default + file format options. + 2005-05-12 John W. Eaton <jwe@octave.org> * Makefile.in (oct-gperf.h): Try harder to cause Make to exit here
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1151,10 +1151,6 @@ { use_zlib = true; } - else if (argv[i] == "-nozip" || argv[i] == "-nz") - { - use_zlib = false; - } #endif else break; @@ -1515,12 +1511,6 @@ HAVE_ZLIB_HELP_STRING -"@item -nozip\n\ -@itemx -nz\n\ -Disable the use of the file compression." - -HAVE_ZLIB_HELP_STRING - "@end table\n\ \n\ The list of variables to save may include wildcard patterns containing\n\ @@ -1580,11 +1570,19 @@ bool use_zlib = false; - parse_save_options (Vdefault_save_options, format, append, save_as_floats, - save_builtins, use_zlib, 0); - + load_save_format user_file_format = LS_UNKNOWN; + bool dummy; + + // Get user file format + parse_save_options (argv, argc, user_file_format, dummy, + dummy, dummy, dummy, 1); + + if (user_file_format == LS_UNKNOWN) + parse_save_options (Vdefault_save_options, format, append, save_as_floats, + save_builtins, use_zlib, 0); + int i = parse_save_options (argv, argc, format, append, save_as_floats, - save_builtins, use_zlib, 1); + save_builtins, use_zlib, 1); if (error_state) return retval;
--- a/src/ls-hdf5.cc +++ b/src/ls-hdf5.cc @@ -336,7 +336,9 @@ // What integer type do we really have.. std::string int_typ; #ifdef HAVE_H5T_GET_NATIVE_TYPE - // XXX FIXME XX test this code and activated with an autoconf test!! + // XXX FIXME XX test this code and activated with an autoconf + // test!! It is also incorrect for 64-bit indexing!! + switch (H5Tget_native_type (type_id, H5T_DIR_ASCEND)) { case H5T_NATIVE_CHAR: @@ -623,7 +625,7 @@ save_hdf5_empty (hid_t loc_id, const char *name, const dim_vector d) { hsize_t sz = d.length (); - int dims[sz]; + octave_idx_type dims[sz]; bool empty = false; hid_t space_hid = -1, data_hid = -1; int retval; @@ -640,7 +642,7 @@ space_hid = H5Screate_simple (1, &sz, (hsize_t *) 0); if (space_hid < 0) return space_hid; - data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (loc_id, name, H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -648,7 +650,7 @@ return data_hid; } - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*) dims) >= 0; H5Dclose (data_hid); @@ -674,10 +676,11 @@ hid_t data_hid = H5Dopen (loc_id, name); hid_t space_id = H5Dget_space (data_hid); H5Sget_simple_extent_dims (space_id, &hdims, &maxdims); - int dims[hdims]; int retval; - retval = H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + OCTAVE_LOCAL_BUFFER (octave_idx_type, dims, hdims); + + retval = H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) dims); if (retval >= 0) {
--- a/src/ls-hdf5.h +++ b/src/ls-hdf5.h @@ -173,6 +173,12 @@ const std::string& name, const std::string& doc, bool mark_as_global, bool save_as_floats); +#ifdef IDX_TYPE_LONG +#define H5T_NATIVE_IDX H5T_NATIVE_LONG +#else +#define H5T_NATIVE_IDX H5T_NATIVE_INT +#endif + #endif #endif
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -114,6 +114,7 @@ read_doubles (is, data, LS_CHAR, count, swap, flt_fmt); break; + case miUTF8: case miUINT8: read_doubles (is, data, LS_U_CHAR, count, swap, flt_fmt); break; @@ -905,10 +906,47 @@ } else { - tc = re; + if (arrayclass == mxCHAR_CLASS) + { + if (type == miUTF16 || type == miUTF32) + { + error ("load: can not read Unicode UTF16 and UTF32 encoded characters"); + goto data_read_error; + } + else if (type == miUTF8) + { + // Search for multi-byte encoded UTF8 characters and + // replace with 0x3F for '?'... Give the user a warning - if (arrayclass == mxCHAR_CLASS) - tc = tc.convert_to_str (false, true, '\''); + bool utf8_multi_byte = false; + for (int i = 0; i < n; i++) + { + unsigned char a = static_cast<char> (re(i)); + if (a > 0x7f) + utf8_multi_byte = true; + else + i++; + } + + if (utf8_multi_byte) + { + warning ("load: can not read multi-byte encoded UTF8 characters."); + warning (" Replacing unreadable characters with '?'."); + for (int i = 0; i < n; i++) + { + unsigned char a = static_cast<char> (re(i)); + if (a > 0x7f) + re(i) = 0x3F; + } + } + } + tc = re; + tc = tc.convert_to_str (false, true, '\''); + } + else + tc = re; + + tc = tc.convert_to_str (false, true, '\''); } } } @@ -1436,9 +1474,10 @@ { OSSTREAM_FREEZE (buf); - // destLen must be 0.1% larger than source buffer + 12 bytes + // destLen must be at least 0.1% larger than source buffer + // + 12 bytes. Reality is it must be larger again than that. uLongf srcLen = OSSTREAM_STR (buf).length (); - uLongf destLen = srcLen * 1001 / 1000 + 12; + uLongf destLen = srcLen * 101 / 100 + 12; OCTAVE_LOCAL_BUFFER (char, out_buf, destLen); if (compress (X_CAST (Bytef *, out_buf), &destLen,
--- a/src/ov-bool-sparse.cc +++ b/src/ov-bool-sparse.cc @@ -336,7 +336,7 @@ hid_t space_hid = -1, data_hid = -1; bool retval = true; SparseBoolMatrix m = sparse_bool_matrix_value (); - int tmp; + octave_idx_type tmp; hsize_t hdims[2]; space_hid = H5Screate_simple (0, hdims, (hsize_t*) 0); @@ -346,7 +346,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -356,8 +356,8 @@ } tmp = m.rows (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -366,7 +366,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -376,8 +376,8 @@ } tmp = m.cols (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -386,7 +386,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -396,8 +396,8 @@ } tmp = m.nnz (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -419,7 +419,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -428,9 +428,9 @@ return false; } - int * itmp = m.xcidx (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) itmp) >= 0; + octave_idx_type * itmp = m.xcidx (); + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) itmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -452,7 +452,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -462,8 +462,8 @@ } itmp = m.xridx (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) itmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) itmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -498,7 +498,7 @@ octave_sparse_bool_matrix::load_hdf5 (hid_t loc_id, const char *name, bool /* have_h5giterate_bug */) { - int nr, nc, nz; + octave_idx_type nr, nc, nz; hid_t group_hid, data_hid, space_hid; hsize_t rank; @@ -523,7 +523,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nr) < 0) { H5Dclose (data_hid); @@ -544,7 +544,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nc) < 0) { H5Dclose (data_hid); @@ -565,7 +565,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nz) < 0) { H5Dclose (data_hid); @@ -605,8 +605,8 @@ return false; } - int *itmp = m.xcidx (); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + octave_idx_type *itmp = m.xcidx (); + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) itmp) < 0) { H5Sclose (space_hid); @@ -632,7 +632,8 @@ H5Sget_simple_extent_dims (space_hid, hdims, maxdims); - if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1) + if (static_cast<int> (hdims[0]) != nz || + static_cast<int> (hdims[1]) != 1) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -641,7 +642,7 @@ } itmp = m.xridx (); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) itmp) < 0) { H5Sclose (space_hid); @@ -667,7 +668,8 @@ H5Sget_simple_extent_dims (space_hid, hdims, maxdims); - if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1) + if (static_cast<int> (hdims[0]) != nz || + static_cast<int> (hdims[1]) != 1) { H5Sclose (space_hid); H5Dclose (data_hid);
--- a/src/ov-cell.cc +++ b/src/ov-cell.cc @@ -748,13 +748,13 @@ return false; } - OCTAVE_LOCAL_BUFFER (int, hdims, rank); + OCTAVE_LOCAL_BUFFER (octave_idx_type, hdims, rank); // Octave uses column-major, while HDF5 uses row-major ordering for (hsize_t i = 0; i < rank; i++) hdims[i] = dv(rank-i-1); - size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_INT, space_hid, + size_hid = H5Dcreate (data_hid, "dims", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (size_hid < 0) { @@ -763,7 +763,7 @@ return false; } - if (! H5Dwrite (size_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (! H5Dwrite (size_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, hdims) < 0) { H5Dclose (size_hid); @@ -834,9 +834,9 @@ dv.resize (hdims[0]); - OCTAVE_LOCAL_BUFFER (int, tmp, hdims[0]); + OCTAVE_LOCAL_BUFFER (octave_idx_type, tmp, hdims[0]); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, tmp) < 0) { H5Dclose (data_hid);
--- a/src/ov-cx-sparse.cc +++ b/src/ov-cx-sparse.cc @@ -355,7 +355,7 @@ hid_t space_hid = -1, data_hid = -1; bool retval = true; SparseComplexMatrix m = sparse_complex_matrix_value (); - int tmp; + octave_idx_type tmp; hsize_t hdims[2]; space_hid = H5Screate_simple (0, hdims, (hsize_t*) 0); @@ -365,7 +365,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -375,8 +375,8 @@ } tmp = m.rows (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -385,7 +385,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -395,8 +395,8 @@ } tmp = m.cols (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -405,7 +405,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -415,8 +415,8 @@ } tmp = m.nnz (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) &tmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -438,7 +438,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -447,9 +447,9 @@ return false; } - int * itmp = m.xcidx (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) itmp) >= 0; + octave_idx_type * itmp = m.xcidx (); + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) itmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -471,7 +471,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -481,8 +481,8 @@ } itmp = m.xridx (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, - (void*) itmp) >= 0; + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, + H5P_DEFAULT, (void*) itmp) >= 0; H5Dclose (data_hid); if (!retval) { @@ -523,7 +523,8 @@ return false; } - data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, H5P_DEFAULT); + data_hid = H5Dcreate (group_hid, "data", type_hid, space_hid, + H5P_DEFAULT); if (data_hid < 0) { H5Sclose (space_hid); @@ -554,7 +555,7 @@ octave_sparse_complex_matrix::load_hdf5 (hid_t loc_id, const char *name, bool /* have_h5giterate_bug */) { - int nr, nc, nz; + octave_idx_type nr, nc, nz; hid_t group_hid, data_hid, space_hid; hsize_t rank; @@ -579,7 +580,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nr) < 0) { H5Dclose (data_hid); @@ -600,7 +601,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nc) < 0) { H5Dclose (data_hid); @@ -621,7 +622,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nz) < 0) { H5Dclose (data_hid); @@ -661,8 +662,8 @@ return false; } - int *itmp = m.xcidx (); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + octave_idx_type *itmp = m.xcidx (); + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) itmp) < 0) { H5Sclose (space_hid); @@ -688,7 +689,8 @@ H5Sget_simple_extent_dims (space_hid, hdims, maxdims); - if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1) + if (static_cast<int> (hdims[0]) != nz || + static_cast<int> (hdims[1]) != 1) { H5Sclose (space_hid); H5Dclose (data_hid); @@ -697,7 +699,7 @@ } itmp = m.xridx (); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) itmp) < 0) { H5Sclose (space_hid); @@ -735,7 +737,8 @@ H5Sget_simple_extent_dims (space_hid, hdims, maxdims); - if (static_cast<int> (hdims[0]) != nz || static_cast<int> (hdims[1]) != 1) + if (static_cast<int> (hdims[0]) != nz || + static_cast<int> (hdims[1]) != 1) { H5Sclose (space_hid); H5Dclose (data_hid);
--- a/src/ov-re-sparse.cc +++ b/src/ov-re-sparse.cc @@ -399,7 +399,7 @@ hid_t space_hid = -1, data_hid = -1; bool retval = true; SparseMatrix m = sparse_matrix_value (); - int tmp; + octave_idx_type tmp; hsize_t hdims[2]; space_hid = H5Screate_simple (0, hdims, (hsize_t*) 0); @@ -409,7 +409,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nr", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -419,7 +419,7 @@ } tmp = m.rows (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) @@ -429,7 +429,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nc", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -439,7 +439,7 @@ } tmp = m.cols (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) @@ -449,7 +449,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "nz", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -459,7 +459,7 @@ } tmp = m.nnz (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*) &tmp) >= 0; H5Dclose (data_hid); if (!retval) @@ -482,7 +482,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "cidx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -491,8 +491,8 @@ return false; } - int * itmp = m.xcidx (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + octave_idx_type * itmp = m.xcidx (); + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*) itmp) >= 0; H5Dclose (data_hid); if (!retval) @@ -515,7 +515,7 @@ return false; } - data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_INT, space_hid, + data_hid = H5Dcreate (group_hid, "ridx", H5T_NATIVE_IDX, space_hid, H5P_DEFAULT); if (data_hid < 0) { @@ -525,7 +525,7 @@ } itmp = m.xridx (); - retval = H5Dwrite (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, H5P_DEFAULT, + retval = H5Dwrite (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void*) itmp) >= 0; H5Dclose (data_hid); if (!retval) @@ -582,7 +582,7 @@ octave_sparse_matrix::load_hdf5 (hid_t loc_id, const char *name, bool /* have_h5giterate_bug */) { - int nr, nc, nz; + octave_idx_type nr, nc, nz; hid_t group_hid, data_hid, space_hid; hsize_t rank; @@ -607,7 +607,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nr) < 0) { H5Dclose (data_hid); @@ -628,7 +628,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nc) < 0) { H5Dclose (data_hid); @@ -649,7 +649,7 @@ return false; } - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) &nz) < 0) { H5Dclose (data_hid); @@ -689,8 +689,8 @@ return false; } - int *itmp = m.xcidx (); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + octave_idx_type *itmp = m.xcidx (); + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) itmp) < 0) { H5Sclose (space_hid); @@ -725,7 +725,7 @@ } itmp = m.xridx (); - if (H5Dread (data_hid, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + if (H5Dread (data_hid, H5T_NATIVE_IDX, H5S_ALL, H5S_ALL, H5P_DEFAULT, (void *) itmp) < 0) { H5Sclose (space_hid);