I also decided to turn off the suppression of unsafe functions. (i.e. have the system generate an error when it comes across a function that is prone to a buffer overrun). This resulted in 504 errors and another 3 warnings. I turned the suppression back on, and will deal with that later.So now I can go in a bunch of different directions. Now that I have a map, let's start to categorize those warnings and what I need to do about them. Using the magic of a spreadsheet and pivot table, I only have 11 types of warnings:
- <function> undefined; assuming extern returning int (603 Warnings)
- I have not included rproto.h into the main code yet. This has all the prototypes that need to be set during compile. However, my C++ compiler seem to be prototyping on the fly, I need to put the horse before the cart here and integrate rproto.h properly
- <expression>: signed/unsigned mismatch (20 Warnings)
- C++ has a type that is not in C called size_t, which is a unsigned int. There are several common functions such as strlen() that used to return type int that now return type size_t, which is unsigned. strlen() is also one of those functions that should be an error as it's not safe (Should be using strnlen_s()) so each function with this warning will need to be checked to make sure the variable can't go negative, and if it doesn't type it to an unsigned int
- <function> : too many actual parameters (1 Warning)
- I think this is a bad placeholder file function I put in. Will be converting this to AllegroFS anyway
- <function> : different types for formal and actual parameter 'number' (1 Warning)
- Another type mismatch. I'll have to find it correct.
- <identifier1> : 'operator' : different levels of indirection from 'identifier2' (3 Warnings)
- There is some hinky pointers referencing in funny ways. Will investigate.
- <identifier> : unreferenced local variable (241 Warnings)
- This is actually pretty easy. There are unused variables. Purge them if not needed.
- <identifier1> differs in parameter lists from 'identifier2' (1 Warning)
- I have a function that is mismatching - Find and fix.
- <var> : conversion from 'size_t' to 'type', possible loss of data (1 Warning)
- size_t again, I'm guessing that my 4 byte int is not fitting in somewhere
- <function> : not enough arguments passed for format string (1 Warning)
- Another string function - those are going to get scrutinized
- <function> : not all control paths return a value (30 Warnings)
- Check execution paths.
- <function> must return a value (48 Warnings)
- Bad prototype, Check definitions
Pie graph of all warnings |
So Not bad, The "Big ones" is just janitorial work mostly type fixing and making sure functions match with how they are being called. So the plan so far is to get the warnings squashed, Check for graphical bugs in Nermal, replace the 504 insecure functions, and move the filesystem functions into Allegro... I like that as a plan so far!
No comments:
Post a Comment