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

Method Test

Libraries/unrar/recvol5.cpp:482–523  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

480
481
482void RecVolumes5::Test(RAROptions *Cmd,const wchar *Name)
483{
484 wchar VolName[NM];
485 wcsncpyz(VolName,Name,ASIZE(VolName));
486
487 uint FoundRecVolumes=0;
488 while (FileExist(VolName))
489 {
490 File CurFile;
491 if (!CurFile.Open(VolName))
492 {
493 ErrHandler.OpenErrorMsg(VolName); // It also sets RARX_OPEN.
494 continue;
495 }
496 if (!uiStartFileExtract(VolName,false,true,false))
497 return;
498 mprintf(St(MExtrTestFile),VolName);
499 mprintf(L" ");
500 bool Valid=false;
501 uint RecNum=ReadHeader(&CurFile,FoundRecVolumes==0);
502 if (RecNum!=0)
503 {
504 FoundRecVolumes++;
505
506 uint RevCRC;
507 CalcFileSum(&CurFile,&RevCRC,NULL,1,INT64NDF,CALCFSUM_CURPOS|(Cmd->DisablePercentage ? 0 : CALCFSUM_SHOWPROGRESS));
508 Valid=RevCRC==RecItems[RecNum].CRC;
509 }
510
511 if (Valid)
512 {
513 mprintf(L"%s%s ",L"\b\b\b\b\b ",St(MOk));
514 }
515 else
516 {
517 uiMsg(UIERROR_CHECKSUM,VolName,VolName);
518 ErrHandler.SetErrorCode(RARX_CRC);
519 }
520
521 NextVolumeName(VolName,ASIZE(VolName),false);
522 }
523}

Callers 1

RecVolumesTestFunction · 0.45

Calls 11

wcsncpyzFunction · 0.85
FileExistFunction · 0.85
StFunction · 0.85
CalcFileSumFunction · 0.85
uiMsgFunction · 0.85
NextVolumeNameFunction · 0.85
OpenErrorMsgMethod · 0.80
SetErrorCodeMethod · 0.80
uiStartFileExtractFunction · 0.70
mprintfFunction · 0.70
OpenMethod · 0.45

Tested by

no test coverage detected