gemrb/gemrb — pull request #18 by VanNostrand (2014-06-02 17:15:58+00:00)
Title: g++ now compiles with -pedantic -Wmissing-declarations -Winline and except for MVEPlayer with -Wcast-qual.

-Wmissing-declarations needed either function prototypes or (in most cases) static functions.
-Wcast-qual needed stricter type casting with const_cast, reinterpret_cast, dynamic_cast. The MVEPlayer code would need some special treatment because of many 'const unsigned char*' to type 'guint8* {aka unsigned char*}' aka 'PIXEL' casts and I didn't get that right.

There are still some casts from 'unsigned char *' to 'Uint16 *' (aka 'unsigned short *') aka creepy pixel castings in plugins/SDLVideo/SDLVideo.cpp that increase the required alignment from 1 byte to 2 or 4 bytes but that would require a lexical cast or so (C++11 or boost or an own implementation).

I commented out some unused code. If needed, it can be enabled again.

I took to heart that OpenSSL made some creepy own memory handling which prevented proper tool usage and replaced the BIKPlayer's memory management with the system's malloc/free - which is also what ffmpeg/libav does. The current version of libavutil's memory management is even larger than the one in gemrb's local copy so they had some reason to ditch this code too.

There is still much code where pointer variables are tested (if NULL) before and set to NULL after freeing memory. This is dummy code and should be removed because free sets the address to NULL by itself, malloc too in case of fail and free(NULL) is guaranteed to be safe. But replacing those everywhere is very tedious and probably a day of work.
(The memory allocation could use some work, there are even 2d arrays where new is used for rows and malloc for columns in a happy mix... But replacing everything with new would require at least 2 days of work and pull further work like using strings and streams for all the char* formatting.)

I commented out some code in a second commit that always evaluates to true - though the programmer probably plays with this NULL setting of pointer variables.