From: Ryan C. Gordon Date: Sat, 31 Oct 2009 19:27:23 +0000 (-0400) Subject: Fixed va_list assignments. X-Git-Url: https://git.jsancho.org/?a=commitdiff_plain;h=7ac3a3a152a11ac5da99c1d2db9aa57c93f65202;p=lugaru.git Fixed va_list assignments. --- 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)