From: Tim Kientzle Date: Sun, 16 Nov 2014 01:18:56 +0000 (-0800) Subject: Issue 382: Move variables to top of function for non-C99 compilers. X-Git-Tag: v3.1.900a~168 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acaeb910dcbfc062b6e0549f7cfe62073278ad55;p=thirdparty%2Flibarchive.git Issue 382: Move variables to top of function for non-C99 compilers. This should address an issue compiling with older versions of Visual Studio. --- 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);