ohnoitsaninja/medianFilter

Improper use of memset() in constructor

Opened this issue · 0 comments

The MedianFilter constructor contains the statement

memset(_buffer, _medianSize, preFill);

This is incorrect for two reasons:

  1. The last two arguments are in the wrong order.
  2. memset() fills all the bytes of the designated memory area with the same value, whereas an int is at least two bytes.

It would be more appropriate to fill the buffer with a loop.