Skip to content

Commit

Permalink
[Fix] de-reference COMP_GETPAR3 return values
Browse files Browse the repository at this point in the history
In the StatisticalChopper_Monitor.comp a `int *` component parameter is
retrieved but was not de-referenced, so the `int **` was inadvertently
assigned to an `int *` parameter.
  • Loading branch information
g5t committed Sep 25, 2024
1 parent 381ee00 commit ab0fd31
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions mcstas-comps/contrib/StatisticalChopper_Monitor.comp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,10 @@ SAVE
/* the detector file written by the Monitor_nD is stored in a 'MCDETECTOR detector' structure */

/* get back information from the StatisticalChopper */
int *m_ptr = COMP_GETPAR3(StatisticalChopper, comp, m); /* number of appertures in the sequence */
int m = *m_ptr;
int *nslit_ptr = COMP_GETPAR3(StatisticalChopper, comp, nslit); /* length of the sequence (number of possible slits around disk) */
int nslit = *nslit_ptr;
double *nu_ptr = COMP_GETPAR3(StatisticalChopper, comp, nu);
double nu = *nu_ptr;
int *Sequence= COMP_GETPAR3(StatisticalChopper, comp, Sequence);
int m = *COMP_GETPAR3(StatisticalChopper, comp, m); /* number of appertures in the sequence */
int nslit = *COMP_GETPAR3(StatisticalChopper, comp, nslit); /* length of the sequence (number of possible slits around disk) */
double nu = *COMP_GETPAR3(StatisticalChopper, comp, nu);
int *Sequence= *COMP_GETPAR3(StatisticalChopper, comp, Sequence);

double c = (double)(m-1)/(double)(nslit-1); /* duty cycle */
int f; /* number of periods in the detected time range */
Expand Down

0 comments on commit ab0fd31

Please sign in to comment.