Skip to content

Commit 2b2f64c

Browse files
Merge pull request #44 from smithlabcode/silence-warnings-on-osx-clang
Silence warnings on OSX clang
2 parents f80f5f6 + 69e38ed commit 2b2f64c

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

OptionParser.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,6 @@ read_config_file(const string &config_filename,
369369
throw runtime_error("cannot open config file: " + config_filename);
370370

371371
string line;
372-
size_t line_number = 0;
373372
while (in) {
374373

375374
if (!getline(in, line))
@@ -398,12 +397,9 @@ read_config_file(const string &config_filename,
398397
if (!all_of(begin(option_value), end(option_value), valid_option_char))
399398
throw runtime_error("bad option label: " + line);
400399

401-
// cerr << option_label << '\t' << option_value << endl;
402-
403400
config_file_options.push_back(line);
404401
}
405402
in.peek();
406-
++line_number;
407403
}
408404
}
409405

chromosome_utils.cpp

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,19 @@
2222

2323
#include "chromosome_utils.hpp"
2424

25+
#include <utility>
26+
#include <cctype>
27+
#include <vector>
28+
#include <string>
29+
#include <unordered_map>
30+
#include <stdexcept>
31+
2532
using std::vector;
2633
using std::string;
2734
using std::unordered_map;
2835
using std::runtime_error;
36+
using std::size;
37+
using std::toupper;
2938

3039
static const char *digits = "0987654321";
3140
static const char *whitespace = " \t";
@@ -61,26 +70,24 @@ parse_region_name(string region_name,
6170
end = static_cast<size_t>(atoi(end_string.c_str()));
6271
}
6372

64-
6573
static size_t
6674
adjust_start_pos(const size_t orig_start, const string &chrom_name) {
67-
static const double LINE_WIDTH = 50.0; // ADS: dangerous; often this is 80
75+
static constexpr double line_width = 50.0; // ADS: dangerous; often
76+
// this is 80
6877
const size_t name_offset = chrom_name.length() + 2; // For the '>' and '\n';
6978
const size_t preceding_newlines =
70-
static_cast<size_t>(std::floor(orig_start / LINE_WIDTH));
79+
static_cast<size_t>(std::floor(orig_start / line_width));
7180
return orig_start + preceding_newlines + name_offset;
7281
}
7382

74-
7583
static size_t
76-
adjust_region_size(const size_t orig_start,
77-
const string &chrom_name, // ADS: remove this soon
78-
const size_t orig_size) {
79-
static const double LINE_WIDTH = 50.0; // ADS: dangerous; often this is 80
84+
adjust_region_size(const size_t orig_start, const size_t orig_size) {
85+
static constexpr double line_width = 50.0; // ADS: dangerous; often
86+
// this is 80
8087
const size_t preceding_newlines_start =
81-
static_cast<size_t>(std::floor(orig_start / LINE_WIDTH));
88+
static_cast<size_t>(std::floor(orig_start / line_width));
8289
const size_t preceding_newlines_end =
83-
static_cast<size_t>(std::floor((orig_start + orig_size) / LINE_WIDTH));
90+
static_cast<size_t>(std::floor((orig_start + orig_size) / line_width));
8491
return (orig_size + (preceding_newlines_end - preceding_newlines_start));
8592
}
8693

@@ -100,8 +107,7 @@ extract_regions_chrom_fasta_impl(const string &chrom_name,
100107
const auto orig_region_size = orig_end_pos - orig_start_pos;
101108

102109
const auto start_pos = adjust_start_pos(orig_start_pos, chrom_name);
103-
const auto region_size =
104-
adjust_region_size(orig_start_pos, chrom_name, orig_region_size);
110+
const auto region_size = adjust_region_size(orig_start_pos, orig_region_size);
105111
assert(start_pos >= 0);
106112

107113
in.seekg(start_pos);
@@ -111,8 +117,8 @@ extract_regions_chrom_fasta_impl(const string &chrom_name,
111117
buffer.erase(remove(begin(buffer), end(buffer), '\n'));
112118
transform(cbegin(buffer), cend(buffer), begin(buffer),
113119
[](const char x) {return toupper(x);});
114-
sequences.push_back(move(buffer));
115-
assert(i.get_width() == sequences.back().size());
120+
sequences.push_back(std::move(buffer));
121+
assert(i.get_width() == size(sequences.back()));
116122
}
117123
}
118124

smithlab_utils.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class ProgressBar {
430430
std::string left_tag = "\r[";
431431
std::string mid_tag;
432432
std::string bar;
433-
std::string right_tag = "\%]";
433+
std::string right_tag = "%%]";
434434

435435
static const size_t max_bar_width = 72;
436436
};

0 commit comments

Comments
 (0)