@@ -355,22 +355,22 @@ separate_chromosomes(const vector<GenomicRegion>& regions,
355355}
356356
357357
358- static bool
359- is_header_line (const string& line) {
360- static const char * browser_label = " browser" ;
361- static const size_t browser_label_len = 7 ;
362- for (size_t i = 0 ; i < browser_label_len; ++i)
358+ static inline auto
359+ is_header_line (const string& line) -> bool {
360+ static constexpr auto browser_label = " browser" ;
361+ static constexpr auto browser_label_len = 7u ;
362+ for (auto i = 0u ; i < browser_label_len; ++i)
363363 if (line[i] != browser_label[i])
364364 return false ;
365365 return true ;
366366}
367367
368368
369- static bool
370- is_track_line (const string &line) {
371- static const char * track_label = " track" ;
372- static const size_t track_label_len = 5 ;
373- for (size_t i = 0 ; i < track_label_len; ++i)
369+ static inline auto
370+ is_track_line (const string &line) -> bool {
371+ static constexpr auto track_label = " track" ;
372+ static constexpr auto track_label_len = 5u ;
373+ for (auto i = 0u ; i < track_label_len; ++i)
374374 if (line[i] != track_label[i])
375375 return false ;
376376 return true ;
@@ -380,11 +380,8 @@ is_track_line(const string &line) {
380380void
381381ReadBEDFile (const string &filename, vector<GenomicRegion> &the_regions) {
382382 std::ifstream in (filename);
383- if (isdir (filename.c_str ()))
384- throw runtime_error (" BED file is a directory: " + filename);
385-
386- if (!in.good ())
387- throw runtime_error (" cannot open input file " + filename);
383+ if (!in)
384+ throw runtime_error (" failed to open file " + filename);
388385
389386 string line;
390387 while (getline (in, line))
0 commit comments