[asterisk-bugs] [JIRA] (ASTERISK-27557) [patch] clang 5.0: implicit conversion to char changes value to negative.

Asterisk Team (JIRA) noreply at issues.asterisk.org
Thu Feb 22 17:27:29 CST 2018


     [ https://issues.asterisk.org/jira/browse/ASTERISK-27557?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Asterisk Team updated ASTERISK-27557:
-------------------------------------

    Target Release Version/s: 15.3.0

> [patch] clang 5.0: implicit conversion to char changes value to negative.
> -------------------------------------------------------------------------
>
>                 Key: ASTERISK-27557
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27557
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Addons/chan_ooh323, Applications/app_adsiprog, Applications/app_sms, Resources/res_http_websocket
>    Affects Versions: 13.18.5, 15.1.5
>            Reporter: Alexander Traud
>            Assignee: Alexander Traud
>            Severity: Minor
>              Labels: patch
>      Target Release: 13.20.0, 15.3.0
>
>         Attachments: we_do_bytes_part_1.patch, we_do_bytes_part_2.patch, we_do_bytes_part_3.patch
>
>
> 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.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list