Skip to content
Snippets Groups Projects
Commit 1e0c10fc authored by Marvin Häuser's avatar Marvin Häuser
Browse files

simulator: fix potentially uninitialized returns

Some operations to insert or remove samples may leave their return value
uninitialized under exceptional conditions. Return 0 in these cases to
indicate to samples were inserted or removed.
parent 6f1d3dd6
No related branches found
No related tags found
1 merge request!477[WIP] simulation code generation fixes
......@@ -232,11 +232,10 @@ public:
}
TMLLength removeSamples(TMLLength iNbOfSamples) {
TMLLength aNbToRemove;
TMLLength aNbToRemove = 0;
if (iNbOfSamples==0) {
this->_content=0;
this->_paramQueue.clear();
aNbToRemove=0;
} else if (this->_content > 0) {
aNbToRemove=1;
this->_content-=aNbToRemove;
......
......@@ -161,11 +161,10 @@ public:
}
TMLLength insertSamples(TMLLength iNbOfSamples, Parameter* iParam){
TMLLength aNbToInsert;
TMLLength aNbToInsert = 0;
if (iNbOfSamples==0){
this->_content=0;
this->_paramQueue.clear();
aNbToInsert=0;
}else if(_length-this->_content>0) {
aNbToInsert=1;
this->_content+=aNbToInsert;
......@@ -177,11 +176,10 @@ public:
}
TMLLength removeSamples(TMLLength iNbOfSamples) {
TMLLength aNbToRemove;
TMLLength aNbToRemove = 0;
if (iNbOfSamples==0) {
this->_content=0;
this->_paramQueue.clear();
aNbToRemove=0;
} else if (this->_content>0) {
aNbToRemove=1;
this->_content-=aNbToRemove;
......
......@@ -155,11 +155,10 @@ public:
}
TMLLength insertSamples(TMLLength iNbOfSamples, Parameter* iParam){
TMLLength aNbToInsert;
TMLLength aNbToInsert = 0;
if (iNbOfSamples==0){
this->_content=0;
this->_paramQueue.clear();
aNbToInsert=0;
} else if (_length-this->_content>0) {
aNbToInsert=1;
this->_content+=aNbToInsert;
......@@ -170,11 +169,10 @@ public:
}
TMLLength removeSamples(TMLLength iNbOfSamples) {
TMLLength aNbToRemove;
TMLLength aNbToRemove = 0;
if (iNbOfSamples==0) {
this->_content=0;
this->_paramQueue.clear();
aNbToRemove=0;
} else if (this->_content>0) {
aNbToRemove=1;
this->_content-=aNbToRemove;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment