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

Function GetVolNumPart

Libraries/unrar/pathfn.cpp:318–351  ·  view source on GitHub ↗

Returns a pointer to rightmost digit of volume number or to beginning of file name if numeric part is missing.

Source from the content-addressed store, hash-verified

316// Returns a pointer to rightmost digit of volume number or to beginning
317// of file name if numeric part is missing.
318wchar* GetVolNumPart(const wchar *ArcName)
319{
320 if (*ArcName==0)
321 return (wchar *)ArcName;
322
323 // Pointing to last name character.
324 const wchar *ChPtr=ArcName+wcslen(ArcName)-1;
325
326 // Skipping the archive extension.
327 while (!IsDigit(*ChPtr) && ChPtr>ArcName)
328 ChPtr--;
329
330 // Skipping the numeric part of name.
331 const wchar *NumPtr=ChPtr;
332 while (IsDigit(*NumPtr) && NumPtr>ArcName)
333 NumPtr--;
334
335 // Searching for first numeric part in names like name.part##of##.rar.
336 // Stop search on the first dot.
337 while (NumPtr>ArcName && *NumPtr!='.')
338 {
339 if (IsDigit(*NumPtr))
340 {
341 // Validate the first numeric part only if it has a dot somewhere
342 // before it.
343 wchar *Dot=wcschr(PointToName(ArcName),'.');
344 if (Dot!=NULL && Dot<NumPtr)
345 ChPtr=NumPtr;
346 break;
347 }
348 NumPtr--;
349 }
350 return (wchar *)ChPtr;
351}
352
353
354void NextVolumeName(wchar *ArcName,uint MaxLength,bool OldNumbering)

Callers 4

RestoreMethod · 0.85
RecVolumesTestFunction · 0.85
NextVolumeNameFunction · 0.85
VolNameToFirstNameFunction · 0.85

Calls 2

IsDigitFunction · 0.85
PointToNameFunction · 0.85

Tested by

no test coverage detected