Mercurial > hg > octave-lyh
comparison src/ls-mat5.cc @ 4944:44046bbaa52c
[project @ 2004-08-31 05:30:46 by jwe]
author | jwe |
---|---|
date | Tue, 31 Aug 2004 05:30:47 +0000 |
parents | e44d0ac643a5 |
children | 11bea7392e69 |
comparison
equal
deleted
inserted
replaced
4943:1a499d0c58f5 | 4944:44046bbaa52c |
---|---|
170 | 170 |
171 if (! is.read (X_CAST (char *, &temp), 4 )) | 171 if (! is.read (X_CAST (char *, &temp), 4 )) |
172 goto data_read_error; | 172 goto data_read_error; |
173 | 173 |
174 if (swap) | 174 if (swap) |
175 swap_4_bytes ((char *)&temp); | 175 swap_bytes<4> (&temp); |
176 | 176 |
177 upper = (temp >> 16) & 0xffff; | 177 upper = (temp >> 16) & 0xffff; |
178 type = temp & 0xffff; | 178 type = temp & 0xffff; |
179 | 179 |
180 if (upper) | 180 if (upper) |
185 else | 185 else |
186 { | 186 { |
187 if (! is.read (X_CAST (char *, &temp), 4 )) | 187 if (! is.read (X_CAST (char *, &temp), 4 )) |
188 goto data_read_error; | 188 goto data_read_error; |
189 if (swap) | 189 if (swap) |
190 swap_4_bytes ((char *)&temp); | 190 swap_bytes<4> (&temp); |
191 bytes = temp; | 191 bytes = temp; |
192 } | 192 } |
193 | 193 |
194 return 0; | 194 return 0; |
195 | 195 |
196 data_read_error: | 196 data_read_error: |
197 return 1; | 197 return 1; |
198 } | |
199 | |
200 static void | |
201 read_int (std::istream& is, bool swap, FOUR_BYTE_INT& val) | |
202 { | |
203 is.read (reinterpret_cast<char *> (&val), 4); | |
204 | |
205 if (swap) | |
206 swap_bytes<4> (&val); | |
198 } | 207 } |
199 | 208 |
200 // Extract one data element (scalar, matrix, string, etc.) from stream | 209 // Extract one data element (scalar, matrix, string, etc.) from stream |
201 // IS and place it in TC, returning the name of the variable. | 210 // IS and place it in TC, returning the name of the variable. |
202 // | 211 // |
376 | 385 |
377 if (! is.read (X_CAST (char *, &field_name_length), fn_len )) | 386 if (! is.read (X_CAST (char *, &field_name_length), fn_len )) |
378 goto data_read_error; | 387 goto data_read_error; |
379 | 388 |
380 if (swap) | 389 if (swap) |
381 swap_4_bytes ((char *)&field_name_length); | 390 swap_bytes<4> (&field_name_length); |
382 | 391 |
383 // field name subelement. The length of this subelement tells | 392 // field name subelement. The length of this subelement tells |
384 // us how many fields there are. | 393 // us how many fields there are. |
385 if (read_mat5_tag (is, swap, fn_type, fn_len) || fn_type != miINT8) | 394 if (read_mat5_tag (is, swap, fn_type, fn_len) || fn_type != miINT8) |
386 { | 395 { |