Pascal's TechBlog

Friday, September 30, 2005

Corbicula anti virus: squashing bugs

I did some bug squashing on Corbicula today, somehow the scanning worker thread stopped recursing into subdirectories. Then I remembered I changed the depth perception a couple of days ago.

Why did I change it? It was like this, the scanner algorithm would be started with a depth of 0 and it would add up during recursion and finally stop recursing until it hit a hardcoded depth of 20. Of course I could always add some GConf stuff to my worker thread, but that didn't seem like the way to go.

So I decided I would actually start at the root with my maximum recursion count and decrease while getting more in depth, this way hardcoding a depth of 0 to stop recursing wouldn't be dirty, and the recursion depth parameter could be passed in a nice and clean dynamic way.

Skillfully using the ubiquitous poor mans debugger (ie, using 'Console.WriteLine ()') I eventually found out I forgot to change the smaller-than sign into a greater-than sign, forcing the algorithm to immediately stop recursing, because 20 wasn't smaller-than 0. A textbook case of human error...

The Preferences Dialog now also stores it's GConf settings in the correct place (/apps/corbicula) instead of the GConf root (/).

0 Comments:

Post a Comment

<< Home