]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Issue 382: Move variables to top of function for non-C99 compilers.
authorTim Kientzle <kientzle@acm.org>
Sun, 16 Nov 2014 01:18:56 +0000 (17:18 -0800)
committerTim Kientzle <kientzle@acm.org>
Sun, 16 Nov 2014 01:18:56 +0000 (17:18 -0800)
This should address an issue compiling with older versions
of Visual Studio.

libarchive/archive_util.c

index 12e419f645fe2638ee755d8e946906cd7b9e206b..ea14d4d80d71b20819537949e4a71532cd7d5ea0 100644 (file)
@@ -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);