diff options
author | Tim Kientzle <kientzle@acm.org> | 2014-11-15 17:18:56 -0800 |
---|---|---|
committer | Tim Kientzle <kientzle@acm.org> | 2014-11-15 17:18:56 -0800 |
commit | acaeb910dcbfc062b6e0549f7cfe62073278ad55 (patch) | |
tree | 1a3a76a0927fd07947dab6c20212253e6175aa9c /libarchive/archive_util.c | |
parent | cf8e67ffc8a2227b63fc6d3d1569b0214f160f54 (diff) | |
download | libarchive-acaeb910dcbfc062b6e0549f7cfe62073278ad55.tar.gz |
Issue 382: Move variables to top of function for non-C99 compilers.
This should address an issue compiling with older versions
of Visual Studio.
Diffstat (limited to 'libarchive/archive_util.c')
-rw-r--r-- | libarchive/archive_util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index 12e419f6..ea14d4d8 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); |