@@ -268,14 +268,14 @@ size_t Archive::ReadHeader15()
268268 uint FileTime=Raw.Get4 ();
269269 hd->UnpVer =Raw.Get1 ();
270270
271- // RAR15 did not use the special dictionary size to mark dirs.
272- if (hd->UnpVer <20 && (hd->FileAttr & 0x10 )!=0 )
273- hd->Dir =true ;
274-
275271 hd->Method =Raw.Get1 ()-0x30 ;
276272 size_t NameSize=Raw.Get2 ();
277273 hd->FileAttr =Raw.Get4 ();
278274
275+ // RAR15 did not use the special dictionary size to mark dirs.
276+ if (hd->UnpVer <20 && (hd->FileAttr & 0x10 )!=0 )
277+ hd->Dir =true ;
278+
279279 hd->CryptMethod =CRYPT_NONE;
280280 if (hd->Encrypted )
281281 switch (hd->UnpVer )
@@ -402,8 +402,8 @@ size_t Archive::ReadHeader15()
402402 if (rmode & 4 )
403403 rlt.Second ++;
404404 rlt.Reminder =0 ;
405- int count=rmode&3 ;
406- for (int J=0 ;J<count;J++)
405+ uint count=rmode&3 ;
406+ for (uint J=0 ;J<count;J++)
407407 {
408408 byte CurByte=Raw.Get1 ();
409409 rlt.Reminder |=(((uint)CurByte)<<((J+3 -count)*8 ));
@@ -521,7 +521,6 @@ size_t Archive::ReadHeader15()
521521 {
522522 // Last 7 bytes of recovered volume can contain zeroes, because
523523 // REV files store its own information (volume number, etc.) here.
524- SaveFilePos SavePos (*this );
525524 int64 Length=Tell ();
526525 Seek (Length-7 ,SEEK_SET);
527526 Recovered=true ;
@@ -584,7 +583,7 @@ size_t Archive::ReadHeader50()
584583 {
585584 // This message is used by Android GUI to reset cached passwords.
586585 // Update appropriate code if changed.
587- uiMsg (UIERROR_BADPSW,FileName);
586+ uiMsg (UIERROR_BADPSW,FileName,FileName );
588587 FailedHeaderDecryption=true ;
589588 ErrHandler.SetErrorCode (RARX_BADPWD);
590589 return 0 ;
@@ -593,7 +592,7 @@ size_t Archive::ReadHeader50()
593592 {
594593 // This message is used by Android GUI and Windows GUI and SFX to
595594 // reset cached passwords. Update appropriate code if changed.
596- uiMsg (UIWAIT_BADPSW,FileName);
595+ uiMsg (UIWAIT_BADPSW,FileName,FileName );
597596 Cmd->Password .Clean ();
598597 }
599598
@@ -720,6 +719,7 @@ size_t Archive::ReadHeader50()
720719 UnkEncVerMsg (FileName,Info);
721720 return 0 ;
722721 }
722+
723723 Raw.GetB (CryptHead.Salt ,SIZE_SALT50);
724724 if (CryptHead.UsePswCheck )
725725 {
@@ -1256,11 +1256,13 @@ size_t Archive::ReadHeader14()
12561256 Raw.Read (NameSize);
12571257
12581258 char FileName[NM];
1259- Raw.GetB ((byte *)FileName,Min (NameSize,ASIZE (FileName)));
1260- FileName[NameSize]=0 ;
1259+ size_t ReadNameSize=Min (NameSize,ASIZE (FileName)-1 );
1260+ Raw.GetB ((byte *)FileName,ReadNameSize);
1261+ FileName[ReadNameSize]=0 ;
12611262 IntToExt (FileName,FileName,ASIZE (FileName));
12621263 CharToWide (FileName,FileHead.FileName ,ASIZE (FileHead.FileName ));
12631264 ConvertNameCase (FileHead.FileName );
1265+ ConvertFileHeader (&FileHead);
12641266
12651267 if (Raw.Size ()!=0 )
12661268 NextBlockPos=CurBlockPos+FileHead.HeadSize +FileHead.PackSize ;
@@ -1414,7 +1416,7 @@ int64 Archive::GetStartPos()
14141416}
14151417
14161418
1417- bool Archive::ReadSubData (Array<byte> *UnpData,File *DestFile)
1419+ bool Archive::ReadSubData (Array<byte> *UnpData,File *DestFile, bool TestMode )
14181420{
14191421 if (BrokenHeader)
14201422 {
@@ -1462,6 +1464,7 @@ bool Archive::ReadSubData(Array<byte> *UnpData,File *DestFile)
14621464 SubDataIO.SetPackedSizeToRead (SubHead.PackSize );
14631465 SubDataIO.EnableShowProgress (false );
14641466 SubDataIO.SetFiles (this ,DestFile);
1467+ SubDataIO.SetTestMode (TestMode);
14651468 SubDataIO.UnpVolume =SubHead.SplitAfter ;
14661469 SubDataIO.SetSubHeader (&SubHead,NULL );
14671470 Unpack.SetDestSize (SubHead.UnpSize );
0 commit comments