RPM Community Forums

Mailing List Message of <popt-devel>

Re: popt windows build and vsnprintf

From: Jeffrey Johnson <n3npq@me.com>
Date: Thu 20 Oct 2016 - 17:25:43 CEST
Message-id: <D8DA84EF-6370-48EA-965E-3499ADFF5E39@me.com>

> On Oct 20, 2016, at 10:48 AM, Alex Kashchenko <akashche@redhat.com> wrote:
> 
> Hi,
> 
> I was building popt-1.13 for windows, it does not work out of the box, but fixes are straightforward except the following one:
> 
> diff --git a/src/poptint.c b/src/poptint.c
> index e99d28b..1b5fd9f 100644
> --- a/src/poptint.c
> +++ b/src/poptint.c
> @@ -102,7 +102,11 @@ strdup_vprintf (const char *format, va_list ap)
>     va_copy(apc, ap);  /* XXX linux amd64/ppc needs a copy. */
> /*@=noeffectuncon =unrecog @*/
> 
> +#ifdef _WIN32
> +    buffer = calloc(sizeof(*buffer), _vscprintf (format, ap) + 1);
> +#elif // !_WIN32
>     buffer = calloc(sizeof(*buffer), vsnprintf (&c, 1, format, ap) + 1);
> +#endif // _WIN32
> 
> vsnprintf has non-standard behaviour on windows (does not return the required size), details [1].
> 

Ok.

> I understand that windows is not a supported platform for popt (though found some previous porting efforts [2]), so sharing just for the record.
> 

Current code in CVS is considerably different than what was in popt-1.13 in 2007

FWIW, I compiled/tested post in CVS back in June on Windows10 without serious problems.

hth

73 de Jeff
> 
> [1] http://stackoverflow.com/a/8490708/314015
> [2] http://rpm5.org/community/popt-devel/0122.html
> 
> -- 
> -Alex
> ______________________________________________________________________
> POPT Library                                           http://rpm5.org
> Developer Communication List                       popt-devel@rpm5.org
Received on Thu Oct 20 18:25:50 2016
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.