On Sun, Jan 1, 2012 at 3:20 AM, Gerhard Olsson <gerhard.nospam@gmail.com> wrote:

* K&R function prototypes converted to C89 style. This especially applies to code from external sources like zlib and strptime 


* Use of C++ reserved keywords (this) (only zlib)

zlib and strptime are distractions.  Leave them C.

* Some type casting required. It is very likely that some types should be changed instead, I did not spend time on that.

It's busy work to try to eliminate all the warnings.  Indeed, many of them highlight areas that need "better" fixes later.

Some special changes needed for Visual Studio:
* if level too deep in gtm.c, a very ugly ifdef added...

Man, that's gross.

* strstr, strchr return type casted from "const char *" to "char *"

Eliminating these warnings isn't very interesting.  They'll be QString::indexOf eventually.

* some functions in magproto.c using fatal() (calling exit()) did not return - added return NULL.

That's probably something like #if MSVC #  define NORETURN __declspec(noreturn) in defs.h.

 have separated zlib and the rest (strptime should have been bundled with zlib). zlib required most changes, I assume that zlib was not compiled when g++ was tested on MACOS or Linux, but as what I have found out, zlib is required in Win.

No, you're trying too hard.  There's no reason to wrangle everything at once.  zlib is C and there's no reason to treat it otherwise.  (See GPSBabel.pro)   strptime is wretched, but it's also C and fighting it buys us nothing.  

I'll pick through the patch, but I suspect you're probably just fighting too hard for now.   Eliminating warnings about sign extension and const correctness is a distraction.   Most of that code will be replaced anyway.  I don't really want to fix warnings in xstrrstr.  I want to use QString::indexOf(..., -1) instead.   Zero warnings in C++ is a non-goal for me right now.

In fact, If you want to ignore all this, create your new module in C++, extern"C" { #include "defs.h" and anything else you need }, link with C++ and you're probably good to go.

Let's choose our battles carefully.