On 12/14/2012 10:48 AM, Guenter Knauf wrote:
> Am 12.12.2012 22:44, schrieb Marion & Christophe JAILLET:
>> Here are a few things triggered by cppcheck.
>>
>>
>> Le 11/12/2012 21:08, humbed...@apache.org a écrit :
>>> Author: humbedooh
>>> Date: Tue Dec 11 20:08:24 2012
>>> New Revision: 1420377
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1420377&view=rev
>>> Log:
>>> mod_lua: Add a lot of core httpd/apr functionality to mod_lua
>>> (such as regex matching, expr evaluation, changing/fetching server
>>> configuration/info - see docs for a complete list).
>>> This also includes a bunch of automatically scraped functions, which
>>> may or may not be super useful.
>>> Comments appreciated as always, especially on the more hacky bits.
>>>
>>>
>>> Modified: httpd/httpd/trunk/modules/lua/lua_apr.c
>>> URL:
>>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/lua/lua_apr.c?rev=1420377&r1=1420376&r2=1420377&view=diff
>>>
>>>
>>> ==============================================================================
>>>
>>>
>>> --- httpd/httpd/trunk/modules/lua/lua_apr.c (original)
>>> +++ httpd/httpd/trunk/modules/lua/lua_apr.c Tue Dec 11 20:08:24 2012
>>
>> I've put the parsed file on:
>> http://people.apache.org/~jailletc36/lua_apr.html
>> Check it from there. Things noticed by cppcheck are red-marked.
>>
>> Except the 'The scope of the variable '...' can be reduced' that can be
>> ignored, all the other remarks are relevant.
>>
>> Especially:
>> a useless apr_pcalloc (line 249)
>> a out of bound access (line 321) --> I don't know if Rsha1 should be
>> [20] or if the loop should be limited to < 16
>> this seems to be a cut and paste error from lua_apr_md5
>> a uninitialized variable (line 430)
> beside these probs there are type mismatches which break strict compilers:
> 
>> AR   obj_release/lua.lib
>> CC   mod_lua.c
>> CC   lua_apr.c
>> ### mwccnlm Compiler:
>> #    File: lua_apr.c
>> # ------------------
>> #     278:      apr_md5_final(digest.chr, &md5);
>> #   Error:                                    ^
>> #   illegal implicit conversion from 'char[16]' to
>> #   'unsigned char *'
>> #   Too many errors printed, aborting program
>>
>> User break, cancelled...
>> make[2]: *** [obj_release/lua_apr.o] Error 2
>> CC   lua_config.c
>> CC   lua_request.c
>> ### mwccnlm Compiler:
>> #    File: lua_request.c
>> # ----------------------
>> #     230:          if (lua_read_body(r, &data, &size) != OK) {
>> #   Error:                                           ^
>> #   illegal implicit conversion from 'unsigned int *' to
>> #   'long long *'
>> #   Too many errors printed, aborting program
>>
>> User break, cancelled...
>> make[2]: *** [obj_release/lua_request.o] Error 2
> 
> Daniel, please check the used types more carefully and either change
> them or cast.
> 
> Gün.
> 
Thanks for the heads up, guys!
I didn't receive Christophe's email, which is why I didn't put these
fixes up till now. I will try to use that cppcheck program in the
future, it seems very nice, and catches some things that my regular
compiler warning settings don't. So thanks for that as well :)

With regards,
Daniel.

Reply via email to