66 Copyright (c) 2015 Scientific Computing and Imaging Institute,
77 University of Utah.
88
9-
9+
1010 Permission is hereby granted, free of charge, to any person obtaining a
1111 copy of this software and associated documentation files (the "Software"),
1212 to deal in the Software without restriction, including without limitation
@@ -243,7 +243,7 @@ BinaryPiostream::~BinaryPiostream()
243243}
244244
245245void
246- BinaryPiostream::reset_post_header ()
246+ BinaryPiostream::reset_post_header ()
247247{
248248 if (! reading ()) return ;
249249
@@ -252,15 +252,15 @@ BinaryPiostream::reset_post_header()
252252 if (version () == 1 )
253253 {
254254 // Old versions had headers of size 12.
255- char hdr[12 ];
255+ char hdr[12 ];
256256 // read header
257257 fread (hdr, 1 , 12 , fp_);
258258 }
259259 else
260260 {
261261 // Versions > 1 have size of 16 to account for endianness in
262262 // header (LIT | BIG).
263- char hdr[16 ];
263+ char hdr[16 ];
264264 // read header
265265 fread (hdr, 1 , 16 , fp_);
266266 }
@@ -530,15 +530,15 @@ BinaryPiostream::io(std::string& data)
530530 if (buf_size)
531531 {
532532 char * buf = new char [buf_size];
533-
533+
534534 // Read in data plus padding.
535535 if (!fread (buf, sizeof (char ), buf_size, fp_))
536536 {
537537 err = true ;
538538 delete [] buf;
539539 return ;
540540 }
541-
541+
542542 // Only use actual size of string.
543543 for (unsigned int i=0 ; i<chars; i++)
544544 data += buf[i];
@@ -576,7 +576,7 @@ BinaryPiostream::block_io(void *data, size_t s, size_t nmemb)
576576 {
577577 err = true ;
578578 reporter_->error (" BinaryPiostream error writing block io." );
579- }
579+ }
580580 }
581581 return true ;
582582}
@@ -889,8 +889,8 @@ TextPiostream::~TextPiostream()
889889}
890890
891891void
892- TextPiostream::reset_post_header ()
893- {
892+ TextPiostream::reset_post_header ()
893+ {
894894 if (! reading ()) return ;
895895 istr->seekg (0 , std::ios::beg);
896896
@@ -907,7 +907,7 @@ TextPiostream::reset_post_header()
907907}
908908
909909void
910- TextPiostream::io ( int do_quotes, std::string& str)
910+ TextPiostream::ioString ( bool do_quotes, std::string& str)
911911{
912912 if (do_quotes)
913913 {
@@ -972,7 +972,7 @@ TextPiostream::peek_class()
972972 else
973973 {
974974 expect (' {' );
975- io ( 0 , peekname_);
975+ ioString ( false , peekname_);
976976 have_peekname_ = true ;
977977 return peekname_;
978978 }
@@ -989,7 +989,7 @@ TextPiostream::begin_class(const std::string& classname, int current_version)
989989 {
990990 gname=classname;
991991 *ostr << ' {' ;
992- io ( 0 , gname);
992+ ioString ( false , gname);
993993 }
994994 else if (dir==Read && have_peekname_)
995995 {
@@ -998,10 +998,10 @@ TextPiostream::begin_class(const std::string& classname, int current_version)
998998 else
999999 {
10001000 expect (' {' );
1001- io ( 0 , gname);
1001+ ioString ( false , gname);
10021002 }
10031003 have_peekname_ = false ;
1004-
1004+
10051005 if (dir==Read)
10061006 {
10071007
@@ -1403,7 +1403,7 @@ void airToLower(char* p)
14031403{
14041404 for ( ; *p; ++p) *p = tolower (*p);
14051405}
1406-
1406+
14071407void
14081408TextPiostream::io (double & data)
14091409{
@@ -1500,7 +1500,7 @@ TextPiostream::io(float& data)
15001500 if (strcmp (ibuf," -inf" )==0 )
15011501 {
15021502 data = -std::numeric_limits<float >::infinity ();
1503- }
1503+ }
15041504 else
15051505 {
15061506 char buf[100 ];
@@ -1575,12 +1575,12 @@ TextPiostream::io(std::string& data)
15751575}
15761576
15771577
1578- void
1578+ void
15791579TextPiostream::next_entry ()
15801580{
15811581 if (err) return ;
15821582 std::istream& in=*istr;
1583-
1583+
15841584 if (!in)
15851585 {
15861586 reporter_->error (" Read in expect failed (before read)." );
@@ -1605,23 +1605,23 @@ TextPiostream::next_entry()
16051605 in.getline (buf, 100 );
16061606 reporter_->error (std::string (" Rest of line is: " ) + buf);
16071607 reporter_->error (" Object is not intact." );
1608- return ;
1608+ return ;
16091609 }
1610-
1610+
16111611 while ((c == ' ' )||(c == ' \t ' )||(c == ' \n ' )||(c == ' \r ' ))
16121612 {
1613- in.get (c);
1613+ in.get (c);
16141614 }
1615-
1615+
16161616 if ((c == ' ,' )||(c == ' ;' ))
16171617 {
16181618 in.get (c);
16191619 while ((c == ' ' )||(c == ' \t ' )||(c == ' \n ' )||(c == ' \r ' ))
16201620 {
1621- in.get (c);
1622- }
1621+ in.get (c);
1622+ }
16231623 }
1624-
1624+
16251625 in.unget ();
16261626}
16271627
@@ -1721,7 +1721,7 @@ TextPiostream::eof() {
17211721 in.peek ();
17221722 return in.eof ();
17231723}
1724-
1724+
17251725
17261726
17271727// FastPiostream is a non portable binary output.
@@ -1810,7 +1810,7 @@ fp_(0)
18101810 size_t chars_read = fread (hdr, sizeof (char ), 12 , fp_);
18111811 if (chars_read != 12 )
18121812 {
1813- reporter_->error (" Error reading header from socket: " +
1813+ reporter_->error (" Error reading header from socket: " +
18141814 to_string (fd) + " ." );
18151815 err = true ;
18161816 return ;
@@ -1869,7 +1869,7 @@ FastPiostream::~FastPiostream()
18691869
18701870
18711871void
1872- FastPiostream::reset_post_header ()
1872+ FastPiostream::reset_post_header ()
18731873{
18741874 if (! reading ()) return ;
18751875
@@ -2055,12 +2055,10 @@ FastPiostream::block_io(void *data, size_t s, size_t nmemb)
20552055 {
20562056 err = true ;
20572057 reporter_->error (" FastPiostream error writing block io." );
2058- }
2058+ }
20592059 }
20602060 return true ;
20612061}
20622062
20632063
20642064} // End namespace SCIRun
2065-
2066-
0 commit comments