[GRASS-dev] native WinGRASS and attribute data deadlock, next try

Moritz Lennert mlennert at club.worldonline.be
Mon Oct 8 15:27:34 EDT 2007


On Sun, October 7, 2007 23:04, Glynn Clements wrote:
>
> Glynn Clements wrote:
>
>> My preferred approach would be to change lib/db/dbmi_base to simply
>> not use XDR (that isn't anywhere near as much work as it might sound).
>
> I have attached a patch to do this. I haven't committed it yet in case
> it breaks anything (and if it breaks anything, it may break a lot of
> things).
>
> Could someone familiar with DBMI and vectors test it out?
>
> Index: lib/db/dbmi_base/xdr.c
> ===================================================================
> RCS file: /grassrepository/grass6/lib/db/dbmi_base/xdr.c,v
> retrieving revision 1.5
> diff -u -r1.5 xdr.c
> --- lib/db/dbmi_base/xdr.c	26 Apr 2007 16:44:44 -0000	1.5
> +++ lib/db/dbmi_base/xdr.c	7 Oct 2007 20:50:35 -0000
> @@ -15,47 +15,84 @@
>   *****************************************************************************/
>  #include "xdr.h"
>
> +#ifdef __MINGW32__
> +#define USE_STDIO 0
> +#define USE_READN 1
> +#else
> +#define USE_STDIO 1
> +#define USE_READN 0
> +#endif
> +
> +#ifndef USE_STDIO
> +#include <unistd.h>
> +#endif
> +
>  static FILE *_send, *_recv;
>
> -void
> -db__set_protocol_fds (FILE *send, FILE *recv)
> -{
> -    _send = send;
> -    _recv = recv;
> -}
> +#if USE_READN
>
> -int
> -xdr_begin_send(XDR *xdrs)
> +static ssize_t readn(int fd, void *buf, size_t count)
>  {
> -    xdrstdio_create (xdrs, _send, XDR_ENCODE);
> +	ssize_t total = 0;
> +
> +	while (total < count)
> +	{
> +		ssize_t n = read(fd, (char *) buf + total, count - total)

the MINGW compiler complains about a missing ';' at the end here. gcc
under linux doesn't...don't know why.

> +		ssize_t n = write(fd, (const char *) buf + total, count - total)

same here

Moritz




More information about the grass-dev mailing list