-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Removed -Wconversion warnings in part of framework #47339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -256,7 +256,7 @@ namespace edmNew { | |||||
void resize(size_type s) { | ||||||
checkCapacityExausted(s); | ||||||
m_v.m_data.resize(m_item.offset + s); | ||||||
m_v.m_dataSize = m_v.m_data.size(); | ||||||
m_v.m_dataSize = static_cast<unsigned int>(m_v.m_data.size()); | ||||||
m_item.size = s; | ||||||
} | ||||||
|
||||||
|
@@ -329,16 +329,16 @@ namespace edmNew { | |||||
expected = false; | ||||||
nanosleep(nullptr, nullptr); | ||||||
} | ||||||
int offset = m_v.m_data.size(); | ||||||
int offset = static_cast<int>(m_v.m_data.size()); | ||||||
if (m_v.onDemand() && full()) { | ||||||
m_v.m_filling = false; | ||||||
dstvdetails::throwCapacityExausted(); | ||||||
} | ||||||
std::move(m_lv.begin(), m_lv.end(), std::back_inserter(m_v.m_data)); | ||||||
m_item.size = m_lv.size(); | ||||||
m_item.size = static_cast<size_type>(m_lv.size()); | ||||||
m_item.offset = offset; | ||||||
|
||||||
m_v.m_dataSize = m_v.m_data.size(); | ||||||
m_v.m_dataSize = static_cast<unsigned int>(m_v.m_data.size()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||
assert(m_v.m_filling == true); | ||||||
m_v.m_filling = false; | ||||||
} | ||||||
|
@@ -355,7 +355,7 @@ namespace edmNew { | |||||
void resize(size_type s) { m_lv.resize(s); } | ||||||
|
||||||
id_type id() const { return m_item.id; } | ||||||
size_type size() const { return m_lv.size(); } | ||||||
size_type size() const { return static_cast<size_type>(m_lv.size()); } | ||||||
bool empty() const { return m_lv.empty(); } | ||||||
|
||||||
data_type& operator[](size_type i) { return m_lv[i]; } | ||||||
|
@@ -451,7 +451,7 @@ namespace edmNew { | |||||
void resize(size_t isize, size_t dsize) { | ||||||
m_ids.resize(isize); | ||||||
m_data.resize(dsize); | ||||||
m_dataSize = m_data.size(); | ||||||
m_dataSize = static_cast<unsigned int>(m_data.size()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||
} | ||||||
|
||||||
void clean() { | ||||||
|
@@ -463,14 +463,14 @@ namespace edmNew { | |||||
Item& item = addItem(iid, isize); | ||||||
m_data.resize(m_data.size() + isize); | ||||||
std::copy(idata, idata + isize, m_data.begin() + item.offset); | ||||||
m_dataSize = m_data.size(); | ||||||
m_dataSize = static_cast<unsigned int>(m_data.size()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||
return DetSet(*this, item, false); | ||||||
} | ||||||
//make space for it | ||||||
DetSet insert(id_type iid, size_type isize) { | ||||||
Item& item = addItem(iid, isize); | ||||||
m_data.resize(m_data.size() + isize); | ||||||
m_dataSize = m_data.size(); | ||||||
m_dataSize = static_cast<unsigned int>(m_data.size()); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||
return DetSet(*this, item, false); | ||||||
} | ||||||
|
||||||
|
@@ -485,7 +485,7 @@ namespace edmNew { | |||||
// sanity checks... (shall we throw or assert?) | ||||||
if ((*p).isValid() && (*p).size > 0 && m_data.size() == (*p).offset + (*p).size) { | ||||||
m_data.resize((*p).offset); | ||||||
m_dataSize = m_data.size(); | ||||||
m_dataSize = static_cast<size_type>(m_data.size()); | ||||||
} | ||||||
m_ids.erase(m_ids.begin() + (p - m_ids.begin())); | ||||||
} | ||||||
|
@@ -562,7 +562,7 @@ namespace edmNew { | |||||
|
||||||
size_type dataSize() const { return onDemand() ? size_type(m_dataSize) : size_type(m_data.size()); } | ||||||
|
||||||
size_type size() const { return m_ids.size(); } | ||||||
size_type size() const { return static_cast<size_type>(m_ids.size()); } | ||||||
|
||||||
//FIXME fast interfaces, not consistent with associative nature of container.... | ||||||
|
||||||
|
@@ -718,7 +718,7 @@ namespace edm { | |||||
|
||||||
static size_t size(const edmNew::DetSetVector<T>* iContainer) { return iContainer->dataSize(); } | ||||||
static unsigned int indexFor(const value_type* iElement, const edmNew::DetSetVector<T>* iContainer) { | ||||||
return iElement - &(iContainer->data().front()); | ||||||
return static_cast<unsigned int>(iElement - &(iContainer->data().front())); | ||||||
} | ||||||
}; | ||||||
} // namespace edm | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -30,16 +30,18 @@ namespace edm { | |||||||||
std::vector<HLTPathStatus> paths_; | ||||||||||
|
||||||||||
public: | ||||||||||
using size_type = decltype(paths_)::size_type; | ||||||||||
|
||||||||||
/// Constructor - for n paths | ||||||||||
HLTGlobalStatus(const unsigned int n = 0) : paths_(n) {} | ||||||||||
HLTGlobalStatus(size_type n = 0) : paths_(n) {} | ||||||||||
|
||||||||||
/// Get number of paths stored | ||||||||||
unsigned int size() const { return paths_.size(); } | ||||||||||
auto size() const { return paths_.size(); } | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||||||
|
||||||||||
/// Reset status for all paths | ||||||||||
void reset() { | ||||||||||
const unsigned int n(size()); | ||||||||||
for (unsigned int i = 0; i != n; ++i) | ||||||||||
const auto n(size()); | ||||||||||
for (decltype(size()) i = 0; i != n; ++i) | ||||||||||
Comment on lines
+43
to
+44
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||||||
paths_[i].reset(); | ||||||||||
} | ||||||||||
|
||||||||||
|
@@ -54,32 +56,32 @@ namespace edm { | |||||||||
|
||||||||||
// accessors to ith element of paths_ | ||||||||||
|
||||||||||
const HLTPathStatus& at(const unsigned int i) const { return paths_.at(i); } | ||||||||||
HLTPathStatus& at(const unsigned int i) { return paths_.at(i); } | ||||||||||
const HLTPathStatus& operator[](const unsigned int i) const { return paths_[i]; } | ||||||||||
HLTPathStatus& operator[](const unsigned int i) { return paths_[i]; } | ||||||||||
const HLTPathStatus& at(size_type i) const { return paths_.at(i); } | ||||||||||
HLTPathStatus& at(size_type i) { return paths_.at(i); } | ||||||||||
const HLTPathStatus& operator[](size_type i) const { return paths_[i]; } | ||||||||||
HLTPathStatus& operator[](size_type i) { return paths_[i]; } | ||||||||||
|
||||||||||
/// Was ith path run? | ||||||||||
bool wasrun(const unsigned int i) const { return at(i).wasrun(); } | ||||||||||
bool wasrun(size_type i) const { return at(i).wasrun(); } | ||||||||||
/// Has ith path accepted the event? | ||||||||||
bool accept(const unsigned int i) const { return at(i).accept(); } | ||||||||||
bool accept(size_type i) const { return at(i).accept(); } | ||||||||||
/// Has ith path encountered an error (exception)? | ||||||||||
bool error(const unsigned int i) const { return at(i).error(); } | ||||||||||
bool error(size_type i) const { return at(i).error(); } | ||||||||||
|
||||||||||
/// Get status of ith path | ||||||||||
hlt::HLTState state(const unsigned int i) const { return at(i).state(); } | ||||||||||
hlt::HLTState state(size_type i) const { return at(i).state(); } | ||||||||||
/// Get index (slot position) of module giving the decision of the ith path | ||||||||||
unsigned int index(const unsigned int i) const { return at(i).index(); } | ||||||||||
unsigned int index(size_type i) const { return at(i).index(); } | ||||||||||
/// Reset the ith path | ||||||||||
void reset(const unsigned int i) { at(i).reset(); } | ||||||||||
void reset(size_type i) { at(i).reset(); } | ||||||||||
/// swap function | ||||||||||
void swap(HLTGlobalStatus& other) { paths_.swap(other.paths_); } | ||||||||||
|
||||||||||
private: | ||||||||||
/// Global state variable calculated on the fly | ||||||||||
bool State(unsigned int icase) const { | ||||||||||
bool flags[3] = {false, false, false}; | ||||||||||
const unsigned int n(size()); | ||||||||||
const auto n(size()); | ||||||||||
for (unsigned int i = 0; i != n; ++i) { | ||||||||||
const hlt::HLTState s(state(i)); | ||||||||||
if (s != hlt::Ready) { | ||||||||||
|
@@ -105,7 +107,7 @@ namespace edm { | |||||||||
text[1] = "1"; | ||||||||||
text[2] = "0"; | ||||||||||
text[3] = "e"; | ||||||||||
const unsigned int n(hlt.size()); | ||||||||||
const auto n(hlt.size()); | ||||||||||
for (unsigned int i = 0; i != n; ++i) | ||||||||||
ost << text[hlt.state(i)]; | ||||||||||
return ost; | ||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -76,7 +76,7 @@ namespace edm { | |||||
m_keys.reserve(it.size()); | ||||||
m_offsets.reserve(it.size() + 1); | ||||||
m_offsets.push_back(0); | ||||||
size_type tot = 0; | ||||||
size_t tot = 0; | ||||||
for (typename TheMap::const_iterator p = it.begin(); p != it.end(); ++p) | ||||||
tot += (*p).second.size(); | ||||||
m_data.reserve(tot); | ||||||
|
@@ -88,10 +88,10 @@ namespace edm { | |||||
m_keys.push_back(k); | ||||||
m_data.resize(m_offsets.back() + v.size()); | ||||||
std::copy(v.begin(), v.end(), m_data.begin() + m_offsets.back()); | ||||||
m_offsets.push_back(m_data.size()); | ||||||
m_offsets.push_back(static_cast<unsigned int>(m_data.size())); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
? |
||||||
} | ||||||
|
||||||
size_type size() const { return m_keys.size(); } | ||||||
size_type size() const { return static_cast<size_type>(m_keys.size()); } | ||||||
|
||||||
bool empty() const { return m_keys.empty(); } | ||||||
|
||||||
|
@@ -111,7 +111,7 @@ namespace edm { | |||||
key_iterator p = findKey(k); | ||||||
if (p == m_keys.end()) | ||||||
return emptyRange(); | ||||||
size_type loc = p - m_keys.begin(); | ||||||
auto loc = p - m_keys.begin(); | ||||||
data_iterator b = m_data.begin() + m_offsets[loc]; | ||||||
data_iterator e = m_data.begin() + m_offsets[loc + 1]; | ||||||
return range(b, e); | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In these cases, wouldn't it be better to change the function parameter type to match what is expected ?
That is,
?