File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -54,22 +54,21 @@ class RasterGrid
5454
5555 // Construct FileReader
5656 storage::io::FileReader file_reader (filepath, storage::io::FileReader::HasNoFingerprint);
57- std::string buf ;
58- buf .resize (xdim * 11 ); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11
59- BOOST_ASSERT (xdim * 11 <= buf .size ());
57+ std::string buffer ;
58+ buffer .resize (xdim * 11 ); // INT32_MAX = 2147483647 = 10 chars + 1 white space = 11
59+ BOOST_ASSERT (xdim * 11 <= buffer .size ());
6060
6161 for (unsigned int y = 0 ; y < ydim; y++)
6262 {
6363 // read one line from file.
64- file_reader.ReadLine (&buf [0 ], xdim * 11 );
65- boost::algorithm::trim (buf );
64+ file_reader.ReadLine (&buffer [0 ], xdim * 11 );
65+ boost::algorithm::trim (buffer );
6666
6767 std::vector<std::string> result;
6868 boost::split (
69- result, buf, boost::is_any_of (" \r\n\0 " ), boost::algorithm::token_compress_on);
70- // boost::split(result, buf, boost::is_any_of(" \r\n\0"));
69+ result, buffer, boost::is_any_of (" \r\n\0 " ), boost::algorithm::token_compress_on);
7170 unsigned int x = 0 ;
72- BOOST_FOREACH (std::string s, result)
71+ for ( const auto &s : result)
7372 {
7473 if (x < xdim)
7574 _data[(y * xdim) + x] = atoi (s.c_str ());
Original file line number Diff line number Diff line change @@ -80,12 +80,8 @@ class FileReader
8080 {
8181 if (0 < count)
8282 {
83- const auto &ios =
84- input_stream.getline (reinterpret_cast <char *>(dest), count * sizeof (T));
85- for (std::size_t n = ios.gcount (); n < count; ++n)
86- {
87- reinterpret_cast <char *>(dest)[n] = ' \0 ' ;
88- }
83+ memset (dest, 0 , count * sizeof (T));
84+ input_stream.getline (reinterpret_cast <char *>(dest), count * sizeof (T));
8985 }
9086 }
9187
You can’t perform that action at this time.
0 commit comments