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].

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

[1] http://stackoverflow.com/a/8490708/314015
[2] http://rpm5.org/community/popt-devel/0122.html

POPT Library                                           http://rpm5.org
Developer Communication List                       popt-devel@rpm5.org

Reply via email to