aboutsummaryrefslogtreecommitdiff
path: root/dlib
diff options
context:
space:
mode:
Diffstat (limited to 'dlib')
-rw-r--r--dlib/dlib.c3
-rw-r--r--dlib/dlib.h3
2 files changed, 5 insertions, 1 deletions
diff --git a/dlib/dlib.c b/dlib/dlib.c
index bba1cc5e..9e831756 100644
--- a/dlib/dlib.c
+++ b/dlib/dlib.c
@@ -345,8 +345,11 @@ void dStr_vsprintfa (Dstr *ds, const char *format, va_list argp)
int n, n_sz;
if (ds && format) {
+ va_list argp2; /* Needed in case of looping on non-32bit arch */
while (1) {
+ va_copy(argp2, argp);
n = vsnprintf(ds->str + ds->len, ds->sz - ds->len, format, argp);
+ va_end(argp2);
if (n > -1 && n < ds->sz - ds->len) {
ds->len += n; /* Success! */
break;
diff --git a/dlib/dlib.h b/dlib/dlib.h
index 6caf7c97..c54ab6ad 100644
--- a/dlib/dlib.h
+++ b/dlib/dlib.h
@@ -33,7 +33,8 @@ extern "C" {
*-- Casts -------------------------------------------------------------------
*/
/* TODO: include a void* size test in configure.in */
-#define VOIDP2INT(p) ((int)(p))
+/* (long) works for both 32bit and 64bit */
+#define VOIDP2INT(p) ((long)(p))
#define INT2VOIDP(i) ((void*)(i))
/*