vsrc, isrc, merge checks for length of vector parameters

This commit is contained in:
rlar 2011-02-27 20:28:42 +00:00
parent 015741260f
commit 454ade725f
3 changed files with 31 additions and 8 deletions

View File

@ -1,3 +1,8 @@
2011-02-27 Robert Larice
* src/spicelib/devices/isrc/isrcpar.c ,
* src/spicelib/devices/vsrc/vsrcpar.c :
vsrc, isrc, merge checks for length of vector parameters
2011-02-27 Robert Larice
* src/spicelib/devices/isrc/isrcask.c ,
* src/spicelib/devices/vsrc/vsrcload.c ,

View File

@ -67,25 +67,29 @@ ISRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
}
break;
case ISRC_PULSE:
if(value->v.numValue <2) return(E_BADPARM);
if(value->v.numValue < 2)
return(E_BADPARM);
here->ISRCfunctionType = PULSE;
here->ISRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case ISRC_SINE:
if(value->v.numValue <2) return(E_BADPARM);
if(value->v.numValue < 2)
return(E_BADPARM);
here->ISRCfunctionType = SINE;
here->ISRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case ISRC_EXP:
if(value->v.numValue <2) return(E_BADPARM);
if(value->v.numValue < 2)
return(E_BADPARM);
here->ISRCfunctionType = EXP;
here->ISRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case ISRC_PWL:
if(value->v.numValue <2) return(E_BADPARM);
if(value->v.numValue < 2)
return(E_BADPARM);
here->ISRCfunctionType = PWL;
here->ISRCfuncTGiven = TRUE;
copy_coeffs(here, value);
@ -100,13 +104,16 @@ ISRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
break;
case ISRC_SFFM:
if(value->v.numValue <2) return(E_BADPARM);
if(value->v.numValue < 2)
return(E_BADPARM);
here->ISRCfunctionType = SFFM;
here->ISRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case ISRC_AM:
if(value->v.numValue <2) return(E_BADPARM);
case ISRC_AM:
if(value->v.numValue < 2)
return(E_BADPARM);
here->ISRCfunctionType = AM;
here->ISRCfuncTGiven = TRUE;
copy_coeffs(here, value);

View File

@ -67,21 +67,29 @@ VSRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
}
break;
case VSRC_PULSE:
if(value->v.numValue < 2)
return(E_BADPARM);
here->VSRCfunctionType = PULSE;
here->VSRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case VSRC_SINE:
if(value->v.numValue < 2)
return(E_BADPARM);
here->VSRCfunctionType = SINE;
here->VSRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case VSRC_EXP:
if(value->v.numValue < 2)
return(E_BADPARM);
here->VSRCfunctionType = EXP;
here->VSRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case VSRC_PWL:
if(value->v.numValue < 2)
return(E_BADPARM);
here->VSRCfunctionType = PWL;
here->VSRCfuncTGiven = TRUE;
copy_coeffs(here, value);
@ -121,12 +129,15 @@ VSRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
break; }
case VSRC_SFFM:
if(value->v.numValue < 2)
return(E_BADPARM);
here->VSRCfunctionType = SFFM;
here->VSRCfuncTGiven = TRUE;
copy_coeffs(here, value);
break;
case VSRC_AM:
if(value->v.numValue <2) return(E_BADPARM);
if(value->v.numValue < 2)
return(E_BADPARM);
here->VSRCfunctionType = AM;
here->VSRCfuncTGiven = TRUE;
copy_coeffs(here, value);