From acaeb910dcbfc062b6e0549f7cfe62073278ad55 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sat, 15 Nov 2014 17:18:56 -0800 Subject: [PATCH] Issue 382: Move variables to top of function for non-C99 compilers. This should address an issue compiling with older versions of Visual Studio. --- libarchive/archive_util.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index 12e419f64..ea14d4d80 100644 --- a/libarchive/archive_util.c +++ b/libarchive/archive_util.c @@ -257,6 +257,8 @@ __archive_errx(int retvalue, const char *msg) int __archive_mktemp(const char *tmpdir) { + static const wchar_t *prefix = L"libarchive_"; + static const wchar_t *suffix = L"XXXXXXXXXX"; static const wchar_t num[] = { L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F', @@ -331,8 +333,7 @@ __archive_mktemp(const char *tmpdir) /* * Create a temporary file. */ - const wchar_t *suffix = L"XXXXXXXXXX"; - archive_wstrcat(&temp_name, L"libarchive_"); + archive_wstrcat(&temp_name, prefix); archive_wstrcat(&temp_name, suffix); ep = temp_name.s + archive_strlen(&temp_name); xp = ep - wcslen(suffix); -- 2.47.2