[asterisk-dev] [Code Review]: avoid many cppcheck (#2)

junky reviewboard at asterisk.org
Thu Mar 1 00:21:55 CST 2012



> On Feb. 28, 2012, 3:34 a.m., wdoekes wrote:
> > trunk/apps/app_osplookup.c, line 2985
> > <https://reviewboard.asterisk.org/r/1743/diff/1/?file=24203#file24203line2985>
> >
> >     - acceleration has one l
> >     - please add a comma, we're not unable to enable the error
> >

fixed.


> On Feb. 28, 2012, 3:34 a.m., wdoekes wrote:
> > trunk/channels/chan_unistim.c, lines 4344-4346
> > <https://reviewboard.asterisk.org/r/1743/diff/1/?file=24211#file24211line4344>
> >
> >     This doesn't seem to be needed. Since it hasn't crashed before.

if channel_to_session(ast) returns NULL, without that new if, we'll get a segfault.


> On Feb. 28, 2012, 3:34 a.m., wdoekes wrote:
> > trunk/res/res_jabber.c, line 1665
> > <https://reviewboard.asterisk.org/r/1743/diff/1/?file=24228#file24228line1665>
> >
> >     FIXME: double check

let me know for all the FIXME.
Thanks for review.


> On Feb. 28, 2012, 3:34 a.m., wdoekes wrote:
> > trunk/codecs/codec_resample.c, line 136
> > <https://reviewboard.asterisk.org/r/1743/diff/1/?file=24214#file24214line136>
> >
> >     I'd rather have res used and return LOAD_FAILURE of some kind.

added.


> On Feb. 28, 2012, 3:34 a.m., wdoekes wrote:
> > trunk/res/res_config_sqlite3.c, line 964
> > <https://reviewboard.asterisk.org/r/1743/diff/1/?file=24223#file24223line964>
> >
> >     You're changing this into something that was not intended:
> >     
> >     !(res = call()) < 0 ? -1 : 0
> >     
> >     I wouldn't even know if !0 < 0 or > 0, and when/if I did, I could drop the ternary ?: operator.
> >     
> >     Looks to me like this was intended:
> >     
> >     !(res = (call() < 0 ? -1 : 0))

good catch, changed.


> On Feb. 28, 2012, 3:34 a.m., wdoekes wrote:
> > trunk/funcs/func_env.c, line 603
> > <https://reviewboard.asterisk.org/r/1743/diff/1/?file=24217#file24217line603>
> >
> >     This is nasty.
> >     
> >     I'd prefer to move the left parenthesis to just before 'end' instead.
> >     
> >     Or, simply move up the pos= to a single line and leave the for-initializer empty.

changed for your first proposition.


- junky


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


On Feb. 14, 2012, 9:13 p.m., junky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1743/
> -----------------------------------------------------------
> 
> (Updated Feb. 14, 2012, 9:13 p.m.)
> 
> 
> Review request for Asterisk Developers.
> 
> 
> Summary
> -------
> 
> This patch is to prevent many more cppcheck warnings.
> 
> 
> Diffs
> -----
> 
>   trunk/cdr/cdr_pgsql.c 355447 
>   trunk/cdr/cdr_sqlite3_custom.c 355447 
>   trunk/channels/chan_agent.c 355447 
>   trunk/channels/chan_alsa.c 355447 
>   trunk/channels/chan_dahdi.c 355447 
>   trunk/channels/chan_gtalk.c 355447 
>   trunk/channels/chan_h323.c 355447 
>   trunk/channels/chan_unistim.c 355447 
>   trunk/apps/app_minivm.c 355447 
>   trunk/apps/app_osplookup.c 355447 
>   trunk/channels/vcodecs.c 355447 
>   trunk/codecs/codec_dahdi.c 355447 
>   trunk/codecs/codec_resample.c 355447 
>   trunk/formats/format_h264.c 355447 
>   trunk/funcs/func_devstate.c 355447 
>   trunk/funcs/func_env.c 355447 
>   trunk/main/ast_expr2.fl 355447 
>   trunk/main/ast_expr2f.c 355447 
>   trunk/main/asterisk.c 355447 
>   trunk/main/data.c 355447 
>   trunk/res/res_config_ldap.c 355447 
>   trunk/res/res_config_sqlite3.c 355447 
>   trunk/res/res_corosync.c 355447 
>   trunk/res/res_format_attr_celt.c 355447 
>   trunk/res/res_format_attr_silk.c 355447 
>   trunk/res/res_http_post.c 355447 
>   trunk/res/res_jabber.c 355447 
>   trunk/res/res_musiconhold.c 355447 
>   trunk/res/res_odbc.c 355447 
>   trunk/res/res_phoneprov.c 355447 
> 
> Diff: https://reviewboard.asterisk.org/r/1743/diff
> 
> 
> Testing
> -------
> 
> used cppcheck 1.52
> it compiles ;)
> 
> 
> Thanks,
> 
> junky
> 
>

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


More information about the asterisk-dev mailing list