aboutsummaryrefslogtreecommitdiffstats
path: root/chromium/chromium/chromium-stub-unrar-wrapper.patch
blob: e97e47cebb57885da1f6bbd8d27b34b54cf59c9b (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
153
154
155
156
157
158
159
160
161
162
163
164
diff --git a/third_party/unrar/BUILD.gn b/third_party/unrar/BUILD.gn
index 97f4e0460ad7c..0d665e199e4b4 100644
--- a/third_party/unrar/BUILD.gn
+++ b/third_party/unrar/BUILD.gn
@@ -25,53 +25,6 @@ static_library("unrar") {
   sources = [
     "google/unrar_wrapper.cc",
     "google/unrar_wrapper.h",
-    "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/volume.cpp",
   ]
   if (is_win) {
     sources += [ "src/isnt.cpp" ]
diff --git a/third_party/unrar/google/unrar_wrapper.cc b/third_party/unrar/google/unrar_wrapper.cc
index 1b777d2275099..135ba83abbedd 100644
--- a/third_party/unrar/google/unrar_wrapper.cc
+++ b/third_party/unrar/google/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,75 +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");
-  if (!open_success)
-    return false;
-
-  bool is_valid_archive = archive_->IsArchive(/*EnableBroken=*/true);
-  if (!is_valid_archive)
-    return false;
-
-  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 =
-          current_entry_.is_directory ? 0 : extractor_->GetCurrentFileSize();
-
-      if (success) {
-        return true;
-      }
-
-      if (archive_->FileHead.Encrypted) {
-        // Since Chromium doesn't have the password, manually skip over the
-        // encrypted data and fill in the metadata we do have.
-        archive_->SeekToNext();
-        return true;
-      }
-
-      if (extractor_->IsMissingNextVolume()) {
-        // Since Chromium doesn't have the next volume, manually skip over this
-        // file, but report the metadata we do have.
-        archive_->SeekToNext();
-        return true;
-      }
-    }
-  }
-
   return false;
 }
 
diff --git a/third_party/unrar/google/unrar_wrapper.h b/third_party/unrar/google/unrar_wrapper.h
index 9e5a08bf092b0..01a1f7b023e4c 100644
--- a/third_party/unrar/google/unrar_wrapper.h
+++ b/third_party/unrar/google/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 {