Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: third_party/zlib/contrib/minizip/iowin32.c

Issue 2079313002: Revert of Update Zlib to version 1.2.8 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/zlib/contrib/minizip/ioapi.c ('k') | third_party/zlib/contrib/minizip/miniunz.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/zlib/contrib/minizip/iowin32.c
diff --git a/third_party/zlib/contrib/minizip/iowin32.c b/third_party/zlib/contrib/minizip/iowin32.c
index 0467c313407ae8f8438347265bfe671925369acf..6a2a883be7225417ac14d9496e5604a51bf650f1 100644
--- a/third_party/zlib/contrib/minizip/iowin32.c
+++ b/third_party/zlib/contrib/minizip/iowin32.c
@@ -23,20 +23,6 @@
#ifndef INVALID_SET_FILE_POINTER
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
-#endif
-
-
-#ifdef _WIN32_WINNT
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x601
-#endif
-
-#if _WIN32_WINNT >= _WIN32_WINNT_WIN8
-#if defined(WINAPI_FAMILY_PARTITION) && (!(defined(IOWIN32_USING_WINRT_API)))
-#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
-#define IOWIN32_USING_WINRT_API 1
-#endif
-#endif
#endif
voidpf ZCALLBACK win32_open_file_func OF((voidpf opaque, const char* filename, int mode));
@@ -107,22 +93,8 @@
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
-#ifdef IOWIN32_USING_WINRT_API
-#ifdef UNICODE
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
-#else
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- {
- WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
- MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
- hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
- }
-#endif
-#else
if ((filename!=NULL) && (dwDesiredAccess != 0))
hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
-#endif
return win32_build_iowin(hFile);
}
@@ -136,17 +108,8 @@
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
-#ifdef IOWIN32_USING_WINRT_API
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- {
- WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
- MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
- hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
- }
-#else
if ((filename!=NULL) && (dwDesiredAccess != 0))
hFile = CreateFileA((LPCSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
-#endif
return win32_build_iowin(hFile);
}
@@ -160,13 +123,8 @@
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
-#ifdef IOWIN32_USING_WINRT_API
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- hFile = CreateFile2((LPCWSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition,NULL);
-#else
if ((filename!=NULL) && (dwDesiredAccess != 0))
hFile = CreateFileW((LPCWSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
-#endif
return win32_build_iowin(hFile);
}
@@ -180,22 +138,8 @@
win32_translate_open_mode(mode,&dwDesiredAccess,&dwCreationDisposition,&dwShareMode,&dwFlagsAndAttributes);
-#ifdef IOWIN32_USING_WINRT_API
-#ifdef UNICODE
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- hFile = CreateFile2((LPCTSTR)filename, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
-#else
- if ((filename!=NULL) && (dwDesiredAccess != 0))
- {
- WCHAR filenameW[FILENAME_MAX + 0x200 + 1];
- MultiByteToWideChar(CP_ACP,0,(const char*)filename,-1,filenameW,FILENAME_MAX + 0x200);
- hFile = CreateFile2(filenameW, dwDesiredAccess, dwShareMode, dwCreationDisposition, NULL);
- }
-#endif
-#else
if ((filename!=NULL) && (dwDesiredAccess != 0))
hFile = CreateFile((LPCTSTR)filename, dwDesiredAccess, dwShareMode, NULL, dwCreationDisposition, dwFlagsAndAttributes, NULL);
-#endif
return win32_build_iowin(hFile);
}
@@ -244,26 +188,6 @@
return ret;
}
-static BOOL MySetFilePointerEx(HANDLE hFile, LARGE_INTEGER pos, LARGE_INTEGER *newPos, DWORD dwMoveMethod)
-{
-#ifdef IOWIN32_USING_WINRT_API
- return SetFilePointerEx(hFile, pos, newPos, dwMoveMethod);
-#else
- LONG lHigh = pos.HighPart;
- DWORD dwNewPos = SetFilePointer(hFile, pos.LowPart, &lHigh, dwMoveMethod);
- BOOL fOk = TRUE;
- if (dwNewPos == 0xFFFFFFFF)
- if (GetLastError() != NO_ERROR)
- fOk = FALSE;
- if ((newPos != NULL) && (fOk))
- {
- newPos->LowPart = dwNewPos;
- newPos->HighPart = lHigh;
- }
- return fOk;
-#endif
-}
-
long ZCALLBACK win32_tell_file_func (voidpf opaque,voidpf stream)
{
long ret=-1;
@@ -272,17 +196,15 @@
hFile = ((WIN32FILE_IOWIN*)stream) -> hf;
if (hFile != NULL)
{
- LARGE_INTEGER pos;
- pos.QuadPart = 0;
-
- if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT))
+ DWORD dwSet = SetFilePointer(hFile, 0, NULL, FILE_CURRENT);
+ if (dwSet == INVALID_SET_FILE_POINTER)
{
DWORD dwErr = GetLastError();
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
ret = -1;
}
else
- ret=(long)pos.LowPart;
+ ret=(long)dwSet;
}
return ret;
}
@@ -296,17 +218,17 @@
if (hFile)
{
- LARGE_INTEGER pos;
- pos.QuadPart = 0;
-
- if (!MySetFilePointerEx(hFile, pos, &pos, FILE_CURRENT))
+ LARGE_INTEGER li;
+ li.QuadPart = 0;
+ li.u.LowPart = SetFilePointer(hFile, li.u.LowPart, &li.u.HighPart, FILE_CURRENT);
+ if ( (li.LowPart == 0xFFFFFFFF) && (GetLastError() != NO_ERROR))
{
DWORD dwErr = GetLastError();
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
ret = (ZPOS64_T)-1;
}
else
- ret=pos.QuadPart;
+ ret=li.QuadPart;
}
return ret;
}
@@ -336,9 +258,8 @@
if (hFile != NULL)
{
- LARGE_INTEGER pos;
- pos.QuadPart = offset;
- if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod))
+ DWORD dwSet = SetFilePointer(hFile, offset, NULL, dwMoveMethod);
+ if (dwSet == INVALID_SET_FILE_POINTER)
{
DWORD dwErr = GetLastError();
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
@@ -375,9 +296,9 @@
if (hFile)
{
- LARGE_INTEGER pos;
- pos.QuadPart = offset;
- if (!MySetFilePointerEx(hFile, pos, NULL, dwMoveMethod))
+ LARGE_INTEGER* li = (LARGE_INTEGER*)&offset;
+ DWORD dwSet = SetFilePointer(hFile, li->u.LowPart, &li->u.HighPart, dwMoveMethod);
+ if (dwSet == INVALID_SET_FILE_POINTER)
{
DWORD dwErr = GetLastError();
((WIN32FILE_IOWIN*)stream) -> error=(int)dwErr;
« no previous file with comments | « third_party/zlib/contrib/minizip/ioapi.c ('k') | third_party/zlib/contrib/minizip/miniunz.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698