@@ -173,8 +173,8 @@ void SiglentBINImportFilter::OnFileNameChanged()
173173 {
174174 for (size_t j = 0 ; j < wh.wave_length ; j++)
175175 {
176- uint16_t * sample = ( uint16_t *) (f.c_str () + fpos);
177- float value = ((( int32_t ) *sample - center_code)) * v_gain - wh.ch_v_offset [i].value ;
176+ const uint16_t * sample = reinterpret_cast < const uint16_t *> (f.c_str () + fpos);
177+ float value = ((static_cast < int32_t >( *sample) - center_code)) * v_gain - wh.ch_v_offset [i].value ;
178178 wfm->m_samples .push_back (value);
179179 fpos += 2 ;
180180 }
@@ -183,8 +183,8 @@ void SiglentBINImportFilter::OnFileNameChanged()
183183 {
184184 for (size_t j = 0 ; j < wh.wave_length ; j++)
185185 {
186- uint8_t * sample = ( uint8_t *) (f.c_str () + fpos);
187- float value = (( int32_t ) *sample - center_code) * v_gain - wh.ch_v_offset [i].value ;
186+ const uint8_t * sample = reinterpret_cast < const uint8_t *> (f.c_str () + fpos);
187+ float value = (static_cast < int32_t >( *sample) - center_code) * v_gain - wh.ch_v_offset [i].value ;
188188 wfm->m_samples .push_back (value);
189189 fpos += 1 ;
190190 }
@@ -220,8 +220,8 @@ void SiglentBINImportFilter::OnFileNameChanged()
220220 {
221221 for (size_t j = 0 ; j < wh.wave_length ; j++)
222222 {
223- uint16_t * sample = ( uint16_t *) (f.c_str () + fpos);
224- float value = ((( int32_t ) *sample - center_code)) * v_gain - wh.math_v_offset [i].value ;
223+ const uint16_t * sample = reinterpret_cast < const uint16_t *> (f.c_str () + fpos);
224+ float value = ((static_cast < int32_t >( *sample) - center_code)) * v_gain - wh.math_v_offset [i].value ;
225225 wfm->m_samples .push_back (value);
226226 fpos += 2 ;
227227 }
@@ -230,8 +230,8 @@ void SiglentBINImportFilter::OnFileNameChanged()
230230 {
231231 for (size_t j = 0 ; j < wh.wave_length ; j++)
232232 {
233- uint8_t * sample = ( uint8_t *) (f.c_str () + fpos);
234- float value = (( int32_t ) *sample - center_code) * v_gain - wh.math_v_offset [i].value ;
233+ const uint8_t * sample = reinterpret_cast < const uint8_t *> (f.c_str () + fpos);
234+ float value = (static_cast < int32_t >( *sample) - center_code) * v_gain - wh.math_v_offset [i].value ;
235235 wfm->m_samples .push_back (value);
236236 fpos += 1 ;
237237 }
@@ -263,7 +263,7 @@ void SiglentBINImportFilter::OnFileNameChanged()
263263 LogDebug (" Waveform[%d]: %s\n " , wave_idx, name.c_str ());
264264 for (size_t j = 0 ; j < (wh.d_wave_length / 8 ); j++)
265265 {
266- uint8_t samples = *( uint8_t *) (f.c_str () + fpos);
266+ uint8_t samples = *reinterpret_cast < const uint8_t *> (f.c_str () + fpos);
267267 for (int k = 0 ; k < 8 ; k++)
268268 {
269269 bool value = samples & 0x1 ;
0 commit comments