MCPcopy Create free account
hub / github.com/abbeycode/UnrarKit / ExtractArchive

Method ExtractArchive

Libraries/unrar/extract.cpp:104–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104EXTRACT_ARC_CODE CmdExtract::ExtractArchive()
105{
106 Archive Arc(Cmd);
107 if (!Arc.WOpen(ArcName))
108 return EXTRACT_ARC_NEXT;
109
110 if (!Arc.IsArchive(true))
111 {
112#if !defined(SFX_MODULE) && !defined(RARDLL)
113 if (CmpExt(ArcName,L"rev"))
114 {
115 wchar FirstVolName[NM];
116 VolNameToFirstName(ArcName,FirstVolName,ASIZE(FirstVolName),true);
117
118 // If several volume names from same volume set are specified
119 // and current volume is not first in set and first volume is present
120 // and specified too, let's skip the current volume.
121 if (wcsicomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
122 Cmd->ArcNames.Search(FirstVolName,false))
123 return EXTRACT_ARC_NEXT;
124 RecVolumesTest(Cmd,NULL,ArcName);
125 TotalFileCount++; // Suppress "No files to extract" message.
126 return EXTRACT_ARC_NEXT;
127 }
128#endif
129
130 mprintf(St(MNotRAR),ArcName);
131
132#ifndef SFX_MODULE
133 if (CmpExt(ArcName,L"rar"))
134#endif
135 ErrHandler.SetErrorCode(RARX_WARNING);
136 return EXTRACT_ARC_NEXT;
137 }
138
139 if (Arc.FailedHeaderDecryption) // Bad archive password.
140 return EXTRACT_ARC_NEXT;
141
142#ifndef SFX_MODULE
143 if (Arc.Volume && !Arc.FirstVolume)
144 {
145 wchar FirstVolName[NM];
146 VolNameToFirstName(ArcName,FirstVolName,ASIZE(FirstVolName),Arc.NewNumbering);
147
148 // If several volume names from same volume set are specified
149 // and current volume is not first in set and first volume is present
150 // and specified too, let's skip the current volume.
151 if (wcsicomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
152 Cmd->ArcNames.Search(FirstVolName,false))
153 return EXTRACT_ARC_NEXT;
154 }
155#endif
156
157 int64 VolumeSetSize=0; // Total size of volumes after the current volume.
158
159 if (Arc.Volume)
160 {
161 // Calculate the total size of all accessible volumes.

Callers

nothing calls this directly

Calls 15

CmpExtFunction · 0.85
VolNameToFirstNameFunction · 0.85
wcsicompFunction · 0.85
FileExistFunction · 0.85
RecVolumesTestFunction · 0.85
StFunction · 0.85
wcsncpyzFunction · 0.85
NextVolumeNameFunction · 0.85
WOpenMethod · 0.80
IsArchiveMethod · 0.80
SearchMethod · 0.80
SetErrorCodeMethod · 0.80

Tested by

no test coverage detected