comparison src/ls-oct-binary.cc @ 11586:12df7854fa7c

strip trailing whitespace from source files
author John W. Eaton <jwe@octave.org>
date Thu, 20 Jan 2011 17:24:59 -0500
parents fd0a3ac60b0e
children 72c96de7a403
comparison
equal deleted inserted replaced
11585:1473d0cf86d2 11586:12df7854fa7c
78 // 78 //
79 // object type bytes 79 // object type bytes
80 // ------ ---- ----- 80 // ------ ---- -----
81 // magic number string 10 81 // magic number string 10
82 // 82 //
83 // float format integer 1 83 // float format integer 1
84 // 84 //
85 // 85 //
86 // Data (one set for each item): 86 // Data (one set for each item):
87 // ============================ 87 // ============================
88 // 88 //
250 break; 250 break;
251 default: 251 default:
252 goto data_read_error; 252 goto data_read_error;
253 break; 253 break;
254 } 254 }
255 255
256 if (!tc.load_binary (is, swap, fmt)) 256 if (!tc.load_binary (is, swap, fmt))
257 { 257 {
258 data_read_error: 258 data_read_error:
259 error ("load: trouble reading binary file `%s'", filename.c_str ()); 259 error ("load: trouble reading binary file `%s'", filename.c_str ());
260 } 260 }
267 // binary format described above for read_binary_data. 267 // binary format described above for read_binary_data.
268 268
269 bool 269 bool
270 save_binary_data (std::ostream& os, const octave_value& tc, 270 save_binary_data (std::ostream& os, const octave_value& tc,
271 const std::string& name, const std::string& doc, 271 const std::string& name, const std::string& doc,
272 bool mark_as_global, bool save_as_floats) 272 bool mark_as_global, bool save_as_floats)
273 { 273 {
274 int32_t name_len = name.length (); 274 int32_t name_len = name.length ();
275 275
276 os.write (reinterpret_cast<char *> (&name_len), 4); 276 os.write (reinterpret_cast<char *> (&name_len), 4);
277 os << name; 277 os << name;
294 std::string typ = tc.type_name (); 294 std::string typ = tc.type_name ();
295 int32_t len = typ.length (); 295 int32_t len = typ.length ();
296 os.write (reinterpret_cast<char *> (&len), 4); 296 os.write (reinterpret_cast<char *> (&len), 4);
297 const char *btmp = typ.data (); 297 const char *btmp = typ.data ();
298 os.write (btmp, len); 298 os.write (btmp, len);
299 299
300 // The octave_value of tc is const. Make a copy... 300 // The octave_value of tc is const. Make a copy...
301 octave_value val = tc; 301 octave_value val = tc;
302 302
303 // Call specific save function 303 // Call specific save function
304 bool success = val.save_binary (os, save_as_floats); 304 bool success = val.save_binary (os, save_as_floats);