[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
Sat Jan 6 01:20:40 CST 2018


    [ https://issues.asterisk.org/jira/browse/ASTERISK-27557?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=241379#comment-241379 ] 

Asterisk Team commented on ASTERISK-27557:
------------------------------------------

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

> [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
>            Severity: Minor
>              Labels: patch
>         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