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

junky reviewboard at asterisk.org
Mon Jan 9 19:36:15 CST 2012



> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/apps/app_voicemail.c, line 3071
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22915#file22915line3071>
> >
> >     Kill red blob

fixed.


> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/channels/chan_dahdi.c, line 12006
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22916#file22916line12006>
> >
> >     flose()?  What does flose() do?

haha, i need more coffee, thanks!


> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/main/ast_expr2f.c, lines 2588-2596
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22927#file22927line2588>
> >
> >     Kill the red blobs.
> 
> wdoekes wrote:
>     And I'd prefer it if you kept spacebuf and removed spacebuf2 instead. Otherwise someone will think the 2 actually means something other than I-ran-out-of-ideas-for-names.
>     
>     (P.S. s/'\\"'/'"'/g in other pieces of code.)

corydon: fixed
wdoekes: fixed the spacebuf. i'm not sure about your PS point, i'll catch you on IRC.


> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/apps/app_voicemail.c, line 1952
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22915#file22915line1952>
> >
> >     This is another indication that the return value should be checked.  Instead of removing that indication, check it.

checked.


> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/apps/app_chanspy.c, lines 976-977
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22910#file22910line976>
> >
> >     Add braces while you're here.

fixed.


> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/addons/chan_mobile.c, lines 3028-3030
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22907#file22907line3028>
> >
> >     This still needs to be checking the return value which can be 0 or -1, and if -1, checking errno.  I know you didn't write the code, but removing the error stub isn't the right answer, either.

I added one more check.


> On Jan. 9, 2012, 11:53 a.m., Tilghman Lesher wrote:
> > trunk/addons/chan_ooh323.c, line 4188
> > <https://reviewboard.asterisk.org/r/1651/diff/3/?file=22908#file22908line4188>
> >
> >     As noted by putnopvut previously, now that we're not retrieving a value, this line is a no-op.  I suspect that this points to another problem that should be fixed, and thus removing the stub isn't really a code improvement.

even if this is a noOp, i added just a LOG_WARNING, in case no FORMAT is found.


- junky


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


On Jan. 8, 2012, 9:07 p.m., junky wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/1651/
> -----------------------------------------------------------
> 
> (Updated Jan. 8, 2012, 9:07 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_alarmreceiver.c 349670 
>   trunk/apps/app_chanspy.c 349670 
>   trunk/apps/app_disa.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/channels/chan_dahdi.c 349670 
>   trunk/channels/chan_iax2.c 349670 
>   trunk/channels/chan_misdn.c 349670 
>   trunk/channels/chan_skinny.c 349670 
>   trunk/channels/chan_usbradio.c 349670 
>   trunk/formats/format_h263.c 349670 
>   trunk/funcs/func_env.c 349670 
>   trunk/funcs/func_odbc.c 349670 
>   trunk/funcs/func_strings.c 349670 
>   trunk/main/acl.c 349670 
>   trunk/main/ast_expr2.c 349670 
>   trunk/main/ast_expr2f.c 349670 
>   trunk/main/pbx.c 349670 
>   trunk/main/udptl.c 349670 
>   trunk/res/res_phoneprov.c 349670 
>   trunk/utils/astman.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/20120110/847fbfcb/attachment-0001.htm>


More information about the asterisk-dev mailing list