zapping-vbi / zvbi

Vertical Blanking Interval (VBI) utilities
Other
6 stars 4 forks source link

Narrowing conversion in tests #31

Closed ileanadumitrescu95 closed 1 year ago

ileanadumitrescu95 commented 1 year ago

When running make check, compiler warnings appear:

test-hamm.cc: In function ‘void test_rev()’:
test-hamm.cc:120:36: warning: narrowing conversion of ‘n’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  120 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                    ^
test-hamm.cc:120:41: warning: narrowing conversion of ‘(n >> 8)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  120 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                       ~~^~~~
test-hamm.cc:120:49: warning: narrowing conversion of ‘(n >> 16)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  120 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                               ~~^~~~~
test-hamm.cc: In function ‘void test_par_unpar()’:
test-hamm.cc:141:36: warning: narrowing conversion of ‘n’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  141 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                    ^
test-hamm.cc:141:41: warning: narrowing conversion of ‘(n >> 8)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  141 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                       ~~^~~~
test-hamm.cc:141:49: warning: narrowing conversion of ‘(n >> 16)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  141 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                               ~~^~~~~
test-hamm.cc: In function ‘void test_ham8_ham16_unham8_unham16()’:
test-hamm.cc:169:36: warning: narrowing conversion of ‘n’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  169 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                    ^
test-hamm.cc:169:41: warning: narrowing conversion of ‘(n >> 8)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  169 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                       ~~^~~~
test-hamm.cc:169:49: warning: narrowing conversion of ‘(n >> 16)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  169 |                 uint8_t buf[4] = { n, n >> 8, n >> 16, 0xA5 };
      |                                               ~~^~~~~
test-hamm.cc: In function ‘void test_unham24()’:
test-hamm.cc:241:36: warning: narrowing conversion of ‘i’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  241 |                 uint8_t buf[4] = { i, i >> 8, i >> 16, 0xA5 };
      |                                    ^
test-hamm.cc:241:41: warning: narrowing conversion of ‘(i >> 8)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  241 |                 uint8_t buf[4] = { i, i >> 8, i >> 16, 0xA5 };
      |                                       ~~^~~~
test-hamm.cc:241:49: warning: narrowing conversion of ‘(i >> 16)’ from ‘unsigned int’ to ‘uint8_t’ {aka ‘unsigned char’} [-Wnarrowing]
  241 |                 uint8_t buf[4] = { i, i >> 8, i >> 16, 0xA5 };
      |                                               ~~^~~~~
ileanadumitrescu95 commented 1 year ago

Resolved with commit 0269a1a