"Gary E. Miller" <[email protected]> writes:

> I'm sorry, I seem to have missed the start of this thread?

I meant to include the diff...

> gps_fd is much, much, more of a mess than you could ever suspect.
>
> When Qt is not invalved, gps_fd is an integer.
>
> When Qt is involved, gps_fd is a void*

Yes, that's nuts.

> Look in include/gps.h:
>
> #ifdef USE_QT
>     /* we want this to be QTcpSocket *, but that requires QTcpSocket.h, which
>      * requires a bunch of other includes, that require __cpplus, and that
>      * gets weird fast. */
> typedef void* gps_fd_t;
> #else
>     /* socket or file descriptor to GPS
>      * POSIX says this is an int.
>      * use socket_t, which is int, for windows compatibility */
> typedef socket_t gps_fd_t;
> #endif

I found that.

> Yes, it is a big steaming pile, but it actually works.  I don't know Qt,
> so I will not touch it unless something breaks.  The guy that did the
> Qt stuff decided it was easier to reuse gpsd_fp instead of changing
> a tone of function calls, adding #ifdef, etc.

I don't know qt either, but the idea that you make some call to get a
file object and it's a pointer and you pass that to functions that
operate on files is not crazy.

Except that the result is very messy, compared to having wrapped regular
files the same pointer way.

> For logging purposes, just treat gps_fd as a long, and it works for Qt, and
> non-Qt.

As long as void* and long are the same length, it's sort of ok.

> If someone that knows Qt wants to fix this in a more elegant manner, then
> have at it.  But it will be a large and invasive task.  Not something to dd
> near a release.  My attitude, for now, is "Ain'y broke, don't fix it."

Indeed, I can see your point.

Reply via email to