[Openvas-devel] 64 bit cleanless

Tim Brown timb at nth-dimension.org.uk
Wed Oct 15 22:45:12 CEST 2008


On Wednesday 15 October 2008 20:54:03 Stjepan Gros wrote:

> I can not promise that I'll do much so I'll not create svn account for now.
> Still, as I would like to use openvas on my laptop I'll try to clean a bit
> the code.

Not a problem, even little patches can help.

> Attached is a small patch that changes sizeof(int) into sizeof(void *), and
> uses casting to eliminate warnings in a single file. I also changed length
> parameter type from long to in in fuction arg_add_value beacuse 2^31 should
> be enough for all the values of this parameter and on 64-bit platform long
> is 64 bits - I believe to much. Still, this change is negligable.

I'll have a look at it shortly.

> But the main question is: I saw that glib is used in openvas-server. Does
> this means that glib is ok to use in other subsystems? If yes, than the
> most elegant way to handle 64/32 bits is via glib's macros.

I could give a long answer but ultimately the answer is yes.  If you want the 
background to our introduction of glib as a dependency, I would recommend 
taking a look at http://www.openvas.org/openvas-cr-9.html.  Essentially, 
OpenVAS has lots of cases of repeated code.  A goal is to replace them with 
tried and tested code from glib.

> Also, are there any coding guidelines I should follow when modifying the
> code?

If you spend enough time staring at the different conventions used when it was 
Nessus your eyes will bleed.  I tend to use the style of the file or function 
(;)) I am modifying.  I personally prefer explicit checks such as "if (blah 
== TRUE)" opposed to "if (blah)".  There are some excellent recommendations 
in the openvas-compendium module in the "Developers Guide for OpenVAS Server 
and Client" chapter and finally, there is a stub header in the doc module for 
new files.

Tim
-- 
Tim Brown
<mailto:timb at nth-dimension.org.uk>
<http://www.nth-dimension.org.uk/>


More information about the Openvas-devel mailing list