Commit 1048e2cb authored by Varun Khaneja's avatar Varun Khaneja Committed by Commit Bot

Revert "[2] Build unrar only for full safe browsing mode."

This reverts commit 29a153c3.

Reason for revert: Causing build failures https://bugs.chromium.org/p/chromium/issues/detail?id=807391

Original change's description:
> [2] Build unrar only for full safe browsing mode.
> 
> - Enables exception handling: throw/try/catch.
> - Disables a bunch of warnings that this library is full of.
>   - "-Wno-dangling-else"
>   - "-Wno-logical-op-parentheses"
>   - "-Wno-switch"
> 
> Bug: 750327
> Change-Id: Ic08f67e328da2f22f3503eab074be6aaf2f2fc90
> Reviewed-on: https://chromium-review.googlesource.com/872219
> Reviewed-by: Ken Rockot <rockot@chromium.org>
> Reviewed-by: Nathan Parker <nparker@chromium.org>
> Reviewed-by: Jialiu Lin <jialiul@chromium.org>
> Commit-Queue: Varun Khaneja <vakh@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#531926}

TBR=rockot@chromium.org,nparker@chromium.org,vakh@chromium.org,jialiul@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 750327
Change-Id: Ided3cdfc2b4849de090a329a29de94288b616a3c
Reviewed-on: https://chromium-review.googlesource.com/894999Reviewed-by: default avatarVarun Khaneja <vakh@chromium.org>
Commit-Queue: Varun Khaneja <vakh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#533337}
parent c35bacf1
...@@ -23,10 +23,6 @@ source_set("cpp") { ...@@ -23,10 +23,6 @@ source_set("cpp") {
"zip_file_creator.h", "zip_file_creator.h",
] ]
} }
#TODO(crbug/750327): This dependency is here temporarily.
deps = [ "//third_party/unrar:unrar" ]
public_deps += [ "//chrome/common/safe_browsing" ] public_deps += [ "//chrome/common/safe_browsing" ]
} }
} }
......
...@@ -2,10 +2,9 @@ ...@@ -2,10 +2,9 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/features.gni") static_library("unrar") {
deps = []
if (safe_browsing_mode == 1) {
static_library("unrar") {
sources = [ sources = [
"src/archive.cpp", "src/archive.cpp",
"src/arcread.cpp", "src/arcread.cpp",
...@@ -14,6 +13,7 @@ if (safe_browsing_mode == 1) { ...@@ -14,6 +13,7 @@ if (safe_browsing_mode == 1) {
"src/consio.cpp", "src/consio.cpp",
"src/crc.cpp", "src/crc.cpp",
"src/crypt.cpp", "src/crypt.cpp",
"src/dll.cpp",
"src/encname.cpp", "src/encname.cpp",
"src/errhnd.cpp", "src/errhnd.cpp",
"src/extinfo.cpp", "src/extinfo.cpp",
...@@ -56,29 +56,5 @@ if (safe_browsing_mode == 1) { ...@@ -56,29 +56,5 @@ if (safe_browsing_mode == 1) {
"src/volume.cpp", "src/volume.cpp",
] ]
configs -= [ defines = [ "_FILE_OFFSET_BITS=64", "LARGEFILE_SOURCE", "RAR_SMP" ]
"//build/config/compiler:chromium_code",
"//build/config/compiler:no_exceptions",
]
configs += [
"//build/config/compiler:exceptions",
]
if (is_clang) {
cflags = [
"-Wno-dangling-else",
"-Wno-logical-op-parentheses",
"-Wno-switch",
]
}
defines = [
"_FILE_OFFSET_BITS=64",
"LARGEFILE_SOURCE",
"RAR_SMP",
# The following is set to disable certain macro definitions in the unrar
# source code.
"CHROMIUM_UNRAR"
]
}
} }
diff --git a/third_party/unrar/src/isnt.cpp b/third_party/unrar/src/isnt.cpp
index 6fadec049fe4..cb1eefce24af 100644
--- a/third_party/unrar/src/isnt.cpp
+++ b/third_party/unrar/src/isnt.cpp
@@ -1,24 +1,16 @@
-#include "rar.hpp"
+#include "isnt.hpp"
#ifdef _WIN_ALL
+#include "versionhelpers.h"
+
DWORD WinNT()
{
- static int dwPlatformId=-1;
- static DWORD dwMajorVersion,dwMinorVersion;
- if (dwPlatformId==-1)
- {
- OSVERSIONINFO WinVer;
- WinVer.dwOSVersionInfoSize=sizeof(WinVer);
- GetVersionEx(&WinVer);
- dwPlatformId=WinVer.dwPlatformId;
- dwMajorVersion=WinVer.dwMajorVersion;
- dwMinorVersion=WinVer.dwMinorVersion;
- }
- DWORD Result=0;
- if (dwPlatformId==VER_PLATFORM_WIN32_NT)
- Result=dwMajorVersion*0x100+dwMinorVersion;
-
-
- return Result;
+ if (!IsWinXpOrGreater()) return WNT_NONE;
+ if (!IsWinVistaOrGreater()) return WNT_WXP;
+ if (!IsWindows7OrGreater()) return WNT_VISTA;
+ if (!IsWindows8OrGreater()) return WNT_W7;
+ if (!IsWindows8Point1OrGreater()) return WNT_W8;
+ if (!IsWindows10OrGreater()) return WNT_W81;
+ return WNT_W10;
}
#endif
diff --git a/third_party/unrar/src/isnt.hpp b/third_party/unrar/src/isnt.hpp
index 85790da46290..691a26a7b85c 100644
--- a/third_party/unrar/src/isnt.hpp
+++ b/third_party/unrar/src/isnt.hpp
@@ -1,6 +1,8 @@
#ifndef _RAR_ISNT_
#define _RAR_ISNT_
+#ifdef _WIN_ALL
+
enum WINNT_VERSION {
WNT_NONE=0,WNT_NT351=0x0333,WNT_NT4=0x0400,WNT_W2000=0x0500,
WNT_WXP=0x0501,WNT_W2003=0x0502,WNT_VISTA=0x0600,WNT_W7=0x0601,
@@ -9,5 +11,6 @@ enum WINNT_VERSION {
DWORD WinNT();
+#endif
#endif
diff --git a/third_party/unrar/src/os.hpp b/third_party/unrar/src/os.hpp
index f235f62..bc6b205 100644
--- a/third_party/unrar/src/os.hpp
+++ b/third_party/unrar/src/os.hpp
@@ -23,17 +23,22 @@
#ifdef _WIN_ALL
#define STRICT
+
+#if !defined(CHROMIUM_UNRAR)
#define UNICODE
#undef WINVER
#undef _WIN32_WINNT
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
+#endif // CHROMIUM_UNRAR
-#if !defined(ZIPSFX)
+#if !defined(ZIPSFX) && !defined(CHROMIUM_UNRAR)
#define RAR_SMP
#endif
+#if !defined(CHROMIUM_UNRAR)
#define WIN32_LEAN_AND_MEAN
+#endif // CHROMIUM_UNRAR
#include <windows.h>
#include <prsht.h>
@@ -65,8 +70,11 @@
#include <direct.h>
#include <intrin.h>
+#if !defined(CHROMIUM_UNRAR)
#define USE_SSE
#define SSE_ALIGNMENT 16
+#endif // CHROMIUM_UNRAR
+
#else
#include <dirent.h>
#endif // _MSC_VER
#include "isnt.hpp" #include "rar.hpp"
#ifdef _WIN_ALL #ifdef _WIN_ALL
#include "versionhelpers.h"
DWORD WinNT() DWORD WinNT()
{ {
if (!IsWinXpOrGreater()) return WNT_NONE; static int dwPlatformId=-1;
if (!IsWinVistaOrGreater()) return WNT_WXP; static DWORD dwMajorVersion,dwMinorVersion;
if (!IsWindows7OrGreater()) return WNT_VISTA; if (dwPlatformId==-1)
if (!IsWindows8OrGreater()) return WNT_W7; {
if (!IsWindows8Point1OrGreater()) return WNT_W8; OSVERSIONINFO WinVer;
if (!IsWindows10OrGreater()) return WNT_W81; WinVer.dwOSVersionInfoSize=sizeof(WinVer);
return WNT_W10; GetVersionEx(&WinVer);
dwPlatformId=WinVer.dwPlatformId;
dwMajorVersion=WinVer.dwMajorVersion;
dwMinorVersion=WinVer.dwMinorVersion;
}
DWORD Result=0;
if (dwPlatformId==VER_PLATFORM_WIN32_NT)
Result=dwMajorVersion*0x100+dwMinorVersion;
return Result;
} }
#endif #endif
#ifndef _RAR_ISNT_ #ifndef _RAR_ISNT_
#define _RAR_ISNT_ #define _RAR_ISNT_
#ifdef _WIN_ALL
enum WINNT_VERSION { enum WINNT_VERSION {
WNT_NONE=0,WNT_NT351=0x0333,WNT_NT4=0x0400,WNT_W2000=0x0500, WNT_NONE=0,WNT_NT351=0x0333,WNT_NT4=0x0400,WNT_W2000=0x0500,
WNT_WXP=0x0501,WNT_W2003=0x0502,WNT_VISTA=0x0600,WNT_W7=0x0601, WNT_WXP=0x0501,WNT_W2003=0x0502,WNT_VISTA=0x0600,WNT_W7=0x0601,
...@@ -11,6 +9,5 @@ enum WINNT_VERSION { ...@@ -11,6 +9,5 @@ enum WINNT_VERSION {
DWORD WinNT(); DWORD WinNT();
#endif
#endif #endif
...@@ -23,22 +23,17 @@ ...@@ -23,22 +23,17 @@
#ifdef _WIN_ALL #ifdef _WIN_ALL
#define STRICT #define STRICT
#if !defined(CHROMIUM_UNRAR)
#define UNICODE #define UNICODE
#undef WINVER #undef WINVER
#undef _WIN32_WINNT #undef _WIN32_WINNT
#define WINVER 0x0501 #define WINVER 0x0501
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501
#endif // CHROMIUM_UNRAR
#if !defined(ZIPSFX) && !defined(CHROMIUM_UNRAR) #if !defined(ZIPSFX)
#define RAR_SMP #define RAR_SMP
#endif #endif
#if !defined(CHROMIUM_UNRAR)
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#endif // CHROMIUM_UNRAR
#include <windows.h> #include <windows.h>
#include <prsht.h> #include <prsht.h>
...@@ -70,11 +65,8 @@ ...@@ -70,11 +65,8 @@
#include <direct.h> #include <direct.h>
#include <intrin.h> #include <intrin.h>
#if !defined(CHROMIUM_UNRAR)
#define USE_SSE #define USE_SSE
#define SSE_ALIGNMENT 16 #define SSE_ALIGNMENT 16
#endif // CHROMIUM_UNRAR
#else #else
#include <dirent.h> #include <dirent.h>
#endif // _MSC_VER #endif // _MSC_VER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment