Returns a pointer to rightmost digit of volume number or to beginning of file name if numeric part is missing.
| 316 | // Returns a pointer to rightmost digit of volume number or to beginning |
| 317 | // of file name if numeric part is missing. |
| 318 | wchar* 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 | |
| 354 | void NextVolumeName(wchar *ArcName,uint MaxLength,bool OldNumbering) |
no test coverage detected