[Home]

Summary:ASTERISK-27557: [patch] clang 5.0: implicit conversion to char changes value to negative.
Reporter:Alexander Traud (traud)Labels:patch
Date Opened:2018-01-06 01:18:50.000-0600Date Closed:2018-01-08 11:00:50.000-0600
Priority:MinorRegression?
Status:Closed/CompleteComponents:Addons/chan_ooh323 Applications/app_adsiprog Applications/app_sms Resources/res_http_websocket
Versions:13.18.5 15.1.5 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) we_do_bytes_part_1.patch
( 1) we_do_bytes_part_2.patch
( 2) we_do_bytes_part_3.patch
Description:The compiler _clang_ (5.0.1) reports:{code}warning: implicit conversion from 'int' to 'char' changes value from 191 to -65 [-Wconstant-conversion]{code}This happens at six places (four modules) in the current Asterisk source code. In all cases, the integer value is a byte/flag actually. Two approaches are known to solve this:
A) change the literal to hexadecimal, for example {{*p++ = 191}} to {{*p++ = 0xbf}}
B) change the type to {{unsigned char}} for example {{char frame\[4\]}} to {{unsigned char frame\[4\]}}.

Approach B is to prefer when possible†, [see...|http://www.soundsoftware.ac.uk/c-pitfall-unsigned]
† The ABI does not change, for example in case of local variables.
Comments:By: Friendly Automation (friendly-automation) 2018-01-08 06:33:40.167-0600

Change 7852 merged by Jenkins2:
General: Avoid implicit conversion to char when changes value to negative.

[https://gerrit.asterisk.org/7852|https://gerrit.asterisk.org/7852]

By: Friendly Automation (friendly-automation) 2018-01-08 06:48:12.298-0600

Change 7851 merged by Jenkins2:
General: Avoid implicit conversion to char when changes value to negative.

[https://gerrit.asterisk.org/7851|https://gerrit.asterisk.org/7851]

By: Friendly Automation (friendly-automation) 2018-01-08 06:52:51.541-0600

Change 7850 merged by Jenkins2:
General: Avoid implicit conversion to char when changes value to negative.

[https://gerrit.asterisk.org/7850|https://gerrit.asterisk.org/7850]