Fix int truncation warning, fix format string.
diff --git a/lib/zip_source_file_win32.h b/lib/zip_source_file_win32.h
index 78c77ad..0a3027b 100644
--- a/lib/zip_source_file_win32.h
+++ b/lib/zip_source_file_win32.h
@@ -53,7 +53,7 @@
BOOL (*delete_file)(const char *name);
DWORD (*get_file_attributes)(const char *name);
BOOL (*get_file_attributes_ex)(const char *name, GET_FILEEX_INFO_LEVELS info_level, void *information);
- void (*make_tempname)(char *buf, size_t len, const char *name, int i);
+ void (*make_tempname)(char *buf, size_t len, const char *name, zip_uint32_t i);
BOOL (*move_file)(const char *from, const char *to, DWORD flags);
BOOL (*set_file_attributes)(const char *name, DWORD attributes);
char *(*string_duplicate)(const char *string);
diff --git a/lib/zip_source_file_win32_ansi.c b/lib/zip_source_file_win32_ansi.c
index 0d2568c..19ceba6 100644
--- a/lib/zip_source_file_win32_ansi.c
+++ b/lib/zip_source_file_win32_ansi.c
@@ -76,6 +76,6 @@
static void
-ansi_make_tempname(char *buf, size_t len, const char *name, int i) {
- snprintf(buf, len, "%s.%d", name, i);
+ansi_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
+ snprintf(buf, len, "%s.%08x", name, i);
}
diff --git a/lib/zip_source_file_win32_utf16.c b/lib/zip_source_file_win32_utf16.c
index d5f13e1..b77ef43 100644
--- a/lib/zip_source_file_win32_utf16.c
+++ b/lib/zip_source_file_win32_utf16.c
@@ -121,7 +121,7 @@
static void
-utf16_make_tempname(char *buf, size_t len, const char *name, int i) {
+utf16_make_tempname(char *buf, size_t len, const char *name, zip_uint32_t i) {
_snwprintf((wchar_t *)buf, len, L"%s.%08x", (const wchar_t *)name, i);
}
diff --git a/lib/zip_source_file_win32_write.c b/lib/zip_source_file_win32_write.c
index de68925..6636e34 100644
--- a/lib/zip_source_file_win32_write.c
+++ b/lib/zip_source_file_win32_write.c
@@ -96,8 +96,7 @@
_zip_win32_write_op_create_temp_output(zip_source_file_context_t *ctx) {
zip_source_file_win32_write_operations_t *write_ops = (zip_source_file_win32_write_operations_t *)ctx->ops_userdata;
- int value;
- int i;
+ zip_uint32_t value, i;
HANDLE th = INVALID_HANDLE_VALUE;
void *temp = NULL;
PSECURITY_DESCRIPTOR psd = NULL;
@@ -123,7 +122,7 @@
#ifndef MS_UWP
value = GetTickCount();
#else
- value = GetTickCount64();
+ value = (zip_uint32_t)(GetTickCount64() & 0xffffffff);
#endif
if ((tempname = write_ops->allocate_tempname(ctx->fname, 10, &tempname_size)) == NULL) {