mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 19:20:28 +08:00
Fixing invalid opencv_test_ml calls
This commit is contained in:
parent
d2da7dc3e5
commit
91bd7df8c1
@ -286,7 +286,14 @@ int DTreesImpl::addTree(const vector<int>& sidx )
|
||||
int ssize = getSubsetSize(split.varIdx);
|
||||
split.subsetOfs = (int)subsets.size();
|
||||
subsets.resize(split.subsetOfs + ssize);
|
||||
memcpy(&subsets[split.subsetOfs], &w->wsubsets[wsplit.subsetOfs], ssize*sizeof(int));
|
||||
// This check verifies that subsets index is in the correct range
|
||||
// as in case ssize == 0 no real resize performed.
|
||||
// Thus memory kept safe.
|
||||
// Also this skips useless memcpy call when size parameter is zero
|
||||
if(ssize > 0)
|
||||
{
|
||||
memcpy(&subsets[split.subsetOfs], &w->wsubsets[wsplit.subsetOfs], ssize*sizeof(int));
|
||||
}
|
||||
}
|
||||
node.split = (int)splits.size();
|
||||
splits.push_back(split);
|
||||
|
Loading…
Reference in New Issue
Block a user