1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
| | Fixed in upstream, see
https://github.com/arq5x/bedtools2/issues/271
From b47dbefcb57f8e6c4fe397f64346338620740b71 Mon Sep 17 00:00:00 2001
From: arq5x <arq5x@virginia.edu>
Date: Wed, 15 Jul 2015 15:15:23 -0600
Subject: [PATCH] settle on uint32_t signature for QuickString. Resolves #267
and #271?
---
src/coverageFile/coverageFile.cpp | 24 ++++++++++++------------
src/utils/general/QuickString.cpp | 27 ++++++++++++++-------------
src/utils/general/QuickString.h | 6 +++---
3 files changed, 29 insertions(+), 28 deletions(-)
diff --git a/src/coverageFile/coverageFile.cpp b/src/coverageFile/coverageFile.cpp
index 859cfdc..0fb544b 100644
--- a/src/coverageFile/coverageFile.cpp
+++ b/src/coverageFile/coverageFile.cpp
@@ -83,11 +83,11 @@ void CoverageFile::giveFinalReport(RecordOutputMgr *outputMgr) {
float depthPct = (float)basesAtDepth / (float)_totalQueryLen;
_finalOutput = "all\t";
- _finalOutput.append(depth);
+ _finalOutput.append(static_cast<uint32_t>(depth));
_finalOutput.append("\t");
- _finalOutput.append(basesAtDepth);
+ _finalOutput.append(static_cast<uint32_t>(basesAtDepth));
_finalOutput.append("\t");
- _finalOutput.append(_totalQueryLen);
+ _finalOutput.append(static_cast<uint32_t>(_totalQueryLen));
_finalOutput.append("\t");
format(depthPct);
@@ -138,7 +138,7 @@ size_t CoverageFile::countBasesAtDepth(size_t depth) {
void CoverageFile::doCounts(RecordOutputMgr *outputMgr, RecordKeyVector &hits)
{
- _finalOutput = hits.size();
+ _finalOutput = static_cast<uint32_t>(hits.size());
outputMgr->printRecord(hits.getKey(), _finalOutput);
}
@@ -147,9 +147,9 @@ void CoverageFile::doPerBase(RecordOutputMgr *outputMgr, RecordKeyVector &hits)
//loop through all bases in query, printing full record and metrics for each
const Record * queryRec = hits.getKey();
for (size_t i= 0; i < _queryLen; i++) {
- _finalOutput = i +1;
+ _finalOutput = static_cast<uint32_t>(i+1);
_finalOutput.append("\t");
- _finalOutput.append(_depthArray[i]);
+ _finalOutput.append(static_cast<uint32_t>(_depthArray[i]));
outputMgr->printRecord(queryRec, _finalOutput);
}
@@ -181,11 +181,11 @@ void CoverageFile::doHist(RecordOutputMgr *outputMgr, RecordKeyVector &hits)
size_t numBasesAtDepth = iter->second;
float coveredBases = (float)numBasesAtDepth / (float)_queryLen;
- _finalOutput = depth;
+ _finalOutput = static_cast<uint32_t>(depth);
_finalOutput.append("\t");
- _finalOutput.append(numBasesAtDepth);
+ _finalOutput.append(static_cast<uint32_t>(numBasesAtDepth));
_finalOutput.append("\t");
- _finalOutput.append(_queryLen);
+ _finalOutput.append(static_cast<uint32_t>(_queryLen));
_finalOutput.append("\t");
format(coveredBases);
@@ -199,11 +199,11 @@ void CoverageFile::doDefault(RecordOutputMgr *outputMgr, RecordKeyVector &hits)
size_t nonZeroBases = _queryLen - countBasesAtDepth(0);
float coveredBases = (float)nonZeroBases / (float)_queryLen;
- _finalOutput = hits.size();
+ _finalOutput = static_cast<uint32_t>(hits.size());
_finalOutput.append("\t");
- _finalOutput.append(nonZeroBases);
+ _finalOutput.append(static_cast<uint32_t>(nonZeroBases));
_finalOutput.append("\t");
- _finalOutput.append(_queryLen);
+ _finalOutput.append(static_cast<uint32_t>(_queryLen));
_finalOutput.append("\t");
format(coveredBases);
diff --git a/src/utils/general/QuickString.cpp b/src/utils/general/QuickString.cpp
index 0757009..a83263e 100644
--- a/src/utils/general/QuickString.cpp
+++ b/src/utils/general/QuickString.cpp
@@ -105,11 +105,11 @@ QuickString &QuickString::operator = (uint32_t val) {
return *this;
}
-QuickString &QuickString::operator = (size_t val) {
- clear();
- append(val);
- return *this;
-}
+// QuickString &QuickString::operator = (size_t val) {
+// clear();
+// append(val);
+// return *this;
+// }
QuickString &QuickString::operator = (float val) {
clear();
@@ -158,10 +158,11 @@ QuickString &QuickString::operator += (uint32_t num) {
return *this;
}
-QuickString &QuickString::operator += (size_t num) {
- append(num);
- return *this;
-}
+// QuickString &QuickString::operator += (size_t num) {
+// append(num);
+// return *this;
+// }
+
QuickString &QuickString::operator += (float num) {
append(num);
return *this;
@@ -273,12 +274,12 @@ void QuickString::append(int num) {
}
void QuickString::append(uint32_t num) {
- int2str((int)num, *this, true);
+ int2str((int)num, *this, true);
}
-void QuickString::append(size_t num) {
- int2str((int)num, *this, true);
-}
+// void QuickString::append(size_t num) {
+// int2str((int)num, *this, true);
+// }
void QuickString::append(float num) {
append(ToString(num));
diff --git a/src/utils/general/QuickString.h b/src/utils/general/QuickString.h
index b43fdfc..6e6fa94 100644
--- a/src/utils/general/QuickString.h
+++ b/src/utils/general/QuickString.h
@@ -38,7 +38,7 @@ class QuickString {
QuickString &operator = (char);
QuickString &operator = (int);
QuickString &operator = (uint32_t);
- QuickString &operator = (size_t);
+ //QuickString &operator = (size_t);
QuickString &operator = (float);
QuickString &operator = (double);
QuickString &operator += (const QuickString &);
@@ -47,7 +47,7 @@ class QuickString {
QuickString &operator += (char);
QuickString &operator += (int);
QuickString &operator += (uint32_t);
- QuickString &operator += (size_t);
+ //QuickString &operator += (size_t);
QuickString &operator += (float);
QuickString &operator += (double);
@@ -74,7 +74,7 @@ class QuickString {
//for better performance.
void append(int num);
void append(uint32_t num);
- void append(size_t num);
+ //void append(size_t num);
void append(float num);
void append(double num);
|