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") {
"zip_file_creator.h",
]
}
#TODO(crbug/750327): This dependency is here temporarily.
deps = [ "//third_party/unrar:unrar" ]
public_deps += [ "//chrome/common/safe_browsing" ]
}
}
......
......@@ -2,83 +2,59 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/features.gni")
static_library("unrar") {
deps = []
if (safe_browsing_mode == 1) {
static_library("unrar") {
sources = [
"src/archive.cpp",
"src/arcread.cpp",
"src/blake2s.cpp",
"src/cmddata.cpp",
"src/consio.cpp",
"src/crc.cpp",
"src/crypt.cpp",
"src/encname.cpp",
"src/errhnd.cpp",
"src/extinfo.cpp",
"src/extract.cpp",
"src/filcreat.cpp",
"src/file.cpp",
"src/filefn.cpp",
"src/filestr.cpp",
"src/find.cpp",
"src/getbits.cpp",
"src/global.cpp",
"src/hash.cpp",
"src/headers.cpp",
"src/isnt.cpp",
"src/list.cpp",
"src/match.cpp",
"src/options.cpp",
"src/pathfn.cpp",
"src/qopen.cpp",
"src/rar.cpp",
"src/rarvm.cpp",
"src/rawread.cpp",
"src/rdwrfn.cpp",
"src/resource.cpp",
"src/rijndael.cpp",
"src/rs16.cpp",
"src/scantree.cpp",
"src/secpassword.cpp",
"src/sha1.cpp",
"src/sha256.cpp",
"src/smallfn.cpp",
"src/strfn.cpp",
"src/strlist.cpp",
"src/system.cpp",
"src/threadpool.cpp",
"src/timefn.cpp",
"src/ui.cpp",
"src/unicode.cpp",
"src/unpack.cpp",
"src/volume.cpp",
]
sources = [
"src/archive.cpp",
"src/arcread.cpp",
"src/blake2s.cpp",
"src/cmddata.cpp",
"src/consio.cpp",
"src/crc.cpp",
"src/crypt.cpp",
"src/dll.cpp",
"src/encname.cpp",
"src/errhnd.cpp",
"src/extinfo.cpp",
"src/extract.cpp",
"src/filcreat.cpp",
"src/file.cpp",
"src/filefn.cpp",
"src/filestr.cpp",
"src/find.cpp",
"src/getbits.cpp",
"src/global.cpp",
"src/hash.cpp",
"src/headers.cpp",
"src/isnt.cpp",
"src/list.cpp",
"src/match.cpp",
"src/options.cpp",
"src/pathfn.cpp",
"src/qopen.cpp",
"src/rar.cpp",
"src/rarvm.cpp",
"src/rawread.cpp",
"src/rdwrfn.cpp",
"src/resource.cpp",
"src/rijndael.cpp",
"src/rs16.cpp",
"src/scantree.cpp",
"src/secpassword.cpp",
"src/sha1.cpp",
"src/sha256.cpp",
"src/smallfn.cpp",
"src/strfn.cpp",
"src/strlist.cpp",
"src/system.cpp",
"src/threadpool.cpp",
"src/timefn.cpp",
"src/ui.cpp",
"src/unicode.cpp",
"src/unpack.cpp",
"src/volume.cpp",
]
configs -= [
"//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"
]
}
defines = [ "_FILE_OFFSET_BITS=64", "LARGEFILE_SOURCE", "RAR_SMP" ]
}
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
#include "versionhelpers.h"
DWORD WinNT()
{
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;
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;
}
#endif
#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,
......@@ -11,6 +9,5 @@ enum WINNT_VERSION {
DWORD WinNT();
#endif
#endif
......@@ -23,22 +23,17 @@
#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) && !defined(CHROMIUM_UNRAR)
#if !defined(ZIPSFX)
#define RAR_SMP
#endif
#if !defined(CHROMIUM_UNRAR)
#define WIN32_LEAN_AND_MEAN
#endif // CHROMIUM_UNRAR
#include <windows.h>
#include <prsht.h>
......@@ -70,11 +65,8 @@
#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
......
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