aboutsummaryrefslogtreecommitdiffstats
path: root/chromium/chromium/chromium-stub-unrar-wrapper.patch
blob: b33ac972142ed7c8a1960e22e61d1c0c01d68978 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
diff --git a/third_party/unrar/BUILD.gn b/third_party/unrar/BUILD.gn
index 5716ad0e720f..6f60c130561f 100644
--- a/third_party/unrar/BUILD.gn
+++ b/third_party/unrar/BUILD.gn
@@ -23,54 +23,7 @@ config("unrar_warnings") {
 
 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/list.cpp",
-    "src/match.cpp",
-    "src/options.cpp",
-    "src/pathfn.cpp",
-    "src/qopen.cpp",
-    "src/rarvm.cpp",
-    "src/rawread.cpp",
-    "src/rdwrfn.cpp",
-    "src/recvol.cpp",
-    "src/resource.cpp",
-    "src/rijndael.cpp",
-    "src/rs.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/unrar_wrapper.cc",
-    "src/volume.cpp",
   ]
   if (is_win) {
     sources += [ "src/isnt.cpp" ]
diff --git a/third_party/unrar/src/unrar_wrapper.cc b/third_party/unrar/src/unrar_wrapper.cc
index 63b31f008861..6879a2d84988 100644
--- a/third_party/unrar/src/unrar_wrapper.cc
+++ b/third_party/unrar/src/unrar_wrapper.cc
@@ -9,7 +9,6 @@
 #include "base/files/file_path.h"
 #include "base/metrics/histogram_macros.h"
 #include "build/build_config.h"
-#include "third_party/unrar/src/rar.hpp"
 
 namespace third_party_unrar {
 
@@ -18,62 +17,10 @@ RarReader::RarReader() {}
 RarReader::~RarReader() {}
 
 bool RarReader::Open(base::File rar_file, base::File temp_file) {
-  rar_file_ = std::move(rar_file);
-  temp_file_ = std::move(temp_file);
-
-  archive_ = std::make_unique<Archive>();
-  archive_->SetFileHandle(rar_file_.GetPlatformFile());
-  archive_->SetTempFileHandle(temp_file_.GetPlatformFile());
-
-  bool open_success = archive_->Open(L"dummy.rar");
-  UMA_HISTOGRAM_BOOLEAN("SBClientDownload.RarOpenSuccess", open_success);
-  if (!open_success)
-    return false;
-
-  bool is_valid_archive = archive_->IsArchive(/*EnableBroken=*/true);
-  UMA_HISTOGRAM_BOOLEAN("SBClientDownload.RarValidArchive", is_valid_archive);
-  if (!is_valid_archive)
-    return false;
-
-  UMA_HISTOGRAM_BOOLEAN("SBClientDownload.RarHeadersEncrypted",
-                        archive_->Encrypted);
-
-  command_ = std::make_unique<CommandData>();
-  command_->ParseArg(const_cast<wchar_t*>(L"-p"));
-  command_->ParseArg(const_cast<wchar_t*>(L"x"));
-  command_->ParseDone();
-
-  extractor_ = std::make_unique<CmdExtract>(command_.get());
-  extractor_->ExtractArchiveInit(*archive_);
-
-  return true;
+  return false;
 }
 
 bool RarReader::ExtractNextEntry() {
-  bool success = true, repeat = true;
-  while (success || repeat) {
-    temp_file_.Seek(base::File::Whence::FROM_BEGIN, 0);
-    temp_file_.SetLength(0);
-    size_t header_size = archive_->ReadHeader();
-    repeat = false;
-    success = extractor_->ExtractCurrentFile(
-        *archive_, header_size, repeat);  // |repeat| is passed by reference
-
-    if (archive_->GetHeaderType() == HEAD_FILE) {
-#if defined(OS_WIN)
-      current_entry_.file_path = base::FilePath(archive_->FileHead.FileName);
-#else
-      std::wstring wide_filename(archive_->FileHead.FileName);
-      std::string filename(wide_filename.begin(), wide_filename.end());
-      current_entry_.file_path = base::FilePath(filename);
-#endif
-      current_entry_.is_directory = archive_->FileHead.Dir;
-      current_entry_.is_encrypted = archive_->FileHead.Encrypted;
-      current_entry_.file_size = extractor_->GetCurrentFileSize();
-      return true;
-    }
-  }
-
   return false;
 }
 
diff --git a/third_party/unrar/src/unrar_wrapper.h b/third_party/unrar/src/unrar_wrapper.h
index 05bf5b256383..b96260c70971 100644
--- a/third_party/unrar/src/unrar_wrapper.h
+++ b/third_party/unrar/src/unrar_wrapper.h
@@ -12,9 +12,9 @@
 
 // Forward declare the unrar symbols needed for extraction, so users of
 // RarReader don't need all the symbols from unrar.
-class Archive;
-class CmdExtract;
-class CommandData;
+class Archive {};
+class CmdExtract {};
+class CommandData {};
 
 namespace third_party_unrar {