From 7ac3a3a152a11ac5da99c1d2db9aa57c93f65202 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 31 Oct 2009 15:27:23 -0400 Subject: [PATCH] Fixed va_list assignments. --- Source/pack.c | 6 ++++-- Source/unpack.c | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Source/pack.c b/Source/pack.c index 14fc023..e0b26c9 100644 --- a/Source/pack.c +++ b/Source/pack.c @@ -36,9 +36,11 @@ extern void vspackf(void *buffer, const char *format, va_list args) BinIOInitFormatCursor(&cursor, format); context.buffer = (unsigned char *)buffer; - context.args = args; - + va_copy(context.args, args); + while (BinIONextChar(&context, &cursor, BinIOPack)) {} + + va_end(context.args); } extern void vfpackf(FILE *file, const char *format, va_list args) diff --git a/Source/unpack.c b/Source/unpack.c index a2cc44d..8568b89 100644 --- a/Source/unpack.c +++ b/Source/unpack.c @@ -36,9 +36,11 @@ void vsunpackf(const void *buffer, const char *format, va_list args) BinIOInitFormatCursor(&cursor, format); context.data = (const unsigned char*)buffer; - context.args = args; + va_copy(context.args, args); while (BinIONextChar(&context, &cursor, BinIOUnpack)) {} + + va_end(context.args); } void vfunpackf(FILE *file, const char *format, va_list args) -- 2.39.5