Skip to content

Commit 394cc28

Browse files
committed
Store save type in binary-float format also for empty matrices (bug #67271).
* liboctave/util/data-conv.cc (LS_DO_WRITE): Store save type for empty matrices also when converting the data type on save. It was previously only saved when the data was written in its native format.
1 parent 03ef0d7 commit 394cc28

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

liboctave/util/data-conv.cc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -625,15 +625,15 @@ oct_data_conv::data_type_as_string (oct_data_conv::data_type dt)
625625
#define LS_DO_WRITE(TYPE, data, size, len, stream) \
626626
do \
627627
{ \
628-
if (len > 0) \
629-
{ \
630-
char tmp_type = type; \
631-
stream.write (&tmp_type, 1); \
632-
OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
633-
for (octave_idx_type i = 0; i < len; i++) \
634-
ptr[i] = static_cast<TYPE> (data[i]); \
635-
std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
636-
stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
628+
char tmp_type = type; \
629+
stream.write (&tmp_type, 1); \
630+
if (len > 0) \
631+
{ \
632+
OCTAVE_LOCAL_BUFFER (TYPE, ptr, len); \
633+
for (octave_idx_type i = 0; i < len; i++) \
634+
ptr[i] = static_cast<TYPE> (data[i]); \
635+
std::streamsize n_bytes = size * static_cast<std::streamsize> (len); \
636+
stream.write (reinterpret_cast<char *> (ptr), n_bytes); \
637637
} \
638638
} \
639639
while (0)

0 commit comments

Comments
 (0)