Cortex: remove use of deprecated C++ features

Change-Id: I174bf8a5224b53370c3dd5f7dc152885ff0ec985
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6800
Reviewed-by: Fredrik Holmqvist <[email protected]>
Tested-by: Commit checker robot <[email protected]>
This commit is contained in:
PulkoMandy
2023-08-19 15:11:44 +00:00
committed by Adrien Destugues
parent 6308236831
commit 7b2f246e69
7 changed files with 80 additions and 79 deletions
+12
View File
@@ -632,10 +632,14 @@ status_t NodeGroup::setTimeSource(
for_each( for_each(
m_nodes.begin(), m_nodes.begin(),
m_nodes.end(), m_nodes.end(),
#if __GNUC__ <= 2
bind2nd( bind2nd(
mem_fun(&NodeRef::_setTimeSource), mem_fun(&NodeRef::_setTimeSource),
m_timeSource.node m_timeSource.node
) )
#else
[this](NodeRef* nodeRef) { nodeRef->_setTimeSource(m_timeSource.node); }
#endif
); );
// // try to set as sync node // // try to set as sync node
@@ -680,10 +684,14 @@ status_t NodeGroup::setRunMode(BMediaNode::run_mode mode) {
for_each( for_each(
m_nodes.begin(), m_nodes.begin(),
m_nodes.end(), m_nodes.end(),
#if __GNUC__ <= 2
bind2nd( bind2nd(
mem_fun(&NodeRef::_setRunModeAuto), mem_fun(&NodeRef::_setRunModeAuto),
m_runMode m_runMode
) )
#else
[this](NodeRef* ref) { ref->_setRunModeAuto(this->m_runMode); }
#endif
// bound_method( // bound_method(
// *this, // *this,
// &NodeGroup::setRunModeFor) // &NodeGroup::setRunModeFor)
@@ -1260,7 +1268,11 @@ status_t NodeGroup::_stop() {
for_each( for_each(
m_nodes.begin(), m_nodes.begin(),
m_nodes.end(), m_nodes.end(),
#if __GNUC__ <= 2
mem_fun(&NodeRef::_stop) mem_fun(&NodeRef::_stop)
#else
[](NodeRef* ref) { ref->_stop(); }
#endif
); );
// update transport state // update transport state
+29 -52
View File
@@ -782,69 +782,43 @@ NodeGroup* NodeManager::groupAt(
// look up a group by unique ID; returns B_BAD_VALUE if no // look up a group by unique ID; returns B_BAD_VALUE if no
// matching group was found // matching group was found
class match_group_by_id : status_t NodeManager::findGroup(uint32 id, NodeGroup** outGroup) const
public binary_function<const NodeGroup*, uint32, bool> { {
public:
bool operator()(const NodeGroup* group, uint32 id) const {
return group->id() == id;
}
};
status_t NodeManager::findGroup(
uint32 id,
NodeGroup** outGroup) const {
Autolock _l(this); Autolock _l(this);
D_METHOD(( D_METHOD(("NodeManager::findGroup(id)\n"));
"NodeManager::findGroup(id)\n"));
node_group_set::const_iterator it = node_group_set::const_iterator it;
find_if( for (it = m_nodeGroupSet.begin(); it != m_nodeGroupSet.end(); it++)
m_nodeGroupSet.begin(), {
m_nodeGroupSet.end(), if ((*it)->id() == id) {
bind2nd(match_group_by_id(), id) *outGroup = *it;
); return B_OK;
}
if(it == m_nodeGroupSet.end()) {
*outGroup = 0;
return B_BAD_VALUE;
} }
*outGroup = *it; *outGroup = 0;
return B_OK; return B_BAD_VALUE;
} }
// look up a group by name; returns B_NAME_NOT_FOUND if // look up a group by name; returns B_NAME_NOT_FOUND if
// no group matching the name was found. // no group matching the name was found.
class match_group_by_name : status_t NodeManager::findGroup(const char* name, NodeGroup** outGroup) const
public binary_function<const NodeGroup*, const char*, bool> { {
public:
bool operator()(const NodeGroup* group, const char* name) const {
return !strcmp(group->name(), name);
}
};
status_t NodeManager::findGroup(
const char* name,
NodeGroup** outGroup) const {
Autolock _l(this); Autolock _l(this);
D_METHOD(( D_METHOD(("NodeManager::findGroup(name)\n"));
"NodeManager::findGroup(name)\n"));
node_group_set::const_iterator it = node_group_set::const_iterator it;
find_if( for (it = m_nodeGroupSet.begin(); it != m_nodeGroupSet.end(); it++)
m_nodeGroupSet.begin(), {
m_nodeGroupSet.end(), if (strcmp((*it)->name(), name) == 0) {
bind2nd(match_group_by_name(), name) *outGroup = *it;
); return B_OK;
}
if(it == m_nodeGroupSet.end()) {
*outGroup = 0;
return B_BAD_VALUE;
} }
*outGroup = *it; *outGroup = 0;
return B_OK; return B_BAD_VALUE;
} }
// merge the given source group to the given destination; // merge the given source group to the given destination;
@@ -895,8 +869,7 @@ status_t NodeManager::mergeGroups(
// was split successfully. // was split successfully.
class _changeNodeGroupFn : class _changeNodeGroupFn {
public unary_function<NodeRef*, void> {
public: public:
NodeGroup* newGroup; NodeGroup* newGroup;
@@ -2527,7 +2500,11 @@ inline void NodeManager::_updateLatenciesFrom(
origin, origin,
0, // all groups 0, // all groups
recurse, recurse,
#if __GNUC__ <= 2
mem_fun(&NodeRef::_updateLatency), mem_fun(&NodeRef::_updateLatency),
#else
[](NodeRef* node) { return node->_updateLatency(); },
#endif
&st); &st);
_unlockAllGroups(); // [e.moon 13oct99] _unlockAllGroups(); // [e.moon 13oct99]
+20 -12
View File
@@ -814,7 +814,7 @@ status_t NodeRef::findOutput(
// endpoint matching (given name and/or format as 'hints') // endpoint matching (given name and/or format as 'hints')
template <class T> template <class T>
class match_endpoint_name_format : public unary_function<T, bool> { class match_endpoint_name_format {
public: public:
const char* name; const char* name;
const media_format* format; const media_format* format;
@@ -835,7 +835,7 @@ public:
}; };
template <class T> template <class T>
class match_endpoint_name_type : public unary_function<T, bool> { class match_endpoint_name_type {
public: public:
const char* name; const char* name;
media_type type; media_type type;
@@ -856,7 +856,7 @@ public:
}; };
template <class T> template <class T>
class match_endpoint_type : public unary_function<T, bool> { class match_endpoint_type {
public: public:
media_type type; media_type type;
@@ -1053,11 +1053,15 @@ status_t NodeRef::getConnectedInputs(
continue; continue;
} }
if (count) if (count) {
// copy found inputs matching the given type into vector // copy found inputs matching the given type into vector
remove_copy_if(inputBuffer, inputBuffer + count, back_insert_iterator<std::vector<media_input> > inserter = back_inserter(ioInputs);
back_inserter(ioInputs), for (int i = 0; i < count; i++) {
not1(match_endpoint_type<media_input>(filterType))); if (match_endpoint_type<media_input>(filterType)(inputBuffer[i])) {
*inserter++ = inputBuffer[i];
}
}
}
break; break;
} }
@@ -1140,11 +1144,15 @@ status_t NodeRef::getConnectedOutputs(
continue; continue;
} }
if (count) if (count) {
// copy found outputs matching the given type into vector // copy found outputs matching the given type into vector
remove_copy_if(outputBuffer, outputBuffer + count, back_insert_iterator<std::vector<media_output> > inserter = back_inserter(ioOutputs);
back_inserter(ioOutputs), for (int i = 0; i < count; i++) {
not1(match_endpoint_type<media_output>(filterType))); if (match_endpoint_type<media_output>(filterType)(outputBuffer[i])) {
*inserter++ = outputBuffer[i];
}
}
}
break; break;
} }
@@ -1530,7 +1538,7 @@ NodeRef::NodeRef(
// -------------------------------------------------------- // // -------------------------------------------------------- //
template <class T> template <class T>
class fixEndpointFn : public unary_function<T&, void> { class fixEndpointFn {
const media_node& node; const media_node& node;
public: public:
fixEndpointFn(const media_node& _n) : node(_n) {} fixEndpointFn(const media_node& _n) : node(_n) {}
@@ -81,7 +81,7 @@ public:
}; };
// compare pointers to Mappings by element name // compare pointers to Mappings by element name
struct _mapping_ptr_less : public std::binary_function<XMLElementMapping*,XMLElementMapping*,bool> { struct _mapping_ptr_less {
public: public:
bool operator()(const XMLElementMapping* a, const XMLElementMapping* b) const { bool operator()(const XMLElementMapping* a, const XMLElementMapping* b) const {
return a->element < b->element; return a->element < b->element;
+6 -1
View File
@@ -263,7 +263,12 @@ ValControl::AllAttached()
pWnd->BeginViewTransaction(); pWnd->BeginViewTransaction();
for_each(fLayoutSet.begin(), fLayoutSet.end(), for_each(fLayoutSet.begin(), fLayoutSet.end(),
ptr_fun(&ValCtrlLayoutEntry::InitChildFrame)); // +++++? #if __GNUC__ <= 2
ptr_fun(&ValCtrlLayoutEntry::InitChildFrame)
#else
[](ValCtrlLayoutEntry& entry) { ValCtrlLayoutEntry::InitChildFrame(entry); }
#endif
);
pWnd->EndViewTransaction(); pWnd->EndViewTransaction();
} }
+8 -8
View File
@@ -59,7 +59,7 @@ __BEGIN_CORTEX_NAMESPACE
// 27jul99: functor adaptor "call a given method of a given object with argument" // 27jul99: functor adaptor "call a given method of a given object with argument"
template<class _retT, class _subjectT, class _objectT> template<class _retT, class _subjectT, class _objectT>
class bound_method_t : public std::unary_function<_objectT*, _retT> { class bound_method_t {
public: public:
explicit bound_method_t( explicit bound_method_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -78,7 +78,7 @@ private:
// 27jul99: functor adaptor "call a given method of a given object with argument" // 27jul99: functor adaptor "call a given method of a given object with argument"
template<class _retT, class _subjectT, class _objectT> template<class _retT, class _subjectT, class _objectT>
class bound_const_method_t : public std::unary_function<const _objectT*, _retT> { class bound_const_method_t {
public: public:
explicit bound_const_method_t( explicit bound_const_method_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -96,7 +96,7 @@ private:
}; };
template<class _retT, class _subjectT, class _objectT> template<class _retT, class _subjectT, class _objectT>
class bound_method_ref_t : public std::unary_function<_objectT&, _retT> { class bound_method_ref_t {
public: public:
explicit bound_method_ref_t( explicit bound_method_ref_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -114,7 +114,7 @@ private:
}; };
template<class _retT, class _subjectT, class _objectT> template<class _retT, class _subjectT, class _objectT>
class bound_const_method_ref_t : public std::unary_function<const _objectT&, _retT> { class bound_const_method_ref_t {
public: public:
explicit bound_const_method_ref_t( explicit bound_const_method_ref_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -136,7 +136,7 @@ private:
// 27jul99: functor adaptor "call a given method of a given object with argument" // 27jul99: functor adaptor "call a given method of a given object with argument"
// + an additional argument // + an additional argument
template<class _retT, class _subjectT, class _objectT, class _arg1T> template<class _retT, class _subjectT, class _objectT, class _arg1T>
class bound_method1_t : public std::binary_function<_objectT*,_arg1T,_retT> { class bound_method1_t {
public: public:
explicit bound_method1_t( explicit bound_method1_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -156,7 +156,7 @@ private:
// 27jul99: functor adaptor "call a given method of a given object with argument" // 27jul99: functor adaptor "call a given method of a given object with argument"
template<class _retT, class _subjectT, class _objectT, class _arg1T> template<class _retT, class _subjectT, class _objectT, class _arg1T>
class bound_const_method1_t : public std::binary_function<const _objectT*,_arg1T,_retT> { class bound_const_method1_t {
public: public:
explicit bound_const_method1_t( explicit bound_const_method1_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -174,7 +174,7 @@ private:
}; };
template<class _retT, class _subjectT, class _objectT, class _arg1T> template<class _retT, class _subjectT, class _objectT, class _arg1T>
class bound_method_ref1_t : public std::binary_function<_objectT&,_arg1T,_retT> { class bound_method_ref1_t {
public: public:
explicit bound_method_ref1_t( explicit bound_method_ref1_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
@@ -192,7 +192,7 @@ private:
}; };
template<class _retT, class _subjectT, class _objectT, class _arg1T> template<class _retT, class _subjectT, class _objectT, class _arg1T>
class bound_const_method_ref1_t : public std::binary_function<const _objectT&,_arg1T,_retT> { class bound_const_method_ref1_t {
public: public:
explicit bound_const_method_ref1_t( explicit bound_const_method_ref1_t(
// the bound instance on which the method will be called // the bound instance on which the method will be called
+4 -5
View File
@@ -67,9 +67,8 @@ void ptr_map_delete(iter begin, iter end) {
// a simple equality-test functor for maps // a simple equality-test functor for maps
template<class key, class value> template<class key, class value>
class map_value_equal_to : class map_value_equal_to
public std::binary_function<std::pair<key,value>, value, bool> { {
public: public:
bool operator()(const std::pair<key,value>& p, const value& v) const { bool operator()(const std::pair<key,value>& p, const value& v) const {
return p.second == v; return p.second == v;
@@ -109,8 +108,8 @@ void map_value_copy(input_iter begin, input_iter end, output_iter to) {
// adapt a unary functor to a map (eek) // adapt a unary functor to a map (eek)
template <class pairT, class opT> template <class pairT, class opT>
class unary_map_function_t : class unary_map_function_t
public std::unary_function<typename opT::argument_type, typename opT::result_type> { {
opT f; opT f;