[asterisk-dev] [Code Review] avoid cppcheck warnings

Mark Michelson reviewboard at asterisk.org
Thu Jan 5 10:54:10 CST 2012


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/1651/#review5107
-----------------------------------------------------------



trunk/addons/chan_ooh323.c
<https://reviewboard.asterisk.org/r/1651/#comment9508>

    Since res will always be 0 here, I think it's more clear to keep this as "return 0;". Instead, I think you should remove the res variable from this function.



trunk/addons/chan_ooh323.c
<https://reviewboard.asterisk.org/r/1651/#comment9509>

    This is a no-op now. Either find out what needs to be done with "mode" and do something with it or remove this call entirely.



trunk/apps/app_chanspy.c
<https://reviewboard.asterisk.org/r/1651/#comment9510>

    Instead of getting rid of "num" change line 975 to use "num" as its second argument.
    
    Also, I'm not a fan of using atoi() in this way. atoi() will return 0 if the input cannot be parsed as a number OR if the number is 0. strtol() is better for this sort of thing.



trunk/apps/app_osplookup.c
<https://reviewboard.asterisk.org/r/1651/#comment9511>

    Removing a struct member like this could cause ABI issues. Just leave it.



trunk/apps/app_queue.c
<https://reviewboard.asterisk.org/r/1651/#comment9512>

    You can just remove the pbx_builtin_getvar_helper(qe->chan, "MONITOR_EXEC_ARGS") call altogether since it is essentially a no-op now.
    



trunk/apps/app_voicemail.c
<https://reviewboard.asterisk.org/r/1651/#comment9513>

    There is a bug here, but your change is not fixing it.
    
    The first line in the else block should be using "quote + 1" instead of "buf + 1" in the strchr() call. Make that change instead.


- Mark


On Jan. 4, 2012, 11:10 p.m., junky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1651/
> -----------------------------------------------------------
> 
> (Updated Jan. 4, 2012, 11:10 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> By running cppcheck 1.52, i realized there was many errors/warnings.
> 
> This patch fixes many of those.
> 
> 
> Diffs
> -----
> 
>   trunk/addons/chan_mobile.c 349670 
>   trunk/addons/chan_ooh323.c 349670 
>   trunk/apps/app_chanspy.c 349670 
>   trunk/apps/app_minivm.c 349670 
>   trunk/apps/app_osplookup.c 349670 
>   trunk/apps/app_queue.c 349670 
>   trunk/apps/app_voicemail.c 349670 
>   trunk/funcs/func_env.c 349670 
>   trunk/funcs/func_odbc.c 349670 
>   trunk/funcs/func_strings.c 349670 
>   trunk/main/pbx.c 349670 
> 
> Diff: https://reviewboard.asterisk.org/r/1651/diff
> 
> 
> Testing
> -------
> 
> still compile fine.
> Shouldn't have any impact on the code execution.
> 
> 
> Thanks,
> 
> junky
> 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20120105/b397e771/attachment-0001.htm>


More information about the asterisk-dev mailing list