_ZN7Archive10GetCommentEP5ArrayIwE:
    4|      1|{
    5|      1|  if (!MainComment)
  ------------------
  |  Branch (5:7): [True: 1, False: 0]
  ------------------
    6|      1|    return false;
    7|      0|  int64 SavePos=Tell();
    8|      0|  bool Success=DoGetComment(CmtData);
    9|      0|  Seek(SavePos,SEEK_SET);
   10|      0|  return Success;
   11|      1|}
_ZN7Archive11ViewCommentEv:
  170|      1|{
  171|      1|  if (Cmd->DisableComment)
  ------------------
  |  Branch (171:7): [True: 0, False: 1]
  ------------------
  172|      0|    return;
  173|      1|  Array<wchar> CmtBuf;
  174|      1|  if (GetComment(&CmtBuf)) // In GUI too, so "Test" command detects broken comments.
  ------------------
  |  Branch (174:7): [True: 0, False: 1]
  ------------------
  175|      0|  {
  176|      0|    size_t CmtSize=CmtBuf.Size();
  177|      0|    wchar *ChPtr=wcschr(&CmtBuf[0],0x1A);
  178|      0|    if (ChPtr!=NULL)
  ------------------
  |  Branch (178:9): [True: 0, False: 0]
  ------------------
  179|      0|      CmtSize=ChPtr-&CmtBuf[0];
  180|      0|    mprintf(L"\n");
  181|      0|    OutComment(&CmtBuf[0],CmtSize);
  182|      0|  }
  183|      1|}

_ZN7ArchiveC2EP10RAROptions:
    7|      2|{
    8|      2|  Cmd=NULL; // Just in case we'll have an exception in 'new' below.
    9|       |
   10|      2|  DummyCmd=(InitCmd==NULL);
   11|      2|  Cmd=DummyCmd ? (new RAROptions):InitCmd;
  ------------------
  |  Branch (11:7): [True: 0, False: 2]
  ------------------
   12|       |
   13|      2|  OpenShared=Cmd->OpenShared;
   14|      2|  Format=RARFMT15;
   15|      2|  Solid=false;
   16|      2|  Volume=false;
   17|      2|  MainComment=false;
   18|      2|  Locked=false;
   19|      2|  Signed=false;
   20|      2|  FirstVolume=false;
   21|      2|  NewNumbering=false;
   22|      2|  SFXSize=0;
   23|      2|  LatestTime.Reset();
   24|      2|  Protected=false;
   25|      2|  Encrypted=false;
   26|      2|  FailedHeaderDecryption=false;
   27|      2|  BrokenHeader=false;
   28|      2|  LastReadBlock=0;
   29|       |
   30|      2|  CurBlockPos=0;
   31|      2|  NextBlockPos=0;
   32|       |
   33|       |
   34|      2|  memset(&MainHead,0,sizeof(MainHead));
   35|      2|  memset(&CryptHead,0,sizeof(CryptHead));
   36|      2|  memset(&EndArcHead,0,sizeof(EndArcHead));
   37|       |
   38|      2|  VolNumber=0;
   39|      2|  VolWrite=0;
   40|      2|  AddingFilesSize=0;
   41|      2|  AddingHeadersSize=0;
   42|      2|  *FirstVolumeName=0;
   43|       |
   44|      2|  Splitting=false;
   45|      2|  NewArchive=false;
   46|       |
   47|      2|  SilentOpen=false;
   48|       |
   49|      2|#ifdef USE_QOPEN
   50|      2|  ProhibitQOpen=false;
   51|      2|#endif
   52|       |
   53|      2|}
_ZN7ArchiveD2Ev:
   57|      2|{
   58|      2|  if (DummyCmd)
  ------------------
  |  Branch (58:7): [True: 0, False: 2]
  ------------------
   59|      0|    delete Cmd;
   60|      2|}
_ZN7Archive11IsSignatureEPKhm:
  100|      2|{
  101|      2|  RARFORMAT Type=RARFMT_NONE;
  102|      2|  if (Size>=1 && D[0]==0x52)
  ------------------
  |  Branch (102:7): [True: 2, False: 0]
  |  Branch (102:18): [True: 1, False: 1]
  ------------------
  103|      1|#ifndef SFX_MODULE
  104|      1|    if (Size>=4 && D[1]==0x45 && D[2]==0x7e && D[3]==0x5e)
  ------------------
  |  Branch (104:9): [True: 1, False: 0]
  |  Branch (104:20): [True: 0, False: 1]
  |  Branch (104:34): [True: 0, False: 0]
  |  Branch (104:48): [True: 0, False: 0]
  ------------------
  105|      0|      Type=RARFMT14;
  106|      1|    else
  107|      1|#endif
  108|      1|      if (Size>=7 && D[1]==0x61 && D[2]==0x72 && D[3]==0x21 && D[4]==0x1a && D[5]==0x07)
  ------------------
  |  Branch (108:11): [True: 1, False: 0]
  |  Branch (108:22): [True: 1, False: 0]
  |  Branch (108:36): [True: 1, False: 0]
  |  Branch (108:50): [True: 1, False: 0]
  |  Branch (108:64): [True: 1, False: 0]
  |  Branch (108:78): [True: 1, False: 0]
  ------------------
  109|      1|      {
  110|       |        // We check the last signature byte, so we can return a sensible
  111|       |        // warning in case we'll want to change the archive format
  112|       |        // sometimes in the future.
  113|      1|        if (D[6]==0)
  ------------------
  |  Branch (113:13): [True: 0, False: 1]
  ------------------
  114|      0|          Type=RARFMT15;
  115|      1|        else
  116|      1|          if (D[6]==1)
  ------------------
  |  Branch (116:15): [True: 1, False: 0]
  ------------------
  117|      1|            Type=RARFMT50;
  118|      0|          else
  119|      0|            if (D[6]>1 && D[6]<5)
  ------------------
  |  Branch (119:17): [True: 0, False: 0]
  |  Branch (119:27): [True: 0, False: 0]
  ------------------
  120|      0|              Type=RARFMT_FUTURE;
  121|      1|      }
  122|      2|  return Type;
  123|      2|}
_ZN7Archive9IsArchiveEb:
  127|      2|{
  128|      2|  Encrypted=false;
  129|      2|  BrokenHeader=false; // Might be left from previous volume.
  130|       |  
  131|      2|#ifndef SFX_MODULE
  132|      2|  if (IsDevice())
  ------------------
  |  Branch (132:7): [True: 0, False: 2]
  ------------------
  133|      0|  {
  134|      0|    uiMsg(UIERROR_INVALIDNAME,FileName,FileName);
  135|      0|    return false;
  136|      0|  }
  137|      2|#endif
  138|      2|  if (Read(MarkHead.Mark,SIZEOF_MARKHEAD3)!=SIZEOF_MARKHEAD3)
  ------------------
  |  |    4|      2|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
                if (Read(MarkHead.Mark,SIZEOF_MARKHEAD3)!=SIZEOF_MARKHEAD3)
  ------------------
  |  |    4|      2|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
  |  Branch (138:7): [True: 1, False: 1]
  ------------------
  139|      1|    return false;
  140|      1|  SFXSize=0;
  141|       |  
  142|      1|  RARFORMAT Type;
  143|      1|  if ((Type=IsSignature(MarkHead.Mark,SIZEOF_MARKHEAD3))!=RARFMT_NONE)
  ------------------
  |  |    4|      1|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
  |  Branch (143:7): [True: 0, False: 1]
  ------------------
  144|      0|  {
  145|      0|    Format=Type;
  146|      0|    if (Format==RARFMT14)
  ------------------
  |  Branch (146:9): [True: 0, False: 0]
  ------------------
  147|      0|      Seek(Tell()-SIZEOF_MARKHEAD3,SEEK_SET);
  ------------------
  |  |    4|      0|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
  148|      0|  }
  149|      1|  else
  150|      1|  {
  151|      1|    Array<char> Buffer(MAXSFXSIZE);
  ------------------
  |  |   16|      1|#define  MAXSFXSIZE        0x200000
  ------------------
  152|      1|    long CurPos=(long)Tell();
  153|      1|    int ReadSize=Read(&Buffer[0],Buffer.Size()-16);
  154|      2|    for (int I=0;I<ReadSize;I++)
  ------------------
  |  Branch (154:18): [True: 2, False: 0]
  ------------------
  155|      2|      if (Buffer[I]==0x52 && (Type=IsSignature((byte *)&Buffer[I],ReadSize-I))!=RARFMT_NONE)
  ------------------
  |  Branch (155:11): [True: 1, False: 1]
  |  Branch (155:30): [True: 1, False: 0]
  ------------------
  156|      1|      {
  157|      1|        Format=Type;
  158|      1|        if (Format==RARFMT14 && I>0 && CurPos<28 && ReadSize>31)
  ------------------
  |  Branch (158:13): [True: 0, False: 1]
  |  Branch (158:33): [True: 0, False: 0]
  |  Branch (158:40): [True: 0, False: 0]
  |  Branch (158:53): [True: 0, False: 0]
  ------------------
  159|      0|        {
  160|      0|          char *D=&Buffer[28-CurPos];
  161|      0|          if (D[0]!=0x52 || D[1]!=0x53 || D[2]!=0x46 || D[3]!=0x58)
  ------------------
  |  Branch (161:15): [True: 0, False: 0]
  |  Branch (161:29): [True: 0, False: 0]
  |  Branch (161:43): [True: 0, False: 0]
  |  Branch (161:57): [True: 0, False: 0]
  ------------------
  162|      0|            continue;
  163|      0|        }
  164|      1|        SFXSize=CurPos+I;
  165|      1|        Seek(SFXSize,SEEK_SET);
  166|      1|        if (Format==RARFMT15 || Format==RARFMT50)
  ------------------
  |  Branch (166:13): [True: 0, False: 1]
  |  Branch (166:33): [True: 1, False: 0]
  ------------------
  167|      1|          Read(MarkHead.Mark,SIZEOF_MARKHEAD3);
  ------------------
  |  |    4|      1|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
  168|      1|        break;
  169|      1|      }
  170|      1|    if (SFXSize==0)
  ------------------
  |  Branch (170:9): [True: 0, False: 1]
  ------------------
  171|      0|      return false;
  172|      1|  }
  173|      1|  if (Format==RARFMT_FUTURE)
  ------------------
  |  Branch (173:7): [True: 0, False: 1]
  ------------------
  174|      0|  {
  175|      0|    uiMsg(UIERROR_NEWRARFORMAT,FileName);
  176|      0|    return false;
  177|      0|  }
  178|      1|  if (Format==RARFMT50) // RAR 5.0 signature is by one byte longer.
  ------------------
  |  Branch (178:7): [True: 1, False: 0]
  ------------------
  179|      1|  {
  180|      1|    if (Read(MarkHead.Mark+SIZEOF_MARKHEAD3,1)!=1 || MarkHead.Mark[SIZEOF_MARKHEAD3]!=0)
  ------------------
  |  |    4|      1|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
                  if (Read(MarkHead.Mark+SIZEOF_MARKHEAD3,1)!=1 || MarkHead.Mark[SIZEOF_MARKHEAD3]!=0)
  ------------------
  |  |    4|      1|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
  |  Branch (180:9): [True: 0, False: 1]
  |  Branch (180:54): [True: 0, False: 1]
  ------------------
  181|      0|      return false;
  182|      1|    MarkHead.HeadSize=SIZEOF_MARKHEAD5;
  ------------------
  |  |    4|      1|#define  SIZEOF_MARKHEAD5        8  // RAR 5.0 signature length.
  ------------------
  183|      1|  }
  184|      0|  else
  185|      0|    MarkHead.HeadSize=SIZEOF_MARKHEAD3;
  ------------------
  |  |    4|      0|#define  SIZEOF_MARKHEAD3        7 // Size of RAR 4.x archive mark header.
  ------------------
  186|       |
  187|      1|#ifdef RARDLL
  188|       |  // If callback function is not set, we cannot get the password,
  189|       |  // so we skip the initial header processing for encrypted header archive.
  190|       |  // It leads to skipped archive comment, but the rest of archive data
  191|       |  // is processed correctly.
  192|      1|  if (Cmd->Callback==NULL)
  ------------------
  |  Branch (192:7): [True: 1, False: 0]
  ------------------
  193|      1|    SilentOpen=true;
  194|      1|#endif
  195|       |
  196|      1|  bool HeadersLeft; // Any headers left to read.
  197|      1|  bool StartFound=false; // Main or encryption headers found.
  198|       |  // Skip the archive encryption header if any and read the main header.
  199|      1|  while ((HeadersLeft=(ReadHeader()!=0))==true) // Additional parentheses to silence Clang.
  ------------------
  |  Branch (199:10): [True: 0, False: 1]
  ------------------
  200|      0|  {
  201|      0|    SeekToNext();
  202|       |
  203|      0|    HEADER_TYPE Type=GetHeaderType();
  204|       |    // In RAR 5.0 we need to quit after reading HEAD_CRYPT if we wish to
  205|       |    // avoid the password prompt.
  206|      0|    StartFound=Type==HEAD_MAIN || SilentOpen && Type==HEAD_CRYPT;
  ------------------
  |  Branch (206:16): [True: 0, False: 0]
  |  Branch (206:35): [True: 0, False: 0]
  |  Branch (206:49): [True: 0, False: 0]
  ------------------
  207|      0|    if (StartFound)
  ------------------
  |  Branch (207:9): [True: 0, False: 0]
  ------------------
  208|      0|      break;
  209|      0|  }
  210|       |
  211|       |  
  212|       |  // We should not do it for EnableBroken or we'll get 'not RAR archive'
  213|       |  // messages when extracting encrypted archives with wrong password.
  214|      1|  if (FailedHeaderDecryption && !EnableBroken)
  ------------------
  |  Branch (214:7): [True: 0, False: 1]
  |  Branch (214:33): [True: 0, False: 0]
  ------------------
  215|      0|    return false;
  216|       |
  217|      1|  if (BrokenHeader || !StartFound) // Main archive header is corrupt or missing.
  ------------------
  |  Branch (217:7): [True: 1, False: 0]
  |  Branch (217:23): [True: 0, False: 0]
  ------------------
  218|      1|  {
  219|      1|    if (!FailedHeaderDecryption) // If not reported a wrong password already.
  ------------------
  |  Branch (219:9): [True: 1, False: 0]
  ------------------
  220|      1|      uiMsg(UIERROR_MHEADERBROKEN,FileName);
  221|      1|    if (!EnableBroken)
  ------------------
  |  Branch (221:9): [True: 0, False: 1]
  ------------------
  222|      0|      return false;
  223|      1|  }
  224|       |
  225|      1|  MainComment=MainHead.CommentInHeader;
  226|       |
  227|       |  // If we process non-encrypted archive or can request a password,
  228|       |  // we set 'first volume' flag based on file attributes below.
  229|       |  // It is necessary for RAR 2.x archives, which did not have 'first volume'
  230|       |  // flag in main header. Also for all RAR formats we need to scan until
  231|       |  // first file header to set "comment" flag when reading service header.
  232|       |  // Unless we are in silent mode, we need to know about presence of comment
  233|       |  // immediately after IsArchive call.
  234|      1|  if (HeadersLeft && (!SilentOpen || !Encrypted) && IsSeekable())
  ------------------
  |  Branch (234:7): [True: 0, False: 1]
  |  Branch (234:23): [True: 0, False: 0]
  |  Branch (234:38): [True: 0, False: 0]
  |  Branch (234:53): [True: 0, False: 0]
  ------------------
  235|      0|  {
  236|      0|    int64 SavePos=Tell();
  237|      0|    int64 SaveCurBlockPos=CurBlockPos,SaveNextBlockPos=NextBlockPos;
  238|      0|    HEADER_TYPE SaveCurHeaderType=CurHeaderType;
  239|       |
  240|      0|    while (ReadHeader()!=0)
  ------------------
  |  Branch (240:12): [True: 0, False: 0]
  ------------------
  241|      0|    {
  242|      0|      HEADER_TYPE HeaderType=GetHeaderType();
  243|      0|      if (HeaderType==HEAD_SERVICE)
  ------------------
  |  Branch (243:11): [True: 0, False: 0]
  ------------------
  244|      0|      {
  245|       |        // If we have a split service headers, it surely indicates non-first
  246|       |        // volume. But not split service header does not guarantee the first
  247|       |        // volume, because we can have split file after non-split archive
  248|       |        // comment. So we do not quit from loop here.
  249|      0|        FirstVolume=Volume && !SubHead.SplitBefore;
  ------------------
  |  Branch (249:21): [True: 0, False: 0]
  |  Branch (249:31): [True: 0, False: 0]
  ------------------
  250|      0|      }
  251|      0|      else
  252|      0|        if (HeaderType==HEAD_FILE)
  ------------------
  |  Branch (252:13): [True: 0, False: 0]
  ------------------
  253|      0|        {
  254|      0|          FirstVolume=Volume && !FileHead.SplitBefore;
  ------------------
  |  Branch (254:23): [True: 0, False: 0]
  |  Branch (254:33): [True: 0, False: 0]
  ------------------
  255|      0|          break;
  256|      0|        }
  257|      0|        else
  258|      0|          if (HeaderType==HEAD_ENDARC) // Might happen if archive contains only a split service header.
  ------------------
  |  Branch (258:15): [True: 0, False: 0]
  ------------------
  259|      0|            break;
  260|      0|      SeekToNext();
  261|      0|    }
  262|      0|    CurBlockPos=SaveCurBlockPos;
  263|      0|    NextBlockPos=SaveNextBlockPos;
  264|      0|    CurHeaderType=SaveCurHeaderType;
  265|      0|    Seek(SavePos,SEEK_SET);
  266|      0|  }
  267|      1|  if (!Volume || FirstVolume)
  ------------------
  |  Branch (267:7): [True: 1, False: 0]
  |  Branch (267:18): [True: 0, False: 0]
  ------------------
  268|      1|    wcsncpyz(FirstVolumeName,FileName,ASIZE(FirstVolumeName));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  269|       |
  270|      1|  return true;
  271|      1|}
_ZN7Archive10SeekToNextEv:
  277|      1|{
  278|      1|  Seek(NextBlockPos,SEEK_SET);
  279|      1|}
_ZN7Archive14FullHeaderSizeEm:
  288|      1|{
  289|      1|  if (Encrypted)
  ------------------
  |  Branch (289:7): [True: 0, False: 1]
  ------------------
  290|      0|  {
  291|      0|    Size = ALIGN_VALUE(Size, CRYPT_BLOCK_SIZE); // Align to encryption block size.
  ------------------
  |  |   29|      0|#define ALIGN_VALUE(v,a) (size_t(v) + ( (~size_t(v) + 1) & (a - 1) ) )
  ------------------
  292|      0|    if (Format == RARFMT50)
  ------------------
  |  Branch (292:9): [True: 0, False: 0]
  ------------------
  293|      0|      Size += SIZE_INITV;
  ------------------
  |  |   11|      0|#define SIZE_INITV               16
  ------------------
  294|      0|    else
  295|      0|      Size += SIZE_SALT30;
  ------------------
  |  |   10|      0|#define SIZE_SALT30               8
  ------------------
  296|      0|  }
  297|      1|  return uint(Size);
  298|      1|}
_ZN7Archive4OpenEPKwj:
  305|      2|{
  306|       |  // Important if we reuse Archive object and it has virtual QOpen
  307|       |  // file position not matching real. For example, for 'l -v volname'.
  308|      2|  QOpen.Unload();
  309|       |
  310|      2|  return File::Open(Name,Mode);
  311|      2|}
_ZN7Archive4ReadEPvm:
  315|      9|{
  316|      9|  size_t Result;
  317|      9|  if (QOpen.Read(Data,Size,Result))
  ------------------
  |  Branch (317:7): [True: 0, False: 9]
  ------------------
  318|      0|    return (int)Result;
  319|      9|  return File::Read(Data,Size);
  320|      9|}
_ZN7Archive4SeekEli:
  324|      7|{
  325|      7|  if (!QOpen.Seek(Offset,Method))
  ------------------
  |  Branch (325:7): [True: 7, False: 0]
  ------------------
  326|      7|    File::Seek(Offset,Method);
  327|      7|}
_ZN7Archive4TellEv:
  331|      8|{
  332|      8|  int64 QPos;
  333|      8|  if (QOpen.Tell(&QPos))
  ------------------
  |  Branch (333:7): [True: 0, False: 8]
  ------------------
  334|      0|    return QPos;
  335|      8|  return File::Tell();
  336|      8|}

_ZN7Archive13GetHeaderTypeEv:
   85|      1|    HEADER_TYPE GetHeaderType() {return CurHeaderType;}

_ZN7Archive10ReadHeaderEv:
    4|      3|{
    5|       |  // Once we failed to decrypt an encrypted block, there is no reason to
    6|       |  // attempt to do it further. We'll never be successful and only generate
    7|       |  // endless errors.
    8|      3|  if (FailedHeaderDecryption)
  ------------------
  |  Branch (8:7): [True: 0, False: 3]
  ------------------
    9|      0|    return 0;
   10|       |
   11|      3|  CurBlockPos=Tell();
   12|       |
   13|       |  // Other developers asked us to initialize it to suppress "may be used
   14|       |  // uninitialized" warning in code below in some compilers.
   15|      3|  size_t ReadSize=0;
   16|       |
   17|      3|  switch(Format)
  ------------------
  |  Branch (17:10): [True: 0, False: 3]
  ------------------
   18|      3|  {
   19|      0|#ifndef SFX_MODULE
   20|      0|    case RARFMT14:
  ------------------
  |  Branch (20:5): [True: 0, False: 3]
  ------------------
   21|      0|      ReadSize=ReadHeader14();
   22|      0|      break;
   23|      0|#endif
   24|      0|    case RARFMT15:
  ------------------
  |  Branch (24:5): [True: 0, False: 3]
  ------------------
   25|      0|      ReadSize=ReadHeader15();
   26|      0|      break;
   27|      3|    case RARFMT50:
  ------------------
  |  Branch (27:5): [True: 3, False: 0]
  ------------------
   28|      3|      ReadSize=ReadHeader50();
   29|      3|      break;
   30|      3|  }
   31|       |
   32|       |  // It is important to check ReadSize>0 here, because it is normal
   33|       |  // for RAR2 and RAR3 archives without end of archive block to have
   34|       |  // NextBlockPos==CurBlockPos after the end of archive has reached.
   35|      3|  if (ReadSize>0 && NextBlockPos<=CurBlockPos)
  ------------------
  |  Branch (35:7): [True: 1, False: 2]
  |  Branch (35:21): [True: 0, False: 1]
  ------------------
   36|      0|  {
   37|      0|    BrokenHeaderMsg();
   38|      0|    ReadSize=0;
   39|      0|  }
   40|       |
   41|      3|  if (ReadSize==0)
  ------------------
  |  Branch (41:7): [True: 2, False: 1]
  ------------------
   42|      2|    CurHeaderType=HEAD_UNKNOWN;
   43|       |
   44|      3|  return ReadSize;
   45|      3|}
_ZN7Archive14UnexpEndArcMsgEv:
   97|      1|{
   98|      1|  int64 ArcSize=FileLength();
   99|       |
  100|       |  // If block positions are equal to file size, this is not an error.
  101|       |  // It can happen when we reached the end of older RAR 1.5 archive,
  102|       |  // which did not have the end of archive block.
  103|      1|  if (CurBlockPos!=ArcSize || NextBlockPos!=ArcSize)
  ------------------
  |  Branch (103:7): [True: 1, False: 0]
  |  Branch (103:31): [True: 0, False: 0]
  ------------------
  104|      1|  {
  105|      1|    uiMsg(UIERROR_UNEXPEOF,FileName);
  106|      1|    ErrHandler.SetErrorCode(RARX_WARNING);
  107|      1|  }
  108|      1|}
_ZN7Archive15BrokenHeaderMsgEv:
  112|      2|{
  113|      2|  uiMsg(UIERROR_HEADERBROKEN,FileName);
  114|      2|  BrokenHeader=true;
  115|      2|  ErrHandler.SetErrorCode(RARX_CRC);
  116|      2|}
_ZN7Archive12ReadHeader50Ev:
  550|      3|{
  551|      3|  RawRead Raw(this);
  552|       |
  553|      3|  bool Decrypt=Encrypted && CurBlockPos>(int64)SFXSize+SIZEOF_MARKHEAD5;
  ------------------
  |  |    4|      0|#define  SIZEOF_MARKHEAD5        8  // RAR 5.0 signature length.
  ------------------
  |  Branch (553:16): [True: 0, False: 3]
  |  Branch (553:29): [True: 0, False: 0]
  ------------------
  554|       |
  555|      3|  if (Decrypt)
  ------------------
  |  Branch (555:7): [True: 0, False: 3]
  ------------------
  556|      0|  {
  557|       |#if defined(RAR_NOCRYPT)
  558|       |    return 0;
  559|       |#else
  560|       |
  561|      0|    if (Cmd->SkipEncrypted)
  ------------------
  |  Branch (561:9): [True: 0, False: 0]
  ------------------
  562|      0|    {
  563|      0|      uiMsg(UIMSG_SKIPENCARC,FileName);
  564|      0|      FailedHeaderDecryption=true; // Suppress error messages and quit quietly.
  565|      0|      return 0;
  566|      0|    }
  567|       |
  568|      0|    byte HeadersInitV[SIZE_INITV];
  569|      0|    if (Read(HeadersInitV,SIZE_INITV)!=SIZE_INITV)
  ------------------
  |  |   11|      0|#define SIZE_INITV               16
  ------------------
                  if (Read(HeadersInitV,SIZE_INITV)!=SIZE_INITV)
  ------------------
  |  |   11|      0|#define SIZE_INITV               16
  ------------------
  |  Branch (569:9): [True: 0, False: 0]
  ------------------
  570|      0|    {
  571|      0|      UnexpEndArcMsg();
  572|      0|      return 0;
  573|      0|    }
  574|       |
  575|       |    // We repeat the password request only for manually entered passwords
  576|       |    // and not for -p<pwd>. Wrong password can be intentionally provided
  577|       |    // in -p<pwd> to not stop batch processing for encrypted archives.
  578|      0|    bool GlobalPassword=Cmd->Password.IsSet() || uiIsGlobalPasswordSet();
  ------------------
  |  Branch (578:25): [True: 0, False: 0]
  |  Branch (578:50): [True: 0, False: 0]
  ------------------
  579|       |
  580|      0|    while (true) // Repeat the password prompt for wrong passwords.
  ------------------
  |  Branch (580:12): [Folded - Ignored]
  ------------------
  581|      0|    {
  582|      0|      RequestArcPassword();
  583|       |
  584|      0|      byte PswCheck[SIZE_PSWCHECK];
  585|      0|      HeadersCrypt.SetCryptKeys(false,CRYPT_RAR50,&Cmd->Password,CryptHead.Salt,HeadersInitV,CryptHead.Lg2Count,NULL,PswCheck);
  586|       |      // Verify password validity.
  587|      0|      if (CryptHead.UsePswCheck && memcmp(PswCheck,CryptHead.PswCheck,SIZE_PSWCHECK)!=0)
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
  |  Branch (587:11): [True: 0, False: 0]
  |  Branch (587:36): [True: 0, False: 0]
  ------------------
  588|      0|      {
  589|      0|        if (GlobalPassword) // For -p<pwd> or Ctrl+P.
  ------------------
  |  Branch (589:13): [True: 0, False: 0]
  ------------------
  590|      0|        {
  591|       |          // This message is used by Android GUI to reset cached passwords.
  592|       |          // Update appropriate code if changed.
  593|      0|          uiMsg(UIERROR_BADPSW,FileName,FileName);
  594|      0|          FailedHeaderDecryption=true;
  595|      0|          ErrHandler.SetErrorCode(RARX_BADPWD);
  596|      0|          return 0;
  597|      0|        }
  598|      0|        else // For passwords entered manually.
  599|      0|        {
  600|       |          // This message is used by Android GUI and Windows GUI and SFX to
  601|       |          // reset cached passwords. Update appropriate code if changed.
  602|      0|          uiMsg(UIWAIT_BADPSW,FileName,FileName);
  603|      0|          Cmd->Password.Clean();
  604|      0|        }
  605|       |
  606|      0|#ifdef RARDLL
  607|       |        // Avoid new requests for unrar.dll to prevent the infinite loop
  608|       |        // if app always returns the same password.
  609|      0|        ErrHandler.SetErrorCode(RARX_BADPWD);
  610|      0|        Cmd->DllError=ERAR_BAD_PASSWORD;
  ------------------
  |  |   21|      0|#define ERAR_BAD_PASSWORD       24
  ------------------
  611|      0|        ErrHandler.Exit(RARX_BADPWD);
  612|       |#else
  613|       |        continue; // Request a password again.
  614|       |#endif
  615|      0|      }
  616|      0|      break;
  617|      0|    }
  618|       |
  619|      0|    Raw.SetCrypt(&HeadersCrypt);
  620|      0|#endif
  621|      0|  }
  622|       |
  623|       |  // Header size must not occupy more than 3 variable length integer bytes
  624|       |  // resulting in 2 MB maximum header size (MAX_HEADER_SIZE_RAR5),
  625|       |  // so here we read 4 byte CRC32 followed by 3 bytes or less of header size.
  626|      3|  const size_t FirstReadSize=7; // Smallest possible block size.
  627|      3|  if (Raw.Read(FirstReadSize)<FirstReadSize)
  ------------------
  |  Branch (627:7): [True: 1, False: 2]
  ------------------
  628|      1|  {
  629|      1|    UnexpEndArcMsg();
  630|      1|    return 0;
  631|      1|  }
  632|       |
  633|      2|  ShortBlock.Reset();
  634|      2|  ShortBlock.HeadCRC=Raw.Get4();
  635|      2|  uint SizeBytes=Raw.GetVSize(4);
  636|      2|  uint64 BlockSize=Raw.GetV();
  637|       |
  638|      2|  if (BlockSize==0 || SizeBytes==0)
  ------------------
  |  Branch (638:7): [True: 1, False: 1]
  |  Branch (638:23): [True: 0, False: 1]
  ------------------
  639|      1|  {
  640|      1|    BrokenHeaderMsg();
  641|      1|    return 0;
  642|      1|  }
  643|       |
  644|      1|  int SizeToRead=int(BlockSize);
  645|      1|  SizeToRead-=FirstReadSize-SizeBytes-4; // Adjust overread size bytes if any.
  646|      1|  uint HeaderSize=4+SizeBytes+(uint)BlockSize;
  647|       |
  648|      1|  if (SizeToRead<0 || HeaderSize<SIZEOF_SHORTBLOCKHEAD5)
  ------------------
  |  |    5|      1|#define  SIZEOF_SHORTBLOCKHEAD5  7  // Smallest RAR 5.0 block size.
  ------------------
  |  Branch (648:7): [True: 0, False: 1]
  |  Branch (648:23): [True: 0, False: 1]
  ------------------
  649|      0|  {
  650|      0|    BrokenHeaderMsg();
  651|      0|    return 0;
  652|      0|  }
  653|       |
  654|      1|  Raw.Read(SizeToRead);
  655|       |
  656|      1|  if (Raw.Size()<HeaderSize)
  ------------------
  |  Branch (656:7): [True: 0, False: 1]
  ------------------
  657|      0|  {
  658|      0|    UnexpEndArcMsg();
  659|      0|    return 0;
  660|      0|  }
  661|       |
  662|      1|  uint HeaderCRC=Raw.GetCRC50();
  663|       |
  664|      1|  ShortBlock.HeaderType=(HEADER_TYPE)Raw.GetV();
  665|      1|  ShortBlock.Flags=(uint)Raw.GetV();
  666|      1|  ShortBlock.SkipIfUnknown=(ShortBlock.Flags & HFL_SKIPIFUNKNOWN)!=0;
  ------------------
  |  |   14|      1|#define HFL_SKIPIFUNKNOWN   0x0004
  ------------------
  667|      1|  ShortBlock.HeadSize=HeaderSize;
  668|       |
  669|      1|  CurHeaderType=ShortBlock.HeaderType;
  670|       |
  671|      1|  bool BadCRC=(ShortBlock.HeadCRC!=HeaderCRC);
  672|      1|  if (BadCRC)
  ------------------
  |  Branch (672:7): [True: 1, False: 0]
  ------------------
  673|      1|  {
  674|      1|    BrokenHeaderMsg(); // Report, but attempt to process.
  675|       |
  676|      1|    BrokenHeader=true;
  677|      1|    ErrHandler.SetErrorCode(RARX_CRC);
  678|       |
  679|      1|    if (Decrypt)
  ------------------
  |  Branch (679:9): [True: 0, False: 1]
  ------------------
  680|      0|    {
  681|      0|      uiMsg(UIERROR_CHECKSUMENC,FileName,FileName);
  682|      0|      FailedHeaderDecryption=true;
  683|      0|      return 0;
  684|      0|    }
  685|      1|  }
  686|       |
  687|      1|  uint64 ExtraSize=0;
  688|      1|  if ((ShortBlock.Flags & HFL_EXTRA)!=0)
  ------------------
  |  |   10|      1|#define HFL_EXTRA           0x0001
  ------------------
  |  Branch (688:7): [True: 1, False: 0]
  ------------------
  689|      1|  {
  690|      1|    ExtraSize=Raw.GetV();
  691|      1|    if (ExtraSize>=ShortBlock.HeadSize)
  ------------------
  |  Branch (691:9): [True: 0, False: 1]
  ------------------
  692|      0|    {
  693|      0|      BrokenHeaderMsg();
  694|      0|      return 0;
  695|      0|    }
  696|      1|  }
  697|       |
  698|      1|  uint64 DataSize=0;
  699|      1|  if ((ShortBlock.Flags & HFL_DATA)!=0)
  ------------------
  |  |   12|      1|#define HFL_DATA            0x0002
  ------------------
  |  Branch (699:7): [True: 1, False: 0]
  ------------------
  700|      1|    DataSize=Raw.GetV();
  701|       |
  702|      1|  NextBlockPos=CurBlockPos+FullHeaderSize(ShortBlock.HeadSize);
  703|       |  // Set to 0 in case of overflow, so end of ReadHeader cares about it.
  704|      1|  NextBlockPos=SafeAdd(NextBlockPos,DataSize,0);
  705|       |
  706|      1|  switch(ShortBlock.HeaderType)
  ------------------
  |  Branch (706:10): [True: 0, False: 1]
  ------------------
  707|      1|  {
  708|      0|    case HEAD_CRYPT:
  ------------------
  |  Branch (708:5): [True: 0, False: 1]
  ------------------
  709|      0|      {
  710|      0|        *(BaseBlock *)&CryptHead=ShortBlock;
  711|      0|        uint CryptVersion=(uint)Raw.GetV();
  712|      0|        if (CryptVersion>CRYPT_VERSION)
  ------------------
  |  |   20|      0|#define CRYPT_VERSION             0 // Supported encryption version.
  ------------------
  |  Branch (712:13): [True: 0, False: 0]
  ------------------
  713|      0|        {
  714|      0|          wchar Info[20];
  715|      0|          swprintf(Info,ASIZE(Info),L"h%u",CryptVersion);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  716|      0|          UnkEncVerMsg(FileName,Info);
  717|      0|          return 0;
  718|      0|        }
  719|      0|        uint EncFlags=(uint)Raw.GetV();
  720|      0|        CryptHead.UsePswCheck=(EncFlags & CHFL_CRYPT_PSWCHECK)!=0;
  ------------------
  |  |   41|      0|#define CHFL_CRYPT_PSWCHECK 0x0001 // Password check data is present.
  ------------------
  721|      0|        CryptHead.Lg2Count=Raw.Get1();
  722|      0|        if (CryptHead.Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX)
  ------------------
  |  |   19|      0|#define CRYPT5_KDF_LG2_COUNT_MAX 24 // LOG2 of maximum accepted iteration count.
  ------------------
  |  Branch (722:13): [True: 0, False: 0]
  ------------------
  723|      0|        {
  724|      0|          wchar Info[20];
  725|      0|          swprintf(Info,ASIZE(Info),L"hc%u",CryptHead.Lg2Count);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  726|      0|          UnkEncVerMsg(FileName,Info);
  727|      0|          return 0;
  728|      0|        }
  729|       |
  730|      0|        Raw.GetB(CryptHead.Salt,SIZE_SALT50);
  ------------------
  |  |    9|      0|#define SIZE_SALT50              16
  ------------------
  731|      0|        if (CryptHead.UsePswCheck)
  ------------------
  |  Branch (731:13): [True: 0, False: 0]
  ------------------
  732|      0|        {
  733|      0|          Raw.GetB(CryptHead.PswCheck,SIZE_PSWCHECK);
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
  734|       |
  735|      0|          byte csum[SIZE_PSWCHECK_CSUM];
  736|      0|          Raw.GetB(csum,SIZE_PSWCHECK_CSUM);
  ------------------
  |  |   13|      0|#define SIZE_PSWCHECK_CSUM        4
  ------------------
  737|       |
  738|      0|          sha256_context ctx;
  739|      0|          sha256_init(&ctx);
  740|      0|          sha256_process(&ctx, CryptHead.PswCheck, SIZE_PSWCHECK);
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
  741|       |
  742|      0|          byte Digest[SHA256_DIGEST_SIZE];
  743|      0|          sha256_done(&ctx, Digest);
  744|       |
  745|      0|          CryptHead.UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0;
  ------------------
  |  |   13|      0|#define SIZE_PSWCHECK_CSUM        4
  ------------------
  746|      0|        }
  747|      0|        Encrypted=true;
  748|      0|      }
  749|      0|      break;
  750|      0|    case HEAD_MAIN:
  ------------------
  |  Branch (750:5): [True: 0, False: 1]
  ------------------
  751|      0|      {
  752|      0|        MainHead.Reset();
  753|      0|        *(BaseBlock *)&MainHead=ShortBlock;
  754|      0|        uint ArcFlags=(uint)Raw.GetV();
  755|       |
  756|      0|        Volume=(ArcFlags & MHFL_VOLUME)!=0;
  ------------------
  |  |   25|      0|#define MHFL_VOLUME         0x0001 // Volume.
  ------------------
  757|      0|        Solid=(ArcFlags & MHFL_SOLID)!=0;
  ------------------
  |  |   27|      0|#define MHFL_SOLID          0x0004 // Solid archive.
  ------------------
  758|      0|        Locked=(ArcFlags & MHFL_LOCK)!=0;
  ------------------
  |  |   29|      0|#define MHFL_LOCK           0x0010 // Locked archive.
  ------------------
  759|      0|        Protected=(ArcFlags & MHFL_PROTECT)!=0;
  ------------------
  |  |   28|      0|#define MHFL_PROTECT        0x0008 // Recovery record is present.
  ------------------
  760|      0|        Signed=false;
  761|      0|        NewNumbering=true;
  762|       |
  763|      0|        if ((ArcFlags & MHFL_VOLNUMBER)!=0)
  ------------------
  |  |   26|      0|#define MHFL_VOLNUMBER      0x0002 // Volume number field is present. True for all volumes except first.
  ------------------
  |  Branch (763:13): [True: 0, False: 0]
  ------------------
  764|      0|          VolNumber=(uint)Raw.GetV();
  765|      0|        else
  766|      0|          VolNumber=0;
  767|      0|        FirstVolume=Volume && VolNumber==0;
  ------------------
  |  Branch (767:21): [True: 0, False: 0]
  |  Branch (767:31): [True: 0, False: 0]
  ------------------
  768|       |
  769|      0|        if (ExtraSize!=0)
  ------------------
  |  Branch (769:13): [True: 0, False: 0]
  ------------------
  770|      0|          ProcessExtra50(&Raw,(size_t)ExtraSize,&MainHead);
  771|       |
  772|      0|#ifdef USE_QOPEN
  773|      0|        if (!ProhibitQOpen && MainHead.Locator && MainHead.QOpenOffset>0 && Cmd->QOpenMode!=QOPEN_NONE)
  ------------------
  |  Branch (773:13): [True: 0, False: 0]
  |  Branch (773:31): [True: 0, False: 0]
  |  Branch (773:51): [True: 0, False: 0]
  |  Branch (773:77): [True: 0, False: 0]
  ------------------
  774|      0|        {
  775|       |          // We seek to QO block in the end of archive when processing
  776|       |          // QOpen.Load, so we need to preserve current block positions
  777|       |          // to not break normal archive processing by calling function.
  778|      0|          int64 SaveCurBlockPos=CurBlockPos,SaveNextBlockPos=NextBlockPos;
  779|      0|          HEADER_TYPE SaveCurHeaderType=CurHeaderType;
  780|       |
  781|      0|          QOpen.Init(this,false);
  782|      0|          QOpen.Load(MainHead.QOpenOffset);
  783|       |
  784|      0|          CurBlockPos=SaveCurBlockPos;
  785|      0|          NextBlockPos=SaveNextBlockPos;
  786|      0|          CurHeaderType=SaveCurHeaderType;
  787|      0|        }
  788|      0|#endif
  789|      0|      }
  790|      0|      break;
  791|      1|    case HEAD_FILE:
  ------------------
  |  Branch (791:5): [True: 1, False: 0]
  ------------------
  792|      1|    case HEAD_SERVICE:
  ------------------
  |  Branch (792:5): [True: 0, False: 1]
  ------------------
  793|      1|      {
  794|      1|        FileHeader *hd=ShortBlock.HeaderType==HEAD_FILE ? &FileHead:&SubHead;
  ------------------
  |  Branch (794:24): [True: 1, False: 0]
  ------------------
  795|      1|        hd->Reset(); // Clear hash, time fields and other stuff like flags.
  796|      1|        *(BaseBlock *)hd=ShortBlock;
  797|       |
  798|      1|        bool FileBlock=ShortBlock.HeaderType==HEAD_FILE;
  799|       |
  800|      1|        hd->LargeFile=true;
  801|       |
  802|      1|        hd->PackSize=DataSize;
  803|      1|        hd->FileFlags=(uint)Raw.GetV();
  804|      1|        hd->UnpSize=Raw.GetV();
  805|       |
  806|      1|        hd->UnknownUnpSize=(hd->FileFlags & FHFL_UNPUNKNOWN)!=0;
  ------------------
  |  |   35|      1|#define FHFL_UNPUNKNOWN     0x0008 // Unknown unpacked size.
  ------------------
  807|      1|        if (hd->UnknownUnpSize)
  ------------------
  |  Branch (807:13): [True: 0, False: 1]
  ------------------
  808|      0|          hd->UnpSize=INT64NDF;
  ------------------
  |  |   30|      0|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  ------------------
  |  |  |  |   19|      0|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
  809|       |
  810|      1|        hd->MaxSize=Max(hd->PackSize,hd->UnpSize);
  ------------------
  |  |    5|      1|#define  Max(x,y) (((x)>(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  811|      1|        hd->FileAttr=(uint)Raw.GetV();
  812|      1|        if ((hd->FileFlags & FHFL_UTIME)!=0)
  ------------------
  |  |   33|      1|#define FHFL_UTIME          0x0002 // Time field in Unix format is present.
  ------------------
  |  Branch (812:13): [True: 0, False: 1]
  ------------------
  813|      0|          hd->mtime.SetUnix((time_t)Raw.Get4());
  814|       |
  815|      1|        hd->FileHash.Type=HASH_NONE;
  816|      1|        if ((hd->FileFlags & FHFL_CRC32)!=0)
  ------------------
  |  |   34|      1|#define FHFL_CRC32          0x0004 // CRC32 field is present.
  ------------------
  |  Branch (816:13): [True: 0, False: 1]
  ------------------
  817|      0|        {
  818|      0|          hd->FileHash.Type=HASH_CRC32;
  819|      0|          hd->FileHash.CRC32=Raw.Get4();
  820|      0|        }
  821|       |
  822|      1|        hd->RedirType=FSREDIR_NONE;
  823|       |
  824|      1|        uint CompInfo=(uint)Raw.GetV();
  825|      1|        hd->Method=(CompInfo>>7) & 7;
  826|       |
  827|       |        // "+ 50" to not mix with old RAR format algorithms. For example,
  828|       |        // we may need to use the compression algorithm 15 in the future,
  829|       |        // but it was already used in RAR 1.5 and Unpack needs to distinguish
  830|       |        // them.
  831|      1|        hd->UnpVer=(CompInfo & 0x3f) + 50;
  832|      1|        if (hd->UnpVer!=50) // Only 5.0 compression is known now.
  ------------------
  |  Branch (832:13): [True: 1, False: 0]
  ------------------
  833|      1|          hd->UnpVer=VER_UNKNOWN;
  ------------------
  |  |   21|      1|#define  VER_UNKNOWN          9999U // Just some large value.
  ------------------
  834|       |
  835|      1|        hd->HostOS=(byte)Raw.GetV();
  836|      1|        size_t NameSize=(size_t)Raw.GetV();
  837|      1|        hd->Inherited=(ShortBlock.Flags & HFL_INHERITED)!=0;
  ------------------
  |  |   22|      1|#define HFL_INHERITED       0x0040
  ------------------
  838|       |
  839|      1|        hd->HSType=HSYS_UNKNOWN;
  840|      1|        if (hd->HostOS==HOST5_UNIX)
  ------------------
  |  Branch (840:13): [True: 0, False: 1]
  ------------------
  841|      0|          hd->HSType=HSYS_UNIX;
  842|      1|        else
  843|      1|          if (hd->HostOS==HOST5_WINDOWS)
  ------------------
  |  Branch (843:15): [True: 0, False: 1]
  ------------------
  844|      0|            hd->HSType=HSYS_WINDOWS;
  845|       |
  846|      1|        hd->SplitBefore=(hd->Flags & HFL_SPLITBEFORE)!=0;
  ------------------
  |  |   16|      1|#define HFL_SPLITBEFORE     0x0008
  ------------------
  847|      1|        hd->SplitAfter=(hd->Flags & HFL_SPLITAFTER)!=0;
  ------------------
  |  |   18|      1|#define HFL_SPLITAFTER      0x0010
  ------------------
  848|      1|        hd->SubBlock=(hd->Flags & HFL_CHILD)!=0;
  ------------------
  |  |   20|      1|#define HFL_CHILD           0x0020
  ------------------
  849|      1|        hd->Solid=FileBlock && (CompInfo & FCI_SOLID)!=0;
  ------------------
  |  |   51|      1|#define FCI_SOLID           0x0040 // Solid flag.
  ------------------
  |  Branch (849:19): [True: 1, False: 0]
  |  Branch (849:32): [True: 0, False: 1]
  ------------------
  850|      1|        hd->Dir=(hd->FileFlags & FHFL_DIRECTORY)!=0;
  ------------------
  |  |   32|      1|#define FHFL_DIRECTORY      0x0001 // Directory.
  ------------------
  851|      1|        hd->WinSize=hd->Dir ? 0:size_t(0x20000)<<((CompInfo>>10)&0xf);
  ------------------
  |  Branch (851:21): [True: 0, False: 1]
  ------------------
  852|       |
  853|      1|        hd->CryptMethod=hd->Encrypted ? CRYPT_RAR50:CRYPT_NONE;
  ------------------
  |  Branch (853:25): [True: 0, False: 1]
  ------------------
  854|       |
  855|      1|        char FileName[NM*4];
  856|      1|        size_t ReadNameSize=Min(NameSize,ASIZE(FileName)-1);
  ------------------
  |  |    4|      1|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  857|      1|        Raw.GetB((byte *)FileName,ReadNameSize);
  858|      1|        FileName[ReadNameSize]=0;
  859|       |
  860|      1|        UtfToWide(FileName,hd->FileName,ASIZE(hd->FileName));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  861|       |
  862|       |        // Should do it before converting names, because extra fields can
  863|       |        // affect name processing, like in case of NTFS streams.
  864|      1|        if (ExtraSize!=0)
  ------------------
  |  Branch (864:13): [True: 1, False: 0]
  ------------------
  865|      1|          ProcessExtra50(&Raw,(size_t)ExtraSize,hd);
  866|       |
  867|      1|        if (FileBlock)
  ------------------
  |  Branch (867:13): [True: 1, False: 0]
  ------------------
  868|      1|        {
  869|      1|#ifndef SFX_MODULE
  870|      1|          ConvertNameCase(hd->FileName);
  871|      1|#endif
  872|      1|          ConvertFileHeader(hd);
  873|      1|        }
  874|       |
  875|      1|        if (!FileBlock && hd->CmpName(SUBHEAD_TYPE_CMT))
  ------------------
  |  |  114|      0|#define SUBHEAD_TYPE_CMT      L"CMT"
  ------------------
  |  Branch (875:13): [True: 0, False: 1]
  |  Branch (875:27): [True: 0, False: 0]
  ------------------
  876|      0|          MainComment=true;
  877|       |
  878|       |#if 0
  879|       |        // For RAR5 format we read the user specified recovery percent here.
  880|       |        // It would be useful to do it for shell extension too, so we display
  881|       |        // the correct recovery record size in archive properties. But then
  882|       |        // we would need to include the entire recovery record processing
  883|       |        // code to shell extension, which is not done now.
  884|       |        if (!FileBlock && hd->CmpName(SUBHEAD_TYPE_RR) && hd->SubData.Size()>0)
  885|       |        {
  886|       |          // It is stored as a single byte up to RAR 6.02 and as vint since
  887|       |          // 6.10, where we extended the maximum RR size from 99% to 1000%.
  888|       |          RawRead RawPercent;
  889|       |          RawPercent.Read(&hd->SubData[0],hd->SubData.Size());
  890|       |          RecoveryPercent=(int)RawPercent.GetV();
  891|       |
  892|       |          RSBlockHeader Header;
  893|       |          GetRRInfo(this,&Header);
  894|       |          RecoverySize=Header.RecSectionSize*Header.RecCount;
  895|       |        }
  896|       |#endif
  897|       |
  898|      1|        if (BadCRC) // Add the file name to broken header message displayed above.
  ------------------
  |  Branch (898:13): [True: 1, False: 0]
  ------------------
  899|      1|          uiMsg(UIERROR_FHEADERBROKEN,Archive::FileName,hd->FileName);
  900|      1|      }
  901|      1|      break;
  902|      0|    case HEAD_ENDARC:
  ------------------
  |  Branch (902:5): [True: 0, False: 1]
  ------------------
  903|      0|      {
  904|      0|        *(BaseBlock *)&EndArcHead=ShortBlock;
  905|      0|        uint ArcFlags=(uint)Raw.GetV();
  906|      0|        EndArcHead.NextVolume=(ArcFlags & EHFL_NEXTVOLUME)!=0;
  ------------------
  |  |   38|      0|#define EHFL_NEXTVOLUME     0x0001 // Not last volume.
  ------------------
  907|      0|        EndArcHead.StoreVolNumber=false;
  908|      0|        EndArcHead.DataCRC=false;
  909|      0|        EndArcHead.RevSpace=false;
  910|      0|      }
  911|      0|      break;
  912|      1|  }
  913|       |
  914|      1|  return Raw.Size();
  915|      1|}
_ZN7Archive14ProcessExtra50EP7RawReadmP9BaseBlock:
  963|      1|{
  964|       |  // Read extra data from the end of block skipping any fields before it.
  965|      1|  size_t ExtraStart=Raw->Size()-ExtraSize;
  966|      1|  if (ExtraStart<Raw->GetPos())
  ------------------
  |  Branch (966:7): [True: 0, False: 1]
  ------------------
  967|      0|    return;
  968|      1|  Raw->SetPos(ExtraStart);
  969|      2|  while (Raw->DataLeft()>=2)
  ------------------
  |  Branch (969:10): [True: 2, False: 0]
  ------------------
  970|      2|  {
  971|      2|    int64 FieldSize=Raw->GetV(); // Needs to be signed for check below and can be negative.
  972|      2|    if (FieldSize<=0 || Raw->DataLeft()==0 || FieldSize>(int64)Raw->DataLeft())
  ------------------
  |  Branch (972:9): [True: 1, False: 1]
  |  Branch (972:25): [True: 0, False: 1]
  |  Branch (972:47): [True: 0, False: 1]
  ------------------
  973|      1|      break;
  974|      1|    size_t NextPos=size_t(Raw->GetPos()+FieldSize);
  975|      1|    uint64 FieldType=Raw->GetV();
  976|       |
  977|      1|    FieldSize=int64(NextPos-Raw->GetPos()); // Field size without size and type fields.
  978|       |
  979|      1|    if (FieldSize<0) // FieldType is longer than expected extra field size.
  ------------------
  |  Branch (979:9): [True: 0, False: 1]
  ------------------
  980|      0|      break;
  981|       |
  982|      1|    if (bb->HeaderType==HEAD_MAIN)
  ------------------
  |  Branch (982:9): [True: 0, False: 1]
  ------------------
  983|      0|    {
  984|      0|      MainHeader *hd=(MainHeader *)bb;
  985|      0|      if (FieldType==MHEXTRA_LOCATOR)
  ------------------
  |  |   61|      0|#define MHEXTRA_LOCATOR       0x01 // Position of quick list and other blocks.
  ------------------
  |  Branch (985:11): [True: 0, False: 0]
  ------------------
  986|      0|      {
  987|      0|        hd->Locator=true;
  988|      0|        uint Flags=(uint)Raw->GetV();
  989|      0|        if ((Flags & MHEXTRA_LOCATOR_QLIST)!=0)
  ------------------
  |  |   64|      0|#define MHEXTRA_LOCATOR_QLIST 0x01 // Quick open offset is present.
  ------------------
  |  Branch (989:13): [True: 0, False: 0]
  ------------------
  990|      0|        {
  991|      0|          uint64 Offset=Raw->GetV();
  992|      0|          if (Offset!=0) // 0 means that reserved space was not enough to write the offset.
  ------------------
  |  Branch (992:15): [True: 0, False: 0]
  ------------------
  993|      0|            hd->QOpenOffset=Offset+CurBlockPos;
  994|      0|        }
  995|      0|        if ((Flags & MHEXTRA_LOCATOR_RR)!=0)
  ------------------
  |  |   65|      0|#define MHEXTRA_LOCATOR_RR    0x02 // Recovery record offset is present.
  ------------------
  |  Branch (995:13): [True: 0, False: 0]
  ------------------
  996|      0|        {
  997|      0|          uint64 Offset=Raw->GetV();
  998|      0|          if (Offset!=0) // 0 means that reserved space was not enough to write the offset.
  ------------------
  |  Branch (998:15): [True: 0, False: 0]
  ------------------
  999|      0|            hd->RROffset=Offset+CurBlockPos;
 1000|      0|        }
 1001|      0|      }
 1002|      0|    }
 1003|       |
 1004|      1|    if (bb->HeaderType==HEAD_FILE || bb->HeaderType==HEAD_SERVICE)
  ------------------
  |  Branch (1004:9): [True: 1, False: 0]
  |  Branch (1004:38): [True: 0, False: 0]
  ------------------
 1005|      1|    {
 1006|      1|      FileHeader *hd=(FileHeader *)bb;
 1007|      1|      switch(FieldType)
  ------------------
  |  Branch (1007:14): [True: 0, False: 1]
  ------------------
 1008|      1|      {
 1009|      0|        case FHEXTRA_CRYPT:
  ------------------
  |  |   68|      0|#define FHEXTRA_CRYPT         0x01 // Encryption parameters.
  ------------------
  |  Branch (1009:9): [True: 0, False: 1]
  ------------------
 1010|      0|          {
 1011|      0|            FileHeader *hd=(FileHeader *)bb;
 1012|      0|            uint EncVersion=(uint)Raw->GetV();
 1013|      0|            if (EncVersion>CRYPT_VERSION)
  ------------------
  |  |   20|      0|#define CRYPT_VERSION             0 // Supported encryption version.
  ------------------
  |  Branch (1013:17): [True: 0, False: 0]
  ------------------
 1014|      0|            {
 1015|      0|              wchar Info[20];
 1016|      0|              swprintf(Info,ASIZE(Info),L"x%u",EncVersion);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
 1017|      0|              UnkEncVerMsg(hd->FileName,Info);
 1018|      0|            }
 1019|      0|            else
 1020|      0|            {
 1021|      0|              uint Flags=(uint)Raw->GetV();
 1022|      0|              hd->UsePswCheck=(Flags & FHEXTRA_CRYPT_PSWCHECK)!=0;
  ------------------
  |  |   88|      0|#define FHEXTRA_CRYPT_PSWCHECK 0x01 // Store password check data.
  ------------------
 1023|      0|              hd->UseHashKey=(Flags & FHEXTRA_CRYPT_HASHMAC)!=0;
  ------------------
  |  |   89|      0|#define FHEXTRA_CRYPT_HASHMAC  0x02 // Use MAC for unpacked data checksums.
  ------------------
 1024|      0|              hd->Lg2Count=Raw->Get1();
 1025|      0|              if (hd->Lg2Count>CRYPT5_KDF_LG2_COUNT_MAX)
  ------------------
  |  |   19|      0|#define CRYPT5_KDF_LG2_COUNT_MAX 24 // LOG2 of maximum accepted iteration count.
  ------------------
  |  Branch (1025:19): [True: 0, False: 0]
  ------------------
 1026|      0|              {
 1027|      0|                wchar Info[20];
 1028|      0|                swprintf(Info,ASIZE(Info),L"xc%u",hd->Lg2Count);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
 1029|      0|                UnkEncVerMsg(hd->FileName,Info);
 1030|      0|              }
 1031|      0|              Raw->GetB(hd->Salt,SIZE_SALT50);
  ------------------
  |  |    9|      0|#define SIZE_SALT50              16
  ------------------
 1032|      0|              Raw->GetB(hd->InitV,SIZE_INITV);
  ------------------
  |  |   11|      0|#define SIZE_INITV               16
  ------------------
 1033|      0|              if (hd->UsePswCheck)
  ------------------
  |  Branch (1033:19): [True: 0, False: 0]
  ------------------
 1034|      0|              {
 1035|      0|                Raw->GetB(hd->PswCheck,SIZE_PSWCHECK);
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
 1036|       |
 1037|       |                // It is important to know if password check data is valid.
 1038|       |                // If it is damaged and header CRC32 fails to detect it,
 1039|       |                // archiver would refuse to decompress a possibly valid file.
 1040|       |                // Since we want to be sure distinguishing a wrong password
 1041|       |                // or corrupt file data, we use 64-bit password check data
 1042|       |                // and to control its validity we use 32 bits of password
 1043|       |                // check data SHA-256 additionally to 32-bit header CRC32.
 1044|      0|                byte csum[SIZE_PSWCHECK_CSUM];
 1045|      0|                Raw->GetB(csum,SIZE_PSWCHECK_CSUM);
  ------------------
  |  |   13|      0|#define SIZE_PSWCHECK_CSUM        4
  ------------------
 1046|       |
 1047|      0|                sha256_context ctx;
 1048|      0|                sha256_init(&ctx);
 1049|      0|                sha256_process(&ctx, hd->PswCheck, SIZE_PSWCHECK);
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
 1050|       |
 1051|      0|                byte Digest[SHA256_DIGEST_SIZE];
 1052|      0|                sha256_done(&ctx, Digest);
 1053|       |
 1054|      0|                hd->UsePswCheck=memcmp(csum,Digest,SIZE_PSWCHECK_CSUM)==0;
  ------------------
  |  |   13|      0|#define SIZE_PSWCHECK_CSUM        4
  ------------------
 1055|       |
 1056|       |                // RAR 5.21 and earlier set PswCheck field in service records to 0
 1057|       |                // even if UsePswCheck was present.
 1058|      0|                if (bb->HeaderType==HEAD_SERVICE && memcmp(hd->PswCheck,"\0\0\0\0\0\0\0\0",SIZE_PSWCHECK)==0)
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
  |  Branch (1058:21): [True: 0, False: 0]
  |  Branch (1058:53): [True: 0, False: 0]
  ------------------
 1059|      0|                  hd->UsePswCheck=0;
 1060|      0|              }
 1061|      0|              hd->SaltSet=true;
 1062|      0|              hd->CryptMethod=CRYPT_RAR50;
 1063|      0|              hd->Encrypted=true;
 1064|      0|            }
 1065|      0|          }
 1066|      0|          break;
 1067|      0|        case FHEXTRA_HASH:
  ------------------
  |  |   69|      0|#define FHEXTRA_HASH          0x02 // File hash.
  ------------------
  |  Branch (1067:9): [True: 0, False: 1]
  ------------------
 1068|      0|          {
 1069|      0|            FileHeader *hd=(FileHeader *)bb;
 1070|      0|            uint Type=(uint)Raw->GetV();
 1071|      0|            if (Type==FHEXTRA_HASH_BLAKE2)
  ------------------
  |  |   78|      0|#define FHEXTRA_HASH_BLAKE2    0x00
  ------------------
  |  Branch (1071:17): [True: 0, False: 0]
  ------------------
 1072|      0|            {
 1073|      0|              hd->FileHash.Type=HASH_BLAKE2;
 1074|      0|              Raw->GetB(hd->FileHash.Digest,BLAKE2_DIGEST_SIZE);
  ------------------
  |  |    5|      0|#define BLAKE2_DIGEST_SIZE 32
  ------------------
 1075|      0|            }
 1076|      0|          }
 1077|      0|          break;
 1078|      0|        case FHEXTRA_HTIME:
  ------------------
  |  |   70|      0|#define FHEXTRA_HTIME         0x03 // High precision file time.
  ------------------
  |  Branch (1078:9): [True: 0, False: 1]
  ------------------
 1079|      0|          if (FieldSize>=5)
  ------------------
  |  Branch (1079:15): [True: 0, False: 0]
  ------------------
 1080|      0|          {
 1081|      0|            byte Flags=(byte)Raw->GetV();
 1082|      0|            bool UnixTime=(Flags & FHEXTRA_HTIME_UNIXTIME)!=0;
  ------------------
  |  |   81|      0|#define FHEXTRA_HTIME_UNIXTIME 0x01 // Use Unix time_t format.
  ------------------
 1083|      0|            if ((Flags & FHEXTRA_HTIME_MTIME)!=0)
  ------------------
  |  |   82|      0|#define FHEXTRA_HTIME_MTIME    0x02 // mtime is present.
  ------------------
  |  Branch (1083:17): [True: 0, False: 0]
  ------------------
 1084|      0|              if (UnixTime)
  ------------------
  |  Branch (1084:19): [True: 0, False: 0]
  ------------------
 1085|      0|                hd->mtime.SetUnix(Raw->Get4());
 1086|      0|              else
 1087|      0|                hd->mtime.SetWin(Raw->Get8());
 1088|      0|            if ((Flags & FHEXTRA_HTIME_CTIME)!=0)
  ------------------
  |  |   83|      0|#define FHEXTRA_HTIME_CTIME    0x04 // ctime is present.
  ------------------
  |  Branch (1088:17): [True: 0, False: 0]
  ------------------
 1089|      0|              if (UnixTime)
  ------------------
  |  Branch (1089:19): [True: 0, False: 0]
  ------------------
 1090|      0|                hd->ctime.SetUnix(Raw->Get4());
 1091|      0|              else
 1092|      0|                hd->ctime.SetWin(Raw->Get8());
 1093|      0|            if ((Flags & FHEXTRA_HTIME_ATIME)!=0)
  ------------------
  |  |   84|      0|#define FHEXTRA_HTIME_ATIME    0x08 // atime is present.
  ------------------
  |  Branch (1093:17): [True: 0, False: 0]
  ------------------
 1094|      0|              if (UnixTime)
  ------------------
  |  Branch (1094:19): [True: 0, False: 0]
  ------------------
 1095|      0|                hd->atime.SetUnix((time_t)Raw->Get4());
 1096|      0|              else
 1097|      0|                hd->atime.SetWin(Raw->Get8());
 1098|      0|            if (UnixTime && (Flags & FHEXTRA_HTIME_UNIX_NS)!=0) // Add nanoseconds.
  ------------------
  |  |   85|      0|#define FHEXTRA_HTIME_UNIX_NS  0x10 // Unix format with nanosecond precision.
  ------------------
  |  Branch (1098:17): [True: 0, False: 0]
  |  Branch (1098:29): [True: 0, False: 0]
  ------------------
 1099|      0|            {
 1100|      0|              uint ns;
 1101|      0|              if ((Flags & FHEXTRA_HTIME_MTIME)!=0 && (ns=(Raw->Get4() & 0x3fffffff))<1000000000)
  ------------------
  |  |   82|      0|#define FHEXTRA_HTIME_MTIME    0x02 // mtime is present.
  ------------------
  |  Branch (1101:19): [True: 0, False: 0]
  |  Branch (1101:55): [True: 0, False: 0]
  ------------------
 1102|      0|                hd->mtime.Adjust(ns);
 1103|      0|              if ((Flags & FHEXTRA_HTIME_CTIME)!=0 && (ns=(Raw->Get4() & 0x3fffffff))<1000000000)
  ------------------
  |  |   83|      0|#define FHEXTRA_HTIME_CTIME    0x04 // ctime is present.
  ------------------
  |  Branch (1103:19): [True: 0, False: 0]
  |  Branch (1103:55): [True: 0, False: 0]
  ------------------
 1104|      0|                hd->ctime.Adjust(ns);
 1105|      0|              if ((Flags & FHEXTRA_HTIME_ATIME)!=0 && (ns=(Raw->Get4() & 0x3fffffff))<1000000000)
  ------------------
  |  |   84|      0|#define FHEXTRA_HTIME_ATIME    0x08 // atime is present.
  ------------------
  |  Branch (1105:19): [True: 0, False: 0]
  |  Branch (1105:55): [True: 0, False: 0]
  ------------------
 1106|      0|                hd->atime.Adjust(ns);
 1107|      0|            }
 1108|      0|          }
 1109|      0|          break;
 1110|      0|        case FHEXTRA_VERSION:
  ------------------
  |  |   71|      0|#define FHEXTRA_VERSION       0x04 // File version information.
  ------------------
  |  Branch (1110:9): [True: 0, False: 1]
  ------------------
 1111|      0|          if (FieldSize>=1)
  ------------------
  |  Branch (1111:15): [True: 0, False: 0]
  ------------------
 1112|      0|          {
 1113|      0|            Raw->GetV(); // Skip flags field.
 1114|      0|            uint Version=(uint)Raw->GetV();
 1115|      0|            if (Version!=0)
  ------------------
  |  Branch (1115:17): [True: 0, False: 0]
  ------------------
 1116|      0|            {
 1117|      0|              hd->Version=true;
 1118|       |
 1119|      0|              wchar VerText[20];
 1120|      0|              swprintf(VerText,ASIZE(VerText),L";%u",Version);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
 1121|      0|              wcsncatz(hd->FileName,VerText,ASIZE(hd->FileName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
 1122|      0|            }
 1123|      0|          }
 1124|      0|          break;
 1125|      1|        case FHEXTRA_REDIR:
  ------------------
  |  |   72|      1|#define FHEXTRA_REDIR         0x05 // File system redirection (links, etc.).
  ------------------
  |  Branch (1125:9): [True: 1, False: 0]
  ------------------
 1126|      1|          {
 1127|      1|            hd->RedirType=(FILE_SYSTEM_REDIRECT)Raw->GetV();
 1128|      1|            uint Flags=(uint)Raw->GetV();
 1129|      1|            hd->DirTarget=(Flags & FHEXTRA_REDIR_DIR)!=0;
  ------------------
  |  |   92|      1|#define FHEXTRA_REDIR_DIR      0x01 // Link target is directory.
  ------------------
 1130|      1|            size_t NameSize=(size_t)Raw->GetV();
 1131|       |
 1132|      1|            char UtfName[NM*4];
 1133|      1|            *UtfName=0;
 1134|      1|            if (NameSize<ASIZE(UtfName)-1)
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (1134:17): [True: 1, False: 0]
  ------------------
 1135|      1|            {
 1136|      1|              Raw->GetB(UtfName,NameSize);
 1137|      1|              UtfName[NameSize]=0;
 1138|      1|            }
 1139|       |#ifdef _WIN_ALL
 1140|       |            UnixSlashToDos(UtfName,UtfName,ASIZE(UtfName));
 1141|       |#endif
 1142|      1|            UtfToWide(UtfName,hd->RedirName,ASIZE(hd->RedirName));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
 1143|      1|          }
 1144|      1|          break;
 1145|      0|        case FHEXTRA_UOWNER:
  ------------------
  |  |   73|      0|#define FHEXTRA_UOWNER        0x06 // Unix owner and group information.
  ------------------
  |  Branch (1145:9): [True: 0, False: 1]
  ------------------
 1146|      0|          {
 1147|      0|            uint Flags=(uint)Raw->GetV();
 1148|      0|            hd->UnixOwnerNumeric=(Flags & FHEXTRA_UOWNER_NUMUID)!=0;
  ------------------
  |  |   97|      0|#define FHEXTRA_UOWNER_NUMUID  0x04 // Numeric user ID is present.
  ------------------
 1149|      0|            hd->UnixGroupNumeric=(Flags & FHEXTRA_UOWNER_NUMGID)!=0;
  ------------------
  |  |   98|      0|#define FHEXTRA_UOWNER_NUMGID  0x08 // Numeric group ID is present.
  ------------------
 1150|      0|            *hd->UnixOwnerName=*hd->UnixGroupName=0;
 1151|      0|            if ((Flags & FHEXTRA_UOWNER_UNAME)!=0)
  ------------------
  |  |   95|      0|#define FHEXTRA_UOWNER_UNAME   0x01 // User name string is present.
  ------------------
  |  Branch (1151:17): [True: 0, False: 0]
  ------------------
 1152|      0|            {
 1153|      0|              size_t Length=(size_t)Raw->GetV();
 1154|      0|              Length=Min(Length,ASIZE(hd->UnixOwnerName)-1);
  ------------------
  |  |    4|      0|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1155|      0|              Raw->GetB(hd->UnixOwnerName,Length);
 1156|      0|              hd->UnixOwnerName[Length]=0;
 1157|      0|            }
 1158|      0|            if ((Flags & FHEXTRA_UOWNER_GNAME)!=0)
  ------------------
  |  |   96|      0|#define FHEXTRA_UOWNER_GNAME   0x02 // Group name string is present.
  ------------------
  |  Branch (1158:17): [True: 0, False: 0]
  ------------------
 1159|      0|            {
 1160|      0|              size_t Length=(size_t)Raw->GetV();
 1161|      0|              Length=Min(Length,ASIZE(hd->UnixGroupName)-1);
  ------------------
  |  |    4|      0|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1162|      0|              Raw->GetB(hd->UnixGroupName,Length);
 1163|      0|              hd->UnixGroupName[Length]=0;
 1164|      0|            }
 1165|      0|#ifdef _UNIX
 1166|      0|            if (hd->UnixOwnerNumeric)
  ------------------
  |  Branch (1166:17): [True: 0, False: 0]
  ------------------
 1167|      0|              hd->UnixOwnerID=(uid_t)Raw->GetV();
 1168|      0|            if (hd->UnixGroupNumeric)
  ------------------
  |  Branch (1168:17): [True: 0, False: 0]
  ------------------
 1169|      0|              hd->UnixGroupID=(gid_t)Raw->GetV();
 1170|       |#else
 1171|       |            // Need these fields in Windows too for 'list' command,
 1172|       |            // but uid_t and gid_t are not defined.
 1173|       |            if (hd->UnixOwnerNumeric)
 1174|       |              hd->UnixOwnerID=(uint)Raw->GetV();
 1175|       |            if (hd->UnixGroupNumeric)
 1176|       |              hd->UnixGroupID=(uint)Raw->GetV();
 1177|       |#endif
 1178|      0|            hd->UnixOwnerSet=true;
 1179|      0|          }
 1180|      0|          break;
 1181|      0|        case FHEXTRA_SUBDATA:
  ------------------
  |  |   74|      0|#define FHEXTRA_SUBDATA       0x07 // Service header subdata array.
  ------------------
  |  Branch (1181:9): [True: 0, False: 1]
  ------------------
 1182|      0|          {
 1183|       |            // RAR 5.21 and earlier set FHEXTRA_SUBDATA size to 1 less than
 1184|       |            // required. It did not hurt extraction, because UnRAR 5.21
 1185|       |            // and earlier ignored this field and set FieldSize as data left
 1186|       |            // in entire extra area. But now we set the correct field size
 1187|       |            // and set FieldSize based on the actual extra record size,
 1188|       |            // so we need to adjust it for those older archives here.
 1189|       |            // FHEXTRA_SUBDATA in those archives always belongs to HEAD_SERVICE
 1190|       |            // and always is last in extra area. So since its size is by 1
 1191|       |            // less than needed, we always have 1 byte left in extra area,
 1192|       |            // which fact we use here to detect such archives.
 1193|      0|            if (bb->HeaderType==HEAD_SERVICE && Raw->Size()-NextPos==1)
  ------------------
  |  Branch (1193:17): [True: 0, False: 0]
  |  Branch (1193:49): [True: 0, False: 0]
  ------------------
 1194|      0|              FieldSize++;
 1195|       |
 1196|       |            // We cannot allocate too much memory here, because above
 1197|       |            // we check FieldSize againt Raw size and we control that Raw size
 1198|       |            // is sensible when reading headers.
 1199|      0|            hd->SubData.Alloc((size_t)FieldSize);
 1200|      0|            Raw->GetB(hd->SubData.Addr(0),(size_t)FieldSize);
 1201|      0|          }
 1202|      0|          break;
 1203|      1|      }
 1204|      1|    }
 1205|       |
 1206|      1|    Raw->SetPos(NextPos);
 1207|      1|  }
 1208|      1|}
_ZN7Archive15ConvertNameCaseEPw:
 1290|      1|{
 1291|      1|  if (Cmd->ConvertNames==NAMES_UPPERCASE)
  ------------------
  |  Branch (1291:7): [True: 0, False: 1]
  ------------------
 1292|      0|    wcsupper(Name);
 1293|      1|  if (Cmd->ConvertNames==NAMES_LOWERCASE)
  ------------------
  |  Branch (1293:7): [True: 0, False: 1]
  ------------------
 1294|      0|    wcslower(Name);
 1295|      1|}
_ZN7Archive8IsArcDirEv:
 1300|      1|{
 1301|      1|  return FileHead.Dir;
 1302|      1|}
_ZN7Archive17ConvertAttributesEv:
 1306|      1|{
 1307|       |#if defined(_WIN_ALL) || defined(_EMX)
 1308|       |  if (FileHead.HSType!=HSYS_WINDOWS)
 1309|       |    FileHead.FileAttr=FileHead.Dir ? 0x10 : 0x20;
 1310|       |#endif
 1311|      1|#ifdef _UNIX
 1312|       |  // umask defines which permission bits must not be set by default
 1313|       |  // when creating a file or directory. The typical default value
 1314|       |  // for the process umask is S_IWGRP | S_IWOTH (octal 022),
 1315|       |  // resulting in 0644 mode for new files.
 1316|       |  // Normally umask is applied automatically when creating a file,
 1317|       |  // but we set attributes with chmod later, so we need to calculate
 1318|       |  // resulting attributes here. We do it only for non-Unix archives.
 1319|       |  // We restore native Unix attributes as is, because it can be backup.
 1320|      1|  static mode_t mask = (mode_t) -1;
 1321|       |
 1322|      1|  if (mask == (mode_t) -1)
  ------------------
  |  Branch (1322:7): [True: 1, False: 0]
  ------------------
 1323|      1|  {
 1324|       |    // umask call returns the current umask value. Argument (022) is not
 1325|       |    // really important here.
 1326|      1|    mask = umask(022);
 1327|       |
 1328|       |    // Restore the original umask value, which was changed to 022 above.
 1329|      1|    umask(mask);
 1330|      1|  }
 1331|       |
 1332|      1|  switch(FileHead.HSType)
 1333|      1|  {
 1334|      0|    case HSYS_WINDOWS:
  ------------------
  |  Branch (1334:5): [True: 0, False: 1]
  ------------------
 1335|      0|      {
 1336|       |        // Mapping MSDOS, OS/2 and Windows file attributes to Unix.
 1337|       |
 1338|      0|        if (FileHead.FileAttr & 0x10) // FILE_ATTRIBUTE_DIRECTORY
  ------------------
  |  Branch (1338:13): [True: 0, False: 0]
  ------------------
 1339|      0|        {
 1340|       |          // For directories we use 0777 mask.
 1341|      0|          FileHead.FileAttr=0777 & ~mask;
 1342|      0|        }
 1343|      0|        else
 1344|      0|          if (FileHead.FileAttr & 1)  // FILE_ATTRIBUTE_READONLY
  ------------------
  |  Branch (1344:15): [True: 0, False: 0]
  ------------------
 1345|      0|          {
 1346|       |            // For read only files we use 0444 mask with 'w' bits turned off.
 1347|      0|            FileHead.FileAttr=0444 & ~mask;
 1348|      0|          }
 1349|      0|          else
 1350|      0|          {
 1351|       |            // umask does not set +x for regular files, so we use 0666
 1352|       |            // instead of 0777 as for directories.
 1353|      0|            FileHead.FileAttr=0666 & ~mask;
 1354|      0|          }
 1355|      0|      }
 1356|      0|      break;
 1357|      0|    case HSYS_UNIX:
  ------------------
  |  Branch (1357:5): [True: 0, False: 1]
  ------------------
 1358|      0|      break;
 1359|      1|    default:
  ------------------
  |  Branch (1359:5): [True: 1, False: 0]
  ------------------
 1360|      1|      if (FileHead.Dir)
  ------------------
  |  Branch (1360:11): [True: 0, False: 1]
  ------------------
 1361|      0|        FileHead.FileAttr=0x41ff & ~mask;
 1362|      1|      else
 1363|      1|        FileHead.FileAttr=0x81b6 & ~mask;
 1364|      1|      break;
 1365|      1|  }
 1366|      1|#endif
 1367|      1|}
_ZN7Archive17ConvertFileHeaderEP10FileHeader:
 1371|      1|{
 1372|      1|  if (hd->HSType==HSYS_UNKNOWN)
  ------------------
  |  Branch (1372:7): [True: 1, False: 0]
  ------------------
 1373|      1|    if (hd->Dir)
  ------------------
  |  Branch (1373:9): [True: 0, False: 1]
  ------------------
 1374|      0|      hd->FileAttr=0x10;
 1375|      1|    else
 1376|      1|      hd->FileAttr=0x20;
 1377|       |
 1378|       |#ifdef _WIN_ALL
 1379|       |  if (hd->HSType==HSYS_UNIX) // Convert Unix, OS X and Android decomposed chracters to Windows precomposed.
 1380|       |    ConvertToPrecomposed(hd->FileName,ASIZE(hd->FileName));
 1381|       |#endif
 1382|       |
 1383|      4|  for (wchar *s=hd->FileName;*s!=0;s++)
  ------------------
  |  Branch (1383:30): [True: 3, False: 1]
  ------------------
 1384|      3|  {
 1385|      3|#ifdef _UNIX
 1386|       |    // Backslash is the invalid character for Windows file headers,
 1387|       |    // but it can present in Unix file names extracted in Unix.
 1388|      3|    if (*s=='\\' && Format==RARFMT50 && hd->HSType==HSYS_WINDOWS)
  ------------------
  |  Branch (1388:9): [True: 0, False: 3]
  |  Branch (1388:21): [True: 0, False: 0]
  |  Branch (1388:41): [True: 0, False: 0]
  ------------------
 1389|      0|      *s='_';
 1390|      3|#endif
 1391|       |
 1392|       |#if defined(_WIN_ALL) || defined(_EMX)
 1393|       |    // RAR 5.0 archives do not use '\' as path separator, so if we see it,
 1394|       |    // it means that it is a part of Unix file name, which we cannot
 1395|       |    // extract in Windows.
 1396|       |    if (*s=='\\' && Format==RARFMT50)
 1397|       |      *s='_';
 1398|       |
 1399|       |    // ':' in file names is allowed in Unix, but not in Windows.
 1400|       |    // Even worse, file data will be written to NTFS stream on NTFS,
 1401|       |    // so automatic name correction on file create error in extraction
 1402|       |    // routine does not work. In Windows and DOS versions we better
 1403|       |    // replace ':' now.
 1404|       |    if (*s==':')
 1405|       |      *s='_';
 1406|       |#endif
 1407|       |
 1408|       |    // This code must be performed only after other path separator checks,
 1409|       |    // because it produces backslashes illegal for some of checks above.
 1410|       |    // Backslash is allowed in file names in Unix, but not in Windows.
 1411|       |    // Still, RAR 4.x uses backslashes as path separator even in Unix.
 1412|       |    // Forward slash is not allowed in both systems. In RAR 5.0 we use
 1413|       |    // the forward slash as universal path separator.
 1414|      3|    if (*s=='/' || *s=='\\' && Format!=RARFMT50)
  ------------------
  |  Branch (1414:9): [True: 0, False: 3]
  |  Branch (1414:20): [True: 0, False: 3]
  |  Branch (1414:32): [True: 0, False: 0]
  ------------------
 1415|      0|      *s=CPATHDIVIDER;
  ------------------
  |  |  187|      0|#define CPATHDIVIDER '/'
  ------------------
 1416|      3|  }
 1417|      1|}
_Z7SafeAddlll:
  132|      1|{
  133|      1|  return v1>=0 && v2>=0 && v1<=MAX_INT64-v2 ? v1+v2 : f;
  ------------------
  |  |   22|      1|#define MAX_INT64 int64(INT32TO64(0x7fffffff,0xffffffff))
  |  |  ------------------
  |  |  |  |   19|      1|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
  |  Branch (133:10): [True: 1, False: 0]
  |  Branch (133:19): [True: 1, False: 0]
  |  Branch (133:28): [True: 1, False: 0]
  ------------------
  134|      1|}

_ZN5ArrayIwED2Ev:
   72|     11|{
   73|     11|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 4, False: 7]
  ------------------
   74|      4|  {
   75|      4|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 4]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      4|    free(Buffer);
   78|      4|  }
   79|     11|}
_ZN5ArrayIwE4SizeEv:
   95|     14|{
   96|     14|  return BufSize;
   97|     14|}
_ZNK5ArrayIhEixEm:
   83|     47|{
   84|     47|  return Buffer[Item];
   85|     47|}
_ZN5ArrayIlEC2Ev:
   49|      2|{
   50|      2|  CleanData();
   51|      2|}
_ZN5ArrayIlE9CleanDataEv:
   39|      2|{
   40|      2|  Buffer=NULL;
   41|      2|  BufSize=0;
   42|      2|  AllocSize=0;
   43|      2|  MaxSize=0;
   44|      2|  Secure=false;
   45|      2|}
_ZN5ArrayIlED2Ev:
   72|      2|{
   73|      2|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 0, False: 2]
  ------------------
   74|      0|  {
   75|      0|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 0]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      0|    free(Buffer);
   78|      0|  }
   79|      2|}
_ZN5ArrayIhE9CleanDataEv:
   39|     13|{
   40|     13|  Buffer=NULL;
   41|     13|  BufSize=0;
   42|     13|  AllocSize=0;
   43|     13|  MaxSize=0;
   44|     13|  Secure=false;
   45|     13|}
_ZN5ArrayIhE3AddEm:
  101|      4|{
  102|      4|  BufSize+=Items;
  103|      4|  if (BufSize>AllocSize)
  ------------------
  |  Branch (103:7): [True: 4, False: 0]
  ------------------
  104|      4|  {
  105|      4|    if (MaxSize!=0 && BufSize>MaxSize)
  ------------------
  |  Branch (105:9): [True: 0, False: 4]
  |  Branch (105:23): [True: 0, False: 0]
  ------------------
  106|      0|    {
  107|      0|      ErrHandler.GeneralErrMsg(L"Maximum allowed array size (%u) is exceeded",MaxSize);
  108|      0|      ErrHandler.MemoryError();
  109|      0|    }
  110|       |
  111|      4|    size_t Suggested=AllocSize+AllocSize/4+32;
  112|      4|    size_t NewSize=Max(BufSize,Suggested);
  ------------------
  |  |    5|      4|#define  Max(x,y) (((x)>(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  113|       |
  114|      4|    T *NewBuffer;
  115|      4|    if (Secure)
  ------------------
  |  Branch (115:9): [True: 0, False: 4]
  ------------------
  116|      0|    {
  117|      0|      NewBuffer=(T *)malloc(NewSize*sizeof(T));
  118|      0|      if (NewBuffer==NULL)
  ------------------
  |  Branch (118:11): [True: 0, False: 0]
  ------------------
  119|      0|        ErrHandler.MemoryError();
  120|      0|      if (Buffer!=NULL)
  ------------------
  |  Branch (120:11): [True: 0, False: 0]
  ------------------
  121|      0|      {
  122|      0|        memcpy(NewBuffer,Buffer,AllocSize*sizeof(T));
  123|      0|        cleandata(Buffer,AllocSize*sizeof(T));
  124|      0|        free(Buffer);
  125|      0|      }
  126|      0|    }
  127|      4|    else
  128|      4|    {
  129|      4|      NewBuffer=(T *)realloc(Buffer,NewSize*sizeof(T));
  130|      4|      if (NewBuffer==NULL)
  ------------------
  |  Branch (130:11): [True: 0, False: 4]
  ------------------
  131|      0|        ErrHandler.MemoryError();
  132|      4|    }
  133|      4|    Buffer=NewBuffer;
  134|      4|    AllocSize=NewSize;
  135|      4|  }
  136|      4|}
_ZN5ArrayIhED2Ev:
   72|     13|{
   73|     13|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 3, False: 10]
  ------------------
   74|      3|  {
   75|      3|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 3]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      3|    free(Buffer);
   78|      3|  }
   79|     13|}
_ZN5ArrayIcEC2Em:
   55|      1|{
   56|      1|  CleanData();
   57|      1|  Add(Size);
   58|      1|}
_ZN5ArrayIcE9CleanDataEv:
   39|      1|{
   40|      1|  Buffer=NULL;
   41|      1|  BufSize=0;
   42|      1|  AllocSize=0;
   43|      1|  MaxSize=0;
   44|      1|  Secure=false;
   45|      1|}
_ZN5ArrayIcE3AddEm:
  101|      1|{
  102|      1|  BufSize+=Items;
  103|      1|  if (BufSize>AllocSize)
  ------------------
  |  Branch (103:7): [True: 1, False: 0]
  ------------------
  104|      1|  {
  105|      1|    if (MaxSize!=0 && BufSize>MaxSize)
  ------------------
  |  Branch (105:9): [True: 0, False: 1]
  |  Branch (105:23): [True: 0, False: 0]
  ------------------
  106|      0|    {
  107|      0|      ErrHandler.GeneralErrMsg(L"Maximum allowed array size (%u) is exceeded",MaxSize);
  108|      0|      ErrHandler.MemoryError();
  109|      0|    }
  110|       |
  111|      1|    size_t Suggested=AllocSize+AllocSize/4+32;
  112|      1|    size_t NewSize=Max(BufSize,Suggested);
  ------------------
  |  |    5|      1|#define  Max(x,y) (((x)>(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 1, False: 0]
  |  |  ------------------
  ------------------
  113|       |
  114|      1|    T *NewBuffer;
  115|      1|    if (Secure)
  ------------------
  |  Branch (115:9): [True: 0, False: 1]
  ------------------
  116|      0|    {
  117|      0|      NewBuffer=(T *)malloc(NewSize*sizeof(T));
  118|      0|      if (NewBuffer==NULL)
  ------------------
  |  Branch (118:11): [True: 0, False: 0]
  ------------------
  119|      0|        ErrHandler.MemoryError();
  120|      0|      if (Buffer!=NULL)
  ------------------
  |  Branch (120:11): [True: 0, False: 0]
  ------------------
  121|      0|      {
  122|      0|        memcpy(NewBuffer,Buffer,AllocSize*sizeof(T));
  123|      0|        cleandata(Buffer,AllocSize*sizeof(T));
  124|      0|        free(Buffer);
  125|      0|      }
  126|      0|    }
  127|      1|    else
  128|      1|    {
  129|      1|      NewBuffer=(T *)realloc(Buffer,NewSize*sizeof(T));
  130|      1|      if (NewBuffer==NULL)
  ------------------
  |  Branch (130:11): [True: 0, False: 1]
  ------------------
  131|      0|        ErrHandler.MemoryError();
  132|      1|    }
  133|      1|    Buffer=NewBuffer;
  134|      1|    AllocSize=NewSize;
  135|      1|  }
  136|      1|}
_ZN5ArrayIcED2Ev:
   72|      1|{
   73|      1|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 1, False: 0]
  ------------------
   74|      1|  {
   75|      1|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 1]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      1|    free(Buffer);
   78|      1|  }
   79|      1|}
_ZNK5ArrayIcEixEm:
   83|      4|{
   84|      4|  return Buffer[Item];
   85|      4|}
_ZN5ArrayIcE4SizeEv:
   95|      1|{
   96|      1|  return BufSize;
   97|      1|}
_ZN5ArrayIP14UnpackFilter30E4SizeEv:
   95|      8|{
   96|      8|  return BufSize;
   97|      8|}
_ZN5ArrayIiE9SoftResetEv:
  163|      4|{
  164|      4|  BufSize=0;
  165|      4|}
_ZN5ArrayIP14UnpackFilter30E9SoftResetEv:
  163|      8|{
  164|      8|  BufSize=0;
  165|      8|}
_ZN5ArrayIhE5AllocEm:
  140|      1|{
  141|      1|  if (Items>AllocSize)
  ------------------
  |  Branch (141:7): [True: 0, False: 1]
  ------------------
  142|      0|    Add(Items-BufSize);
  143|      1|  else
  144|      1|    BufSize=Items;
  145|      1|}
_ZN5ArrayI12UnpackFilterE9SoftResetEv:
  163|      2|{
  164|      2|  BufSize=0;
  165|      2|}
_ZN5ArrayIhEC2Ev:
   49|     13|{
   50|     13|  CleanData();
   51|     13|}
_ZN5ArrayI12UnpackFilterEC2Ev:
   49|      2|{
   50|      2|  CleanData();
   51|      2|}
_ZN5ArrayI12UnpackFilterE9CleanDataEv:
   39|      2|{
   40|      2|  Buffer=NULL;
   41|      2|  BufSize=0;
   42|      2|  AllocSize=0;
   43|      2|  MaxSize=0;
   44|      2|  Secure=false;
   45|      2|}
_ZN5ArrayIP14UnpackFilter30EC2Ev:
   49|      4|{
   50|      4|  CleanData();
   51|      4|}
_ZN5ArrayIP14UnpackFilter30E9CleanDataEv:
   39|      4|{
   40|      4|  Buffer=NULL;
   41|      4|  BufSize=0;
   42|      4|  AllocSize=0;
   43|      4|  MaxSize=0;
   44|      4|  Secure=false;
   45|      4|}
_ZN5ArrayIiEC2Ev:
   49|      2|{
   50|      2|  CleanData();
   51|      2|}
_ZN5ArrayIiE9CleanDataEv:
   39|      2|{
   40|      2|  Buffer=NULL;
   41|      2|  BufSize=0;
   42|      2|  AllocSize=0;
   43|      2|  MaxSize=0;
   44|      2|  Secure=false;
   45|      2|}
_ZN5ArrayI12UnpackFilterED2Ev:
   72|      2|{
   73|      2|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 0, False: 2]
  ------------------
   74|      0|  {
   75|      0|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 0]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      0|    free(Buffer);
   78|      0|  }
   79|      2|}
_ZN5ArrayIP14UnpackFilter30ED2Ev:
   72|      4|{
   73|      4|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 0, False: 4]
  ------------------
   74|      0|  {
   75|      0|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 0]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      0|    free(Buffer);
   78|      0|  }
   79|      4|}
_ZN5ArrayIiED2Ev:
   72|      2|{
   73|      2|  if (Buffer!=NULL)
  ------------------
  |  Branch (73:7): [True: 0, False: 2]
  ------------------
   74|      0|  {
   75|      0|    if (Secure)
  ------------------
  |  Branch (75:9): [True: 0, False: 0]
  ------------------
   76|      0|      cleandata(Buffer,AllocSize*sizeof(T));
   77|      0|    free(Buffer);
   78|      0|  }
   79|      2|}
_ZN5ArrayIlE5ResetEv:
  149|      2|{
  150|      2|  if (Buffer!=NULL)
  ------------------
  |  Branch (150:7): [True: 0, False: 2]
  ------------------
  151|      0|  {
  152|      0|    free(Buffer);
  153|      0|    Buffer=NULL;
  154|      0|  }
  155|      2|  BufSize=0;
  156|      2|  AllocSize=0;
  157|      2|}
_ZN5ArrayIwEC2Ev:
   49|     11|{
   50|     11|  CleanData();
   51|     11|}
_ZN5ArrayIwE9CleanDataEv:
   39|     11|{
   40|     11|  Buffer=NULL;
   41|     11|  BufSize=0;
   42|     11|  AllocSize=0;
   43|     11|  MaxSize=0;
   44|     11|  Secure=false;
   45|     11|}
_ZN5ArrayIwE3AddEm:
  101|      4|{
  102|      4|  BufSize+=Items;
  103|      4|  if (BufSize>AllocSize)
  ------------------
  |  Branch (103:7): [True: 4, False: 0]
  ------------------
  104|      4|  {
  105|      4|    if (MaxSize!=0 && BufSize>MaxSize)
  ------------------
  |  Branch (105:9): [True: 0, False: 4]
  |  Branch (105:23): [True: 0, False: 0]
  ------------------
  106|      0|    {
  107|      0|      ErrHandler.GeneralErrMsg(L"Maximum allowed array size (%u) is exceeded",MaxSize);
  108|      0|      ErrHandler.MemoryError();
  109|      0|    }
  110|       |
  111|      4|    size_t Suggested=AllocSize+AllocSize/4+32;
  112|      4|    size_t NewSize=Max(BufSize,Suggested);
  ------------------
  |  |    5|      4|#define  Max(x,y) (((x)>(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  113|       |
  114|      4|    T *NewBuffer;
  115|      4|    if (Secure)
  ------------------
  |  Branch (115:9): [True: 0, False: 4]
  ------------------
  116|      0|    {
  117|      0|      NewBuffer=(T *)malloc(NewSize*sizeof(T));
  118|      0|      if (NewBuffer==NULL)
  ------------------
  |  Branch (118:11): [True: 0, False: 0]
  ------------------
  119|      0|        ErrHandler.MemoryError();
  120|      0|      if (Buffer!=NULL)
  ------------------
  |  Branch (120:11): [True: 0, False: 0]
  ------------------
  121|      0|      {
  122|      0|        memcpy(NewBuffer,Buffer,AllocSize*sizeof(T));
  123|      0|        cleandata(Buffer,AllocSize*sizeof(T));
  124|      0|        free(Buffer);
  125|      0|      }
  126|      0|    }
  127|      4|    else
  128|      4|    {
  129|      4|      NewBuffer=(T *)realloc(Buffer,NewSize*sizeof(T));
  130|      4|      if (NewBuffer==NULL)
  ------------------
  |  Branch (130:11): [True: 0, False: 4]
  ------------------
  131|      0|        ErrHandler.MemoryError();
  132|      4|    }
  133|      4|    Buffer=NewBuffer;
  134|      4|    AllocSize=NewSize;
  135|      4|  }
  136|      4|}
_ZNK5ArrayIwEixEm:
   83|      9|{
   84|      9|  return Buffer[Item];
   85|      9|}
_ZN5ArrayIwE5ResetEv:
  149|     20|{
  150|     20|  if (Buffer!=NULL)
  ------------------
  |  Branch (150:7): [True: 0, False: 20]
  ------------------
  151|      0|  {
  152|      0|    free(Buffer);
  153|      0|    Buffer=NULL;
  154|      0|  }
  155|     20|  BufSize=0;
  156|     20|  AllocSize=0;
  157|     20|}
_ZN5ArrayIhE9SoftResetEv:
  163|      3|{
  164|      3|  BufSize=0;
  165|      3|}

_ZN13blake2s_stateC2Ev:
   37|     18|  {
   38|     18|    set_pointers();
   39|     18|  }
_ZN13blake2s_state12set_pointersEv:
   49|     18|  {
   50|       |    // Set aligned pointers. Must be done in constructor, not in Init(),
   51|       |    // so assignments like 'blake2sp_state res=blake2ctx' work correctly
   52|       |    // even if blake2sp_init is not called for 'res'.
   53|     18|    buf = (byte *) ALIGN_VALUE(ubuf, BLAKE_ALIGNMENT);
  ------------------
  |  |   29|     18|#define ALIGN_VALUE(v,a) (size_t(v) + ( (~size_t(v) + 1) & (a - 1) ) )
  ------------------
   54|     18|    h   = (uint32 *) (buf + 2 * BLAKE2S_BLOCKBYTES);
   55|     18|    t   = h + 8;
   56|     18|    f   = t + 2;
   57|     18|  }

_ZN11CommandDataC2Ev:
    7|      2|{
    8|      2|  Init();
    9|      2|}
_ZN11CommandData4InitEv:
   13|      2|{
   14|      2|  RAROptions::Init();
   15|       |
   16|      2|  *Command=0;
   17|      2|  *ArcName=0;
   18|      2|  FileLists=false;
   19|      2|  NoMoreSwitches=false;
   20|       |
   21|      2|  ListMode=RCLM_AUTO;
   22|       |
   23|      2|  BareOutput=false;
   24|       |
   25|       |
   26|      2|  FileArgs.Reset();
   27|      2|  ExclArgs.Reset();
   28|      2|  InclArgs.Reset();
   29|      2|  StoreArgs.Reset();
   30|      2|  ArcNames.Reset();
   31|      2|  NextVolSizes.Reset();
   32|      2|}
_ZN11CommandData8ParseArgEPw:
   93|      4|{
   94|      4|  if (IsSwitch(*Arg) && !NoMoreSwitches)
  ------------------
  |  Branch (94:7): [True: 2, False: 2]
  |  Branch (94:25): [True: 2, False: 0]
  ------------------
   95|      2|    if (Arg[1]=='-' && Arg[2]==0)
  ------------------
  |  Branch (95:9): [True: 0, False: 2]
  |  Branch (95:24): [True: 0, False: 0]
  ------------------
   96|      0|      NoMoreSwitches=true;
   97|      2|    else
   98|      2|      ProcessSwitch(Arg+1);
   99|      2|  else
  100|      2|    if (*Command==0)
  ------------------
  |  Branch (100:9): [True: 2, False: 0]
  ------------------
  101|      2|    {
  102|      2|      wcsncpyz(Command,Arg,ASIZE(Command));
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  103|       |
  104|       |
  105|      2|      *Command=toupperw(*Command);
  106|       |      // 'I' and 'S' commands can contain case sensitive strings after
  107|       |      // the first character, so we must not modify their case.
  108|       |      // 'S' can contain SFX name, which case is important in Unix.
  109|      2|      if (*Command!='I' && *Command!='S')
  ------------------
  |  Branch (109:11): [True: 2, False: 0]
  |  Branch (109:28): [True: 2, False: 0]
  ------------------
  110|      2|        wcsupper(Command);
  111|      2|      if (*Command=='P') // Enforce -idq for print command.
  ------------------
  |  Branch (111:11): [True: 0, False: 2]
  ------------------
  112|      0|      {
  113|      0|        MsgStream=MSG_ERRONLY;
  114|      0|        SetConsoleMsgStream(MSG_ERRONLY);
  115|      0|      }
  116|      2|    }
  117|      0|    else
  118|      0|      if (*ArcName==0)
  ------------------
  |  Branch (118:11): [True: 0, False: 0]
  ------------------
  119|      0|        wcsncpyz(ArcName,Arg,ASIZE(ArcName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  120|      0|      else
  121|      0|      {
  122|       |        // Check if last character is the path separator.
  123|      0|        size_t Length=wcslen(Arg);
  124|      0|        wchar EndChar=Length==0 ? 0:Arg[Length-1];
  ------------------
  |  Branch (124:23): [True: 0, False: 0]
  ------------------
  125|      0|        bool EndSeparator=IsDriveDiv(EndChar) || IsPathDiv(EndChar);
  ------------------
  |  Branch (125:27): [True: 0, False: 0]
  |  Branch (125:50): [True: 0, False: 0]
  ------------------
  126|       |
  127|      0|        wchar CmdChar=toupperw(*Command);
  128|      0|        bool Add=wcschr(L"AFUM",CmdChar)!=NULL;
  129|      0|        bool Extract=CmdChar=='X' || CmdChar=='E';
  ------------------
  |  Branch (129:22): [True: 0, False: 0]
  |  Branch (129:38): [True: 0, False: 0]
  ------------------
  130|      0|        bool Repair=CmdChar=='R' && Command[1]==0;
  ------------------
  |  Branch (130:21): [True: 0, False: 0]
  |  Branch (130:37): [True: 0, False: 0]
  ------------------
  131|      0|        if (EndSeparator && !Add)
  ------------------
  |  Branch (131:13): [True: 0, False: 0]
  |  Branch (131:29): [True: 0, False: 0]
  ------------------
  132|      0|          wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  133|      0|        else
  134|      0|          if ((Add || CmdChar=='T') && (*Arg!='@' || ListMode==RCLM_REJECT_LISTS))
  ------------------
  |  Branch (134:16): [True: 0, False: 0]
  |  Branch (134:23): [True: 0, False: 0]
  |  Branch (134:41): [True: 0, False: 0]
  |  Branch (134:54): [True: 0, False: 0]
  ------------------
  135|      0|            FileArgs.AddString(Arg);
  136|      0|          else
  137|      0|          {
  138|      0|            FindData FileData;
  139|      0|            bool Found=FindFile::FastFind(Arg,&FileData);
  140|      0|            if ((!Found || ListMode==RCLM_ACCEPT_LISTS) && 
  ------------------
  |  Branch (140:18): [True: 0, False: 0]
  |  Branch (140:28): [True: 0, False: 0]
  ------------------
  141|      0|                ListMode!=RCLM_REJECT_LISTS && *Arg=='@' && !IsWildcard(Arg+1))
  ------------------
  |  Branch (141:17): [True: 0, False: 0]
  |  Branch (141:48): [True: 0, False: 0]
  |  Branch (141:61): [True: 0, False: 0]
  ------------------
  142|      0|            {
  143|      0|              FileLists=true;
  144|       |
  145|      0|              ReadTextFile(Arg+1,&FileArgs,false,true,FilelistCharset,true,true,true);
  146|       |
  147|      0|            }
  148|      0|            else // We use 'destpath\' when extracting and reparing.
  149|      0|              if (Found && FileData.IsDir && (Extract || Repair) && *ExtrPath==0)
  ------------------
  |  Branch (149:19): [True: 0, False: 0]
  |  Branch (149:28): [True: 0, False: 0]
  |  Branch (149:47): [True: 0, False: 0]
  |  Branch (149:58): [True: 0, False: 0]
  |  Branch (149:69): [True: 0, False: 0]
  ------------------
  150|      0|              {
  151|      0|                wcsncpyz(ExtrPath,Arg,ASIZE(ExtrPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  152|      0|                AddEndSlash(ExtrPath,ASIZE(ExtrPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  153|      0|              }
  154|      0|              else
  155|      0|                FileArgs.AddString(Arg);
  156|      0|          }
  157|      0|      }
  158|      4|}
_ZN11CommandData9ParseDoneEv:
  163|      2|{
  164|      2|  if (FileArgs.ItemsCount()==0 && !FileLists)
  ------------------
  |  Branch (164:7): [True: 2, False: 0]
  |  Branch (164:35): [True: 2, False: 0]
  ------------------
  165|      2|    FileArgs.AddString(MASKALL);
  ------------------
  |  |  188|      2|#define MASKALL      L"*"
  ------------------
  166|      2|  wchar CmdChar=toupperw(Command[0]);
  167|      2|  bool Extract=CmdChar=='X' || CmdChar=='E' || CmdChar=='P';
  ------------------
  |  Branch (167:16): [True: 2, False: 0]
  |  Branch (167:32): [True: 0, False: 0]
  |  Branch (167:48): [True: 0, False: 0]
  ------------------
  168|      2|  if (Test && Extract)
  ------------------
  |  Branch (168:7): [True: 0, False: 2]
  |  Branch (168:15): [True: 0, False: 0]
  ------------------
  169|      0|    Test=false;        // Switch '-t' is senseless for 'X', 'E', 'P' commands.
  170|       |
  171|       |  // Suppress the copyright message and final end of line for 'lb' and 'vb'.
  172|      2|  if ((CmdChar=='L' || CmdChar=='V') && Command[1]=='B')
  ------------------
  |  Branch (172:8): [True: 0, False: 2]
  |  Branch (172:24): [True: 0, False: 2]
  |  Branch (172:41): [True: 0, False: 0]
  ------------------
  173|      0|    BareOutput=true;
  174|      2|}
_ZN11CommandData13ProcessSwitchEPKw:
  277|      2|{
  278|       |
  279|      2|  switch(toupperw(Switch[0]))
  280|      2|  {
  281|      0|    case '@':
  ------------------
  |  Branch (281:5): [True: 0, False: 2]
  ------------------
  282|      0|      ListMode=Switch[1]=='+' ? RCLM_ACCEPT_LISTS:RCLM_REJECT_LISTS;
  ------------------
  |  Branch (282:16): [True: 0, False: 0]
  ------------------
  283|      0|      break;
  284|      0|    case 'A':
  ------------------
  |  Branch (284:5): [True: 0, False: 2]
  ------------------
  285|      0|      switch(toupperw(Switch[1]))
  286|      0|      {
  287|      0|        case 'C':
  ------------------
  |  Branch (287:9): [True: 0, False: 0]
  ------------------
  288|      0|          ClearArc=true;
  289|      0|          break;
  290|      0|        case 'D':
  ------------------
  |  Branch (290:9): [True: 0, False: 0]
  ------------------
  291|      0|          if (Switch[2]==0)
  ------------------
  |  Branch (291:15): [True: 0, False: 0]
  ------------------
  292|      0|            AppendArcNameToPath=APPENDARCNAME_DESTPATH;
  293|      0|          else
  294|      0|            if (Switch[2]=='1')
  ------------------
  |  Branch (294:17): [True: 0, False: 0]
  ------------------
  295|      0|              AppendArcNameToPath=APPENDARCNAME_OWNSUBDIR;
  296|      0|            else
  297|      0|              if (Switch[2]=='2')
  ------------------
  |  Branch (297:19): [True: 0, False: 0]
  ------------------
  298|      0|                AppendArcNameToPath=APPENDARCNAME_OWNDIR;
  299|      0|          break;
  300|      0|#ifndef SFX_MODULE
  301|      0|        case 'G':
  ------------------
  |  Branch (301:9): [True: 0, False: 0]
  ------------------
  302|      0|          if (Switch[2]=='-' && Switch[3]==0)
  ------------------
  |  Branch (302:15): [True: 0, False: 0]
  |  Branch (302:33): [True: 0, False: 0]
  ------------------
  303|      0|            GenerateArcName=0;
  304|      0|          else
  305|      0|            if (toupperw(Switch[2])=='F')
  ------------------
  |  Branch (305:17): [True: 0, False: 0]
  ------------------
  306|      0|              wcsncpyz(DefGenerateMask,Switch+3,ASIZE(DefGenerateMask));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  307|      0|            else
  308|      0|            {
  309|      0|              GenerateArcName=true;
  310|      0|              wcsncpyz(GenerateMask,Switch+2,ASIZE(GenerateMask));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  311|      0|            }
  312|      0|          break;
  313|      0|#endif
  314|      0|        case 'I':
  ------------------
  |  Branch (314:9): [True: 0, False: 0]
  ------------------
  315|      0|          IgnoreGeneralAttr=true;
  316|      0|          break;
  317|      0|        case 'N': // Reserved for archive name.
  ------------------
  |  Branch (317:9): [True: 0, False: 0]
  ------------------
  318|      0|          break;
  319|      0|        case 'O':
  ------------------
  |  Branch (319:9): [True: 0, False: 0]
  ------------------
  320|      0|          AddArcOnly=true;
  321|      0|          break;
  322|      0|        case 'P':
  ------------------
  |  Branch (322:9): [True: 0, False: 0]
  ------------------
  323|      0|          wcsncpyz(ArcPath,Switch+2,ASIZE(ArcPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  324|      0|          break;
  325|      0|        case 'S':
  ------------------
  |  Branch (325:9): [True: 0, False: 0]
  ------------------
  326|      0|          SyncFiles=true;
  327|      0|          break;
  328|      0|        default:
  ------------------
  |  Branch (328:9): [True: 0, False: 0]
  ------------------
  329|      0|          BadSwitch(Switch);
  330|      0|          break;
  331|      0|      }
  332|      0|      break;
  333|      0|    case 'C':
  ------------------
  |  Branch (333:5): [True: 0, False: 2]
  ------------------
  334|      0|      if (Switch[2]==0)
  ------------------
  |  Branch (334:11): [True: 0, False: 0]
  ------------------
  335|      0|        switch(toupperw(Switch[1]))
  ------------------
  |  Branch (335:16): [True: 0, False: 0]
  ------------------
  336|      0|        {
  337|      0|          case '-':
  ------------------
  |  Branch (337:11): [True: 0, False: 0]
  ------------------
  338|      0|            DisableComment=true;
  339|      0|            break;
  340|      0|          case 'U':
  ------------------
  |  Branch (340:11): [True: 0, False: 0]
  ------------------
  341|      0|            ConvertNames=NAMES_UPPERCASE;
  342|      0|            break;
  343|      0|          case 'L':
  ------------------
  |  Branch (343:11): [True: 0, False: 0]
  ------------------
  344|      0|            ConvertNames=NAMES_LOWERCASE;
  345|      0|            break;
  346|      0|        }
  347|      0|      break;
  348|      0|    case 'D':
  ------------------
  |  Branch (348:5): [True: 0, False: 2]
  ------------------
  349|      0|      if (Switch[2]==0)
  ------------------
  |  Branch (349:11): [True: 0, False: 0]
  ------------------
  350|      0|        switch(toupperw(Switch[1]))
  ------------------
  |  Branch (350:16): [True: 0, False: 0]
  ------------------
  351|      0|        {
  352|      0|          case 'S':
  ------------------
  |  Branch (352:11): [True: 0, False: 0]
  ------------------
  353|      0|            DisableSortSolid=true;
  354|      0|            break;
  355|      0|          case 'H':
  ------------------
  |  Branch (355:11): [True: 0, False: 0]
  ------------------
  356|      0|            OpenShared=true;
  357|      0|            break;
  358|      0|          case 'F':
  ------------------
  |  Branch (358:11): [True: 0, False: 0]
  ------------------
  359|      0|            DeleteFiles=true;
  360|      0|            break;
  361|      0|        }
  362|      0|      break;
  363|      0|    case 'E':
  ------------------
  |  Branch (363:5): [True: 0, False: 2]
  ------------------
  364|      0|      switch(toupperw(Switch[1]))
  365|      0|      {
  366|      0|        case 'P':
  ------------------
  |  Branch (366:9): [True: 0, False: 0]
  ------------------
  367|      0|          switch(Switch[2])
  ------------------
  |  Branch (367:18): [True: 0, False: 0]
  ------------------
  368|      0|          {
  369|      0|            case 0:
  ------------------
  |  Branch (369:13): [True: 0, False: 0]
  ------------------
  370|      0|              ExclPath=EXCL_SKIPWHOLEPATH;
  371|      0|              break;
  372|      0|            case '1':
  ------------------
  |  Branch (372:13): [True: 0, False: 0]
  ------------------
  373|      0|              ExclPath=EXCL_BASEPATH;
  374|      0|              break;
  375|      0|            case '2':
  ------------------
  |  Branch (375:13): [True: 0, False: 0]
  ------------------
  376|      0|              ExclPath=EXCL_SAVEFULLPATH;
  377|      0|              break;
  378|      0|            case '3':
  ------------------
  |  Branch (378:13): [True: 0, False: 0]
  ------------------
  379|      0|              ExclPath=EXCL_ABSPATH;
  380|      0|              break;
  381|      0|            case '4':
  ------------------
  |  Branch (381:13): [True: 0, False: 0]
  ------------------
  382|      0|              wcsncpyz(ExclArcPath,Switch+3,ASIZE(ExclArcPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  383|      0|              break;
  384|      0|          }
  385|      0|          break;
  386|      0|        default:
  ------------------
  |  Branch (386:9): [True: 0, False: 0]
  ------------------
  387|      0|          if (Switch[1]=='+')
  ------------------
  |  Branch (387:15): [True: 0, False: 0]
  ------------------
  388|      0|          {
  389|      0|            InclFileAttr|=GetExclAttr(Switch+2,InclDir);
  390|      0|            InclAttrSet=true;
  391|      0|          }
  392|      0|          else
  393|      0|            ExclFileAttr|=GetExclAttr(Switch+1,ExclDir);
  394|      0|          break;
  395|      0|      }
  396|      0|      break;
  397|      0|    case 'F':
  ------------------
  |  Branch (397:5): [True: 0, False: 2]
  ------------------
  398|      0|      if (Switch[1]==0)
  ------------------
  |  Branch (398:11): [True: 0, False: 0]
  ------------------
  399|      0|        FreshFiles=true;
  400|      0|      else
  401|      0|        BadSwitch(Switch);
  402|      0|      break;
  403|      0|    case 'H':
  ------------------
  |  Branch (403:5): [True: 0, False: 2]
  ------------------
  404|      0|      switch (toupperw(Switch[1]))
  405|      0|      {
  406|      0|        case 'P':
  ------------------
  |  Branch (406:9): [True: 0, False: 0]
  ------------------
  407|      0|          EncryptHeaders=true;
  408|      0|          if (Switch[2]!=0)
  ------------------
  |  Branch (408:15): [True: 0, False: 0]
  ------------------
  409|      0|          {
  410|      0|            if (wcslen(Switch+2)>=MAXPASSWORD)
  ------------------
  |  |   14|      0|#define  MAXPASSWORD       128
  ------------------
  |  Branch (410:17): [True: 0, False: 0]
  ------------------
  411|      0|              uiMsg(UIERROR_TRUNCPSW,MAXPASSWORD-1);
  ------------------
  |  |   14|      0|#define  MAXPASSWORD       128
  ------------------
  412|      0|            Password.Set(Switch+2);
  413|      0|            cleandata((void *)Switch,wcslen(Switch)*sizeof(Switch[0]));
  414|      0|          }
  415|      0|          else
  416|      0|            if (!Password.IsSet())
  ------------------
  |  Branch (416:17): [True: 0, False: 0]
  ------------------
  417|      0|            {
  418|      0|              uiGetPassword(UIPASSWORD_GLOBAL,NULL,&Password);
  419|      0|              eprintf(L"\n");
  420|      0|            }
  421|      0|          break;
  422|      0|        default :
  ------------------
  |  Branch (422:9): [True: 0, False: 0]
  ------------------
  423|      0|          BadSwitch(Switch);
  424|      0|          break;
  425|      0|      }
  426|      0|      break;
  427|      0|    case 'I':
  ------------------
  |  Branch (427:5): [True: 0, False: 2]
  ------------------
  428|      0|      if (wcsnicomp(Switch+1,L"LOG",3)==0)
  ------------------
  |  Branch (428:11): [True: 0, False: 0]
  ------------------
  429|      0|      {
  430|      0|        wcsncpyz(LogName,Switch[4]!=0 ? Switch+4:DefLogName,ASIZE(LogName));
  ------------------
  |  |  183|      0|#define DefLogName     L".rarlog"
  ------------------
                      wcsncpyz(LogName,Switch[4]!=0 ? Switch+4:DefLogName,ASIZE(LogName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (430:26): [True: 0, False: 0]
  ------------------
  431|      0|        break;
  432|      0|      }
  433|      0|      if (wcsnicomp(Switch+1,L"SND",3)==0)
  ------------------
  |  Branch (433:11): [True: 0, False: 0]
  ------------------
  434|      0|      {
  435|      0|        Sound=Switch[4]=='-' ? SOUND_NOTIFY_OFF : SOUND_NOTIFY_ON;
  ------------------
  |  Branch (435:15): [True: 0, False: 0]
  ------------------
  436|      0|        break;
  437|      0|      }
  438|      0|      if (wcsicomp(Switch+1,L"ERR")==0)
  ------------------
  |  Branch (438:11): [True: 0, False: 0]
  ------------------
  439|      0|      {
  440|      0|        MsgStream=MSG_STDERR;
  441|       |        // Set it immediately when parsing the command line, so it also
  442|       |        // affects messages issued while parsing the command line.
  443|      0|        SetConsoleMsgStream(MSG_STDERR);
  444|      0|        break;
  445|      0|      }
  446|      0|      if (wcsnicomp(Switch+1,L"EML",3)==0)
  ------------------
  |  Branch (446:11): [True: 0, False: 0]
  ------------------
  447|      0|      {
  448|      0|        wcsncpyz(EmailTo,Switch[4]!=0 ? Switch+4:L"@",ASIZE(EmailTo));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (448:26): [True: 0, False: 0]
  ------------------
  449|      0|        break;
  450|      0|      }
  451|      0|      if (wcsicomp(Switch+1,L"M")==0) // For compatibility with pre-WinRAR 6.0 -im syntax. Replaced with -idv.
  ------------------
  |  Branch (451:11): [True: 0, False: 0]
  ------------------
  452|      0|      {
  453|      0|        VerboseOutput=true;
  454|      0|        break;
  455|      0|      }
  456|      0|      if (wcsicomp(Switch+1,L"NUL")==0)
  ------------------
  |  Branch (456:11): [True: 0, False: 0]
  ------------------
  457|      0|      {
  458|      0|        MsgStream=MSG_NULL;
  459|      0|        SetConsoleMsgStream(MSG_NULL);
  460|      0|        break;
  461|      0|      }
  462|      0|      if (toupperw(Switch[1])=='D')
  ------------------
  |  Branch (462:11): [True: 0, False: 0]
  ------------------
  463|      0|      {
  464|      0|        for (uint I=2;Switch[I]!=0;I++)
  ------------------
  |  Branch (464:23): [True: 0, False: 0]
  ------------------
  465|      0|          switch(toupperw(Switch[I]))
  ------------------
  |  Branch (465:18): [True: 0, False: 0]
  ------------------
  466|      0|          {
  467|      0|            case 'Q':
  ------------------
  |  Branch (467:13): [True: 0, False: 0]
  ------------------
  468|      0|              MsgStream=MSG_ERRONLY;
  469|      0|              SetConsoleMsgStream(MSG_ERRONLY);
  470|      0|              break;
  471|      0|            case 'C':
  ------------------
  |  Branch (471:13): [True: 0, False: 0]
  ------------------
  472|      0|              DisableCopyright=true;
  473|      0|              break;
  474|      0|            case 'D':
  ------------------
  |  Branch (474:13): [True: 0, False: 0]
  ------------------
  475|      0|              DisableDone=true;
  476|      0|              break;
  477|      0|            case 'P':
  ------------------
  |  Branch (477:13): [True: 0, False: 0]
  ------------------
  478|      0|              DisablePercentage=true;
  479|      0|              break;
  480|      0|            case 'N':
  ------------------
  |  Branch (480:13): [True: 0, False: 0]
  ------------------
  481|      0|              DisableNames=true;
  482|      0|              break;
  483|      0|            case 'V':
  ------------------
  |  Branch (483:13): [True: 0, False: 0]
  ------------------
  484|      0|              VerboseOutput=true;
  485|      0|              break;
  486|      0|          }
  487|      0|        break;
  488|      0|      }
  489|      0|      if (wcsnicomp(Switch+1,L"OFF",3)==0)
  ------------------
  |  Branch (489:11): [True: 0, False: 0]
  ------------------
  490|      0|      {
  491|      0|        switch(Switch[4])
  ------------------
  |  Branch (491:16): [True: 0, False: 0]
  ------------------
  492|      0|        {
  493|      0|          case 0:
  ------------------
  |  Branch (493:11): [True: 0, False: 0]
  ------------------
  494|      0|          case '1':
  ------------------
  |  Branch (494:11): [True: 0, False: 0]
  ------------------
  495|      0|            Shutdown=POWERMODE_OFF;
  496|      0|            break;
  497|      0|          case '2':
  ------------------
  |  Branch (497:11): [True: 0, False: 0]
  ------------------
  498|      0|            Shutdown=POWERMODE_HIBERNATE;
  499|      0|            break;
  500|      0|          case '3':
  ------------------
  |  Branch (500:11): [True: 0, False: 0]
  ------------------
  501|      0|            Shutdown=POWERMODE_SLEEP;
  502|      0|            break;
  503|      0|          case '4':
  ------------------
  |  Branch (503:11): [True: 0, False: 0]
  ------------------
  504|      0|            Shutdown=POWERMODE_RESTART;
  505|      0|            break;
  506|      0|        }
  507|      0|        break;
  508|      0|      }
  509|      0|      if (wcsicomp(Switch+1,L"VER")==0)
  ------------------
  |  Branch (509:11): [True: 0, False: 0]
  ------------------
  510|      0|      {
  511|      0|        PrintVersion=true;
  512|      0|        break;
  513|      0|      }
  514|      0|      break;
  515|      0|    case 'K':
  ------------------
  |  Branch (515:5): [True: 0, False: 2]
  ------------------
  516|      0|      switch(toupperw(Switch[1]))
  ------------------
  |  Branch (516:14): [True: 0, False: 0]
  ------------------
  517|      0|      {
  518|      0|        case 'B':
  ------------------
  |  Branch (518:9): [True: 0, False: 0]
  ------------------
  519|      0|          KeepBroken=true;
  520|      0|          break;
  521|      0|        case 0:
  ------------------
  |  Branch (521:9): [True: 0, False: 0]
  ------------------
  522|      0|          Lock=true;
  523|      0|          break;
  524|      0|      }
  525|      0|      break;
  526|      0|    case 'M':
  ------------------
  |  Branch (526:5): [True: 0, False: 2]
  ------------------
  527|      0|      switch(toupperw(Switch[1]))
  528|      0|      {
  529|      0|        case 'C':
  ------------------
  |  Branch (529:9): [True: 0, False: 0]
  ------------------
  530|      0|          {
  531|      0|            const wchar *Str=Switch+2;
  532|      0|            if (*Str=='-')
  ------------------
  |  Branch (532:17): [True: 0, False: 0]
  ------------------
  533|      0|              for (uint I=0;I<ASIZE(FilterModes);I++)
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (533:29): [True: 0, False: 0]
  ------------------
  534|      0|                FilterModes[I].State=FILTER_DISABLE;
  535|      0|            else
  536|      0|              while (*Str!=0)
  ------------------
  |  Branch (536:22): [True: 0, False: 0]
  ------------------
  537|      0|              {
  538|      0|                int Param1=0,Param2=0;
  539|      0|                FilterState State=FILTER_AUTO;
  540|      0|                FilterType Type=FILTER_NONE;
  541|      0|                if (IsDigit(*Str))
  ------------------
  |  Branch (541:21): [True: 0, False: 0]
  ------------------
  542|      0|                {
  543|      0|                  Param1=atoiw(Str);
  544|      0|                  while (IsDigit(*Str))
  ------------------
  |  Branch (544:26): [True: 0, False: 0]
  ------------------
  545|      0|                    Str++;
  546|      0|                }
  547|      0|                if (*Str==':' && IsDigit(Str[1]))
  ------------------
  |  Branch (547:21): [True: 0, False: 0]
  |  Branch (547:34): [True: 0, False: 0]
  ------------------
  548|      0|                {
  549|      0|                  Param2=atoiw(++Str);
  550|      0|                  while (IsDigit(*Str))
  ------------------
  |  Branch (550:26): [True: 0, False: 0]
  ------------------
  551|      0|                    Str++;
  552|      0|                }
  553|      0|                switch(toupperw(*(Str++)))
  ------------------
  |  Branch (553:24): [True: 0, False: 0]
  ------------------
  554|      0|                {
  555|      0|                  case 'T': Type=FILTER_PPM;         break;
  ------------------
  |  Branch (555:19): [True: 0, False: 0]
  ------------------
  556|      0|                  case 'E': Type=FILTER_E8;          break;
  ------------------
  |  Branch (556:19): [True: 0, False: 0]
  ------------------
  557|      0|                  case 'D': Type=FILTER_DELTA;       break;
  ------------------
  |  Branch (557:19): [True: 0, False: 0]
  ------------------
  558|      0|                  case 'A': Type=FILTER_AUDIO;       break;
  ------------------
  |  Branch (558:19): [True: 0, False: 0]
  ------------------
  559|      0|                  case 'C': Type=FILTER_RGB;         break;
  ------------------
  |  Branch (559:19): [True: 0, False: 0]
  ------------------
  560|      0|                  case 'R': Type=FILTER_ARM;         break;
  ------------------
  |  Branch (560:19): [True: 0, False: 0]
  ------------------
  561|      0|                }
  562|      0|                if (*Str=='+' || *Str=='-')
  ------------------
  |  Branch (562:21): [True: 0, False: 0]
  |  Branch (562:34): [True: 0, False: 0]
  ------------------
  563|      0|                  State=*(Str++)=='+' ? FILTER_FORCE:FILTER_DISABLE;
  ------------------
  |  Branch (563:25): [True: 0, False: 0]
  ------------------
  564|      0|                FilterModes[Type].State=State;
  565|      0|                FilterModes[Type].Param1=Param1;
  566|      0|                FilterModes[Type].Param2=Param2;
  567|      0|              }
  568|      0|            }
  569|      0|          break;
  570|      0|        case 'M':
  ------------------
  |  Branch (570:9): [True: 0, False: 0]
  ------------------
  571|      0|          break;
  572|      0|        case 'D':
  ------------------
  |  Branch (572:9): [True: 0, False: 0]
  ------------------
  573|      0|          break;
  574|      0|        case 'E':
  ------------------
  |  Branch (574:9): [True: 0, False: 0]
  ------------------
  575|      0|          if (toupperw(Switch[2])=='S' && Switch[3]==0)
  ------------------
  |  Branch (575:15): [True: 0, False: 0]
  |  Branch (575:43): [True: 0, False: 0]
  ------------------
  576|      0|            SkipEncrypted=true;
  577|      0|          break;
  578|      0|        case 'S':
  ------------------
  |  Branch (578:9): [True: 0, False: 0]
  ------------------
  579|      0|          {
  580|      0|            wchar StoreNames[1024];
  581|      0|            wcsncpyz(StoreNames,(Switch[2]==0 ? DefaultStoreList:Switch+2),ASIZE(StoreNames));
  ------------------
  |  |    5|      0|#define DefaultStoreList L"7z;ace;arj;bz2;cab;gz;jpeg;jpg;lha;lz;lzh;mp3;rar;taz;tgz;xz;z;zip;zipx"
  ------------------
                          wcsncpyz(StoreNames,(Switch[2]==0 ? DefaultStoreList:Switch+2),ASIZE(StoreNames));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (581:34): [True: 0, False: 0]
  ------------------
  582|      0|            wchar *Names=StoreNames;
  583|      0|            while (*Names!=0)
  ------------------
  |  Branch (583:20): [True: 0, False: 0]
  ------------------
  584|      0|            {
  585|      0|              wchar *End=wcschr(Names,';');
  586|      0|              if (End!=NULL)
  ------------------
  |  Branch (586:19): [True: 0, False: 0]
  ------------------
  587|      0|                *End=0;
  588|      0|              if (*Names=='.')
  ------------------
  |  Branch (588:19): [True: 0, False: 0]
  ------------------
  589|      0|                Names++;
  590|      0|              wchar Mask[NM];
  591|      0|              if (wcspbrk(Names,L"*?.")==NULL)
  ------------------
  |  Branch (591:19): [True: 0, False: 0]
  ------------------
  592|      0|                swprintf(Mask,ASIZE(Mask),L"*.%ls",Names);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  593|      0|              else
  594|      0|                wcsncpyz(Mask,Names,ASIZE(Mask));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  595|      0|              StoreArgs.AddString(Mask);
  596|      0|              if (End==NULL)
  ------------------
  |  Branch (596:19): [True: 0, False: 0]
  ------------------
  597|      0|                break;
  598|      0|              Names=End+1;
  599|      0|            }
  600|      0|          }
  601|      0|          break;
  602|      0|#ifdef RAR_SMP
  603|      0|        case 'T':
  ------------------
  |  Branch (603:9): [True: 0, False: 0]
  ------------------
  604|      0|          Threads=atoiw(Switch+2);
  605|      0|          if (Threads>MaxPoolThreads || Threads<1)
  ------------------
  |  Branch (605:15): [True: 0, False: 0]
  |  Branch (605:41): [True: 0, False: 0]
  ------------------
  606|      0|            BadSwitch(Switch);
  607|      0|          else
  608|      0|          {
  609|      0|          }
  610|      0|          break;
  611|      0|#endif
  612|      0|        default:
  ------------------
  |  Branch (612:9): [True: 0, False: 0]
  ------------------
  613|      0|          Method=Switch[1]-'0';
  614|      0|          if (Method>5 || Method<0)
  ------------------
  |  Branch (614:15): [True: 0, False: 0]
  |  Branch (614:27): [True: 0, False: 0]
  ------------------
  615|      0|            BadSwitch(Switch);
  616|      0|          break;
  617|      0|      }
  618|      0|      break;
  619|      0|    case 'N':
  ------------------
  |  Branch (619:5): [True: 0, False: 2]
  ------------------
  620|      0|    case 'X':
  ------------------
  |  Branch (620:5): [True: 0, False: 2]
  ------------------
  621|      0|      if (Switch[1]!=0)
  ------------------
  |  Branch (621:11): [True: 0, False: 0]
  ------------------
  622|      0|      {
  623|      0|        StringList *Args=toupperw(Switch[0])=='N' ? &InclArgs:&ExclArgs;
  ------------------
  |  Branch (623:26): [True: 0, False: 0]
  ------------------
  624|      0|        if (Switch[1]=='@' && !IsWildcard(Switch))
  ------------------
  |  Branch (624:13): [True: 0, False: 0]
  |  Branch (624:31): [True: 0, False: 0]
  ------------------
  625|      0|          ReadTextFile(Switch+2,Args,false,true,FilelistCharset,true,true,true);
  626|      0|        else
  627|      0|          Args->AddString(Switch+1);
  628|      0|      }
  629|      0|      break;
  630|      0|    case 'O':
  ------------------
  |  Branch (630:5): [True: 0, False: 2]
  ------------------
  631|      0|      switch(toupperw(Switch[1]))
  632|      0|      {
  633|      0|        case '+':
  ------------------
  |  Branch (633:9): [True: 0, False: 0]
  ------------------
  634|      0|          Overwrite=OVERWRITE_ALL;
  635|      0|          break;
  636|      0|        case '-':
  ------------------
  |  Branch (636:9): [True: 0, False: 0]
  ------------------
  637|      0|          Overwrite=OVERWRITE_NONE;
  638|      0|          break;
  639|      0|        case 0:
  ------------------
  |  Branch (639:9): [True: 0, False: 0]
  ------------------
  640|      0|          Overwrite=OVERWRITE_FORCE_ASK;
  641|      0|          break;
  642|       |#ifdef _WIN_ALL
  643|       |        case 'C':
  644|       |          SetCompressedAttr=true;
  645|       |          break;
  646|       |#endif
  647|      0|        case 'H':
  ------------------
  |  Branch (647:9): [True: 0, False: 0]
  ------------------
  648|      0|          SaveHardLinks=true;
  649|      0|          break;
  650|       |
  651|       |
  652|      0|#ifdef SAVE_LINKS
  653|      0|        case 'L':
  ------------------
  |  Branch (653:9): [True: 0, False: 0]
  ------------------
  654|      0|          SaveSymLinks=true;
  655|      0|          if (toupperw(Switch[2])=='A')
  ------------------
  |  Branch (655:15): [True: 0, False: 0]
  ------------------
  656|      0|            AbsoluteLinks=true;
  657|      0|          break;
  658|      0|#endif
  659|       |#ifdef _WIN_ALL
  660|       |        case 'N':
  661|       |          if (toupperw(Switch[2])=='I')
  662|       |            AllowIncompatNames=true;
  663|       |          break;
  664|       |#endif
  665|      0|        case 'P':
  ------------------
  |  Branch (665:9): [True: 0, False: 0]
  ------------------
  666|      0|          wcsncpyz(ExtrPath,Switch+2,ASIZE(ExtrPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  667|      0|          AddEndSlash(ExtrPath,ASIZE(ExtrPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  668|      0|          break;
  669|      0|        case 'R':
  ------------------
  |  Branch (669:9): [True: 0, False: 0]
  ------------------
  670|      0|          Overwrite=OVERWRITE_AUTORENAME;
  671|      0|          break;
  672|       |#ifdef _WIN_ALL
  673|       |        case 'S':
  674|       |          SaveStreams=true;
  675|       |          break;
  676|       |#endif
  677|      0|        case 'W':
  ------------------
  |  Branch (677:9): [True: 0, False: 0]
  ------------------
  678|      0|          ProcessOwners=true;
  679|      0|          break;
  680|      0|        default :
  ------------------
  |  Branch (680:9): [True: 0, False: 0]
  ------------------
  681|      0|          BadSwitch(Switch);
  682|      0|          break;
  683|      0|      }
  684|      0|      break;
  685|      2|    case 'P':
  ------------------
  |  Branch (685:5): [True: 2, False: 0]
  ------------------
  686|      2|      if (Switch[1]==0)
  ------------------
  |  Branch (686:11): [True: 2, False: 0]
  ------------------
  687|      2|      {
  688|      2|        uiGetPassword(UIPASSWORD_GLOBAL,NULL,&Password);
  689|      2|        eprintf(L"\n");
  690|      2|      }
  691|      0|      else
  692|      0|      {
  693|      0|        if (wcslen(Switch+1)>=MAXPASSWORD)
  ------------------
  |  |   14|      0|#define  MAXPASSWORD       128
  ------------------
  |  Branch (693:13): [True: 0, False: 0]
  ------------------
  694|      0|          uiMsg(UIERROR_TRUNCPSW,MAXPASSWORD-1);
  ------------------
  |  |   14|      0|#define  MAXPASSWORD       128
  ------------------
  695|      0|        Password.Set(Switch+1);
  696|      0|        cleandata((void *)Switch,wcslen(Switch)*sizeof(Switch[0]));
  697|      0|      }
  698|      2|      break;
  699|      0|#ifndef SFX_MODULE
  700|      0|    case 'Q':
  ------------------
  |  Branch (700:5): [True: 0, False: 2]
  ------------------
  701|      0|      if (toupperw(Switch[1])=='O')
  ------------------
  |  Branch (701:11): [True: 0, False: 0]
  ------------------
  702|      0|        switch(toupperw(Switch[2]))
  703|      0|        {
  704|      0|          case 0:
  ------------------
  |  Branch (704:11): [True: 0, False: 0]
  ------------------
  705|      0|            QOpenMode=QOPEN_AUTO;
  706|      0|            break;
  707|      0|          case '-':
  ------------------
  |  Branch (707:11): [True: 0, False: 0]
  ------------------
  708|      0|            QOpenMode=QOPEN_NONE;
  709|      0|            break;
  710|      0|          case '+':
  ------------------
  |  Branch (710:11): [True: 0, False: 0]
  ------------------
  711|      0|            QOpenMode=QOPEN_ALWAYS;
  712|      0|            break;
  713|      0|          default:
  ------------------
  |  Branch (713:11): [True: 0, False: 0]
  ------------------
  714|      0|            BadSwitch(Switch);
  715|      0|            break;
  716|      0|        }
  717|      0|      else
  718|      0|        BadSwitch(Switch);
  719|      0|      break;
  720|      0|#endif
  721|      0|    case 'R':
  ------------------
  |  Branch (721:5): [True: 0, False: 2]
  ------------------
  722|      0|      switch(toupperw(Switch[1]))
  ------------------
  |  Branch (722:14): [True: 0, False: 0]
  ------------------
  723|      0|      {
  724|      0|        case 0:
  ------------------
  |  Branch (724:9): [True: 0, False: 0]
  ------------------
  725|      0|          Recurse=RECURSE_ALWAYS;
  726|      0|          break;
  727|      0|        case '-':
  ------------------
  |  Branch (727:9): [True: 0, False: 0]
  ------------------
  728|      0|          Recurse=RECURSE_DISABLE;
  729|      0|          break;
  730|      0|        case '0':
  ------------------
  |  Branch (730:9): [True: 0, False: 0]
  ------------------
  731|      0|          Recurse=RECURSE_WILDCARDS;
  732|      0|          break;
  733|      0|        case 'I':
  ------------------
  |  Branch (733:9): [True: 0, False: 0]
  ------------------
  734|      0|          {
  735|      0|            Priority=atoiw(Switch+2);
  736|      0|            if (Priority<0 || Priority>15)
  ------------------
  |  Branch (736:17): [True: 0, False: 0]
  |  Branch (736:31): [True: 0, False: 0]
  ------------------
  737|      0|              BadSwitch(Switch);
  738|      0|            const wchar *ChPtr=wcschr(Switch+2,':');
  739|      0|            if (ChPtr!=NULL)
  ------------------
  |  Branch (739:17): [True: 0, False: 0]
  ------------------
  740|      0|            {
  741|      0|              SleepTime=atoiw(ChPtr+1);
  742|      0|              if (SleepTime>1000)
  ------------------
  |  Branch (742:19): [True: 0, False: 0]
  ------------------
  743|      0|                BadSwitch(Switch);
  744|      0|              InitSystemOptions(SleepTime);
  745|      0|            }
  746|      0|            SetPriority(Priority);
  747|      0|          }
  748|      0|          break;
  749|      0|      }
  750|      0|      break;
  751|      0|    case 'S':
  ------------------
  |  Branch (751:5): [True: 0, False: 2]
  ------------------
  752|      0|      if (IsDigit(Switch[1]))
  ------------------
  |  Branch (752:11): [True: 0, False: 0]
  ------------------
  753|      0|      {
  754|      0|        Solid|=SOLID_COUNT;
  755|      0|        SolidCount=atoiw(&Switch[1]);
  756|      0|      }
  757|      0|      else
  758|      0|        switch(toupperw(Switch[1]))
  ------------------
  |  Branch (758:16): [True: 0, False: 0]
  ------------------
  759|      0|        {
  760|      0|          case 0:
  ------------------
  |  Branch (760:11): [True: 0, False: 0]
  ------------------
  761|      0|            Solid|=SOLID_NORMAL;
  762|      0|            break;
  763|      0|          case '-':
  ------------------
  |  Branch (763:11): [True: 0, False: 0]
  ------------------
  764|      0|            Solid=SOLID_NONE;
  765|      0|            break;
  766|      0|          case 'E':
  ------------------
  |  Branch (766:11): [True: 0, False: 0]
  ------------------
  767|      0|            Solid|=SOLID_FILEEXT;
  768|      0|            break;
  769|      0|          case 'V':
  ------------------
  |  Branch (769:11): [True: 0, False: 0]
  ------------------
  770|      0|            Solid|=Switch[2]=='-' ? SOLID_VOLUME_DEPENDENT:SOLID_VOLUME_INDEPENDENT;
  ------------------
  |  Branch (770:20): [True: 0, False: 0]
  ------------------
  771|      0|            break;
  772|      0|          case 'D':
  ------------------
  |  Branch (772:11): [True: 0, False: 0]
  ------------------
  773|      0|            Solid|=SOLID_VOLUME_DEPENDENT;
  774|      0|            break;
  775|      0|          case 'I':
  ------------------
  |  Branch (775:11): [True: 0, False: 0]
  ------------------
  776|      0|            ProhibitConsoleInput();
  777|      0|            wcsncpyz(UseStdin,Switch[2] ? Switch+2:L"stdin",ASIZE(UseStdin));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (777:31): [True: 0, False: 0]
  ------------------
  778|      0|            break;
  779|      0|          case 'L':
  ------------------
  |  Branch (779:11): [True: 0, False: 0]
  ------------------
  780|      0|            if (IsDigit(Switch[2]))
  ------------------
  |  Branch (780:17): [True: 0, False: 0]
  ------------------
  781|      0|              FileSizeLess=atoilw(Switch+2);
  782|      0|            break;
  783|      0|          case 'M':
  ------------------
  |  Branch (783:11): [True: 0, False: 0]
  ------------------
  784|      0|            if (IsDigit(Switch[2]))
  ------------------
  |  Branch (784:17): [True: 0, False: 0]
  ------------------
  785|      0|              FileSizeMore=atoilw(Switch+2);
  786|      0|            break;
  787|      0|          case 'C':
  ------------------
  |  Branch (787:11): [True: 0, False: 0]
  ------------------
  788|      0|            {
  789|      0|              bool AlreadyBad=false; // Avoid reporting "bad switch" several times.
  790|       |
  791|      0|              RAR_CHARSET rch=RCH_DEFAULT;
  792|      0|              switch(toupperw(Switch[2]))
  793|      0|              {
  794|      0|                case 'A':
  ------------------
  |  Branch (794:17): [True: 0, False: 0]
  ------------------
  795|      0|                  rch=RCH_ANSI;
  796|      0|                  break;
  797|      0|                case 'O':
  ------------------
  |  Branch (797:17): [True: 0, False: 0]
  ------------------
  798|      0|                  rch=RCH_OEM;
  799|      0|                  break;
  800|      0|                case 'U':
  ------------------
  |  Branch (800:17): [True: 0, False: 0]
  ------------------
  801|      0|                  rch=RCH_UNICODE;
  802|      0|                  break;
  803|      0|                case 'F':
  ------------------
  |  Branch (803:17): [True: 0, False: 0]
  ------------------
  804|      0|                  rch=RCH_UTF8;
  805|      0|                  break;
  806|      0|                default :
  ------------------
  |  Branch (806:17): [True: 0, False: 0]
  ------------------
  807|      0|                  BadSwitch(Switch);
  808|      0|                  AlreadyBad=true;
  809|      0|                  break;
  810|      0|              };
  811|      0|              if (!AlreadyBad)
  ------------------
  |  Branch (811:19): [True: 0, False: 0]
  ------------------
  812|      0|                if (Switch[3]==0)
  ------------------
  |  Branch (812:21): [True: 0, False: 0]
  ------------------
  813|      0|                  CommentCharset=FilelistCharset=ErrlogCharset=RedirectCharset=rch;
  814|      0|                else
  815|      0|                  for (uint I=3;Switch[I]!=0 && !AlreadyBad;I++)
  ------------------
  |  Branch (815:33): [True: 0, False: 0]
  |  Branch (815:49): [True: 0, False: 0]
  ------------------
  816|      0|                    switch(toupperw(Switch[I]))
  817|      0|                    {
  818|      0|                      case 'C':
  ------------------
  |  Branch (818:23): [True: 0, False: 0]
  ------------------
  819|      0|                        CommentCharset=rch;
  820|      0|                        break;
  821|      0|                      case 'L':
  ------------------
  |  Branch (821:23): [True: 0, False: 0]
  ------------------
  822|      0|                        FilelistCharset=rch;
  823|      0|                        break;
  824|      0|                      case 'R':
  ------------------
  |  Branch (824:23): [True: 0, False: 0]
  ------------------
  825|      0|                        RedirectCharset=rch;
  826|      0|                        break;
  827|      0|                      default:
  ------------------
  |  Branch (827:23): [True: 0, False: 0]
  ------------------
  828|      0|                        BadSwitch(Switch);
  829|      0|                        AlreadyBad=true;
  830|      0|                        break;
  831|      0|                    }
  832|       |              // Set it immediately when parsing the command line, so it also
  833|       |              // affects messages issued while parsing the command line.
  834|      0|              SetConsoleRedirectCharset(RedirectCharset);
  835|      0|            }
  836|      0|            break;
  837|       |
  838|      0|        }
  839|      0|      break;
  840|      0|    case 'T':
  ------------------
  |  Branch (840:5): [True: 0, False: 2]
  ------------------
  841|      0|      switch(toupperw(Switch[1]))
  842|      0|      {
  843|      0|        case 'K':
  ------------------
  |  Branch (843:9): [True: 0, False: 0]
  ------------------
  844|      0|          ArcTime=ARCTIME_KEEP;
  845|      0|          break;
  846|      0|        case 'L':
  ------------------
  |  Branch (846:9): [True: 0, False: 0]
  ------------------
  847|      0|          ArcTime=ARCTIME_LATEST;
  848|      0|          break;
  849|      0|        case 'O':
  ------------------
  |  Branch (849:9): [True: 0, False: 0]
  ------------------
  850|      0|          SetTimeFilters(Switch+2,true,true);
  851|      0|          break;
  852|      0|        case 'N':
  ------------------
  |  Branch (852:9): [True: 0, False: 0]
  ------------------
  853|      0|          SetTimeFilters(Switch+2,false,true);
  854|      0|          break;
  855|      0|        case 'B':
  ------------------
  |  Branch (855:9): [True: 0, False: 0]
  ------------------
  856|      0|          SetTimeFilters(Switch+2,true,false);
  857|      0|          break;
  858|      0|        case 'A':
  ------------------
  |  Branch (858:9): [True: 0, False: 0]
  ------------------
  859|      0|          SetTimeFilters(Switch+2,false,false);
  860|      0|          break;
  861|      0|        case 'S':
  ------------------
  |  Branch (861:9): [True: 0, False: 0]
  ------------------
  862|      0|          SetStoreTimeMode(Switch+2);
  863|      0|          break;
  864|      0|        case '-':
  ------------------
  |  Branch (864:9): [True: 0, False: 0]
  ------------------
  865|      0|          Test=false;
  866|      0|          break;
  867|      0|        case 0:
  ------------------
  |  Branch (867:9): [True: 0, False: 0]
  ------------------
  868|      0|          Test=true;
  869|      0|          break;
  870|      0|        default:
  ------------------
  |  Branch (870:9): [True: 0, False: 0]
  ------------------
  871|      0|          BadSwitch(Switch);
  872|      0|          break;
  873|      0|      }
  874|      0|      break;
  875|      0|    case 'U':
  ------------------
  |  Branch (875:5): [True: 0, False: 2]
  ------------------
  876|      0|      if (Switch[1]==0)
  ------------------
  |  Branch (876:11): [True: 0, False: 0]
  ------------------
  877|      0|        UpdateFiles=true;
  878|      0|      else
  879|      0|        BadSwitch(Switch);
  880|      0|      break;
  881|      0|    case 'V':
  ------------------
  |  Branch (881:5): [True: 0, False: 2]
  ------------------
  882|      0|      switch(toupperw(Switch[1]))
  883|      0|      {
  884|      0|        case 'P':
  ------------------
  |  Branch (884:9): [True: 0, False: 0]
  ------------------
  885|      0|          VolumePause=true;
  886|      0|          break;
  887|      0|        case 'E':
  ------------------
  |  Branch (887:9): [True: 0, False: 0]
  ------------------
  888|      0|          if (toupperw(Switch[2])=='R')
  ------------------
  |  Branch (888:15): [True: 0, False: 0]
  ------------------
  889|      0|            VersionControl=atoiw(Switch+3)+1;
  890|      0|          break;
  891|      0|        case '-':
  ------------------
  |  Branch (891:9): [True: 0, False: 0]
  ------------------
  892|      0|          VolSize=0;
  893|      0|          break;
  894|      0|        default:
  ------------------
  |  Branch (894:9): [True: 0, False: 0]
  ------------------
  895|      0|          VolSize=VOLSIZE_AUTO; // UnRAR -v switch for list command.
  ------------------
  |  |    8|      0|#define VOLSIZE_AUTO   INT64NDF // Automatically detect the volume size.
  |  |  ------------------
  |  |  |  |   30|      0|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  |  |  ------------------
  |  |  |  |  |  |   19|      0|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  896|      0|          break;
  897|      0|      }
  898|      0|      break;
  899|      0|    case 'W':
  ------------------
  |  Branch (899:5): [True: 0, False: 2]
  ------------------
  900|      0|      wcsncpyz(TempPath,Switch+1,ASIZE(TempPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  901|      0|      AddEndSlash(TempPath,ASIZE(TempPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  902|      0|      break;
  903|      0|    case 'Y':
  ------------------
  |  Branch (903:5): [True: 0, False: 2]
  ------------------
  904|      0|      AllYes=true;
  905|      0|      break;
  906|      0|    case 'Z':
  ------------------
  |  Branch (906:5): [True: 0, False: 2]
  ------------------
  907|      0|      if (Switch[1]==0)
  ------------------
  |  Branch (907:11): [True: 0, False: 0]
  ------------------
  908|      0|      {
  909|       |        // If comment file is not specified, we read data from stdin.
  910|      0|        wcsncpyz(CommentFile,L"stdin",ASIZE(CommentFile));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  911|      0|      }
  912|      0|      else
  913|      0|        wcsncpyz(CommentFile,Switch+1,ASIZE(CommentFile));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  914|      0|      break;
  915|      0|    case '?' :
  ------------------
  |  Branch (915:5): [True: 0, False: 2]
  ------------------
  916|      0|      OutHelp(RARX_SUCCESS);
  917|      0|      break;
  918|      0|    default :
  ------------------
  |  Branch (918:5): [True: 0, False: 2]
  ------------------
  919|      0|      BadSwitch(Switch);
  920|      0|      break;
  921|      2|  }
  922|      2|}
_ZN11CommandData10AddArcNameEPKw:
 1007|      2|{
 1008|      2|  ArcNames.AddString(Name);
 1009|      2|}
_ZN11CommandData10GetArcNameEPwi:
 1013|      8|{
 1014|      8|  return ArcNames.GetString(Name,MaxSize);
 1015|      8|}
_ZN11CommandData8IsSwitchEi:
 1019|      4|{
 1020|       |#if defined(_WIN_ALL) || defined(_EMX)
 1021|       |  return Ch=='-' || Ch=='/';
 1022|       |#else
 1023|      4|  return Ch=='-';
 1024|      4|#endif
 1025|      4|}

_ZN11CommandData9ExclCheckEPKwbbb:
    5|      1|{
    6|      1|  if (CheckArgs(&ExclArgs,Dir,CheckName,CheckFullPath,MATCH_WILDSUBPATH))
  ------------------
  |  Branch (6:7): [True: 0, False: 1]
  ------------------
    7|      0|    return true;
    8|      1|  if (!CheckInclList || InclArgs.ItemsCount()==0)
  ------------------
  |  Branch (8:7): [True: 0, False: 1]
  |  Branch (8:25): [True: 1, False: 0]
  ------------------
    9|      1|    return false;
   10|      0|  if (CheckArgs(&InclArgs,Dir,CheckName,CheckFullPath,MATCH_WILDSUBPATH))
  ------------------
  |  Branch (10:7): [True: 0, False: 0]
  ------------------
   11|      0|    return false;
   12|      0|  return true;
   13|      0|}
_ZN11CommandData9CheckArgsEP10StringListbPKwbi:
   17|      1|{
   18|      1|  wchar *Name=ConvertPath(CheckName,NULL,0);
   19|      1|  wchar FullName[NM];
   20|      1|  wchar CurMask[NM];
   21|      1|  *FullName=0;
   22|      1|  Args->Rewind();
   23|      1|  while (Args->GetString(CurMask,ASIZE(CurMask)))
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (23:10): [True: 0, False: 1]
  ------------------
   24|      0|  {
   25|      0|    wchar *LastMaskChar=PointToLastChar(CurMask);
   26|      0|    bool DirMask=IsPathDiv(*LastMaskChar); // Mask for directories only.
   27|       |
   28|      0|    if (Dir)
  ------------------
  |  Branch (28:9): [True: 0, False: 0]
  ------------------
   29|      0|    {
   30|       |      // CheckName is a directory.
   31|      0|      if (DirMask)
  ------------------
  |  Branch (31:11): [True: 0, False: 0]
  ------------------
   32|      0|      {
   33|       |        // We process the directory and have the directory exclusion mask.
   34|       |        // So let's convert "mask\" to "mask" and process it normally.
   35|       |        
   36|      0|        *LastMaskChar=0;
   37|      0|      }
   38|      0|      else
   39|      0|      {
   40|       |        // REMOVED, we want -npath\* to match empty folders too.
   41|       |        // If mask has wildcards in name part and does not have the trailing
   42|       |        // '\' character, we cannot use it for directories.
   43|       |      
   44|       |        // if (IsWildcard(PointToName(CurMask)))
   45|       |        //  continue;
   46|      0|      }
   47|      0|    }
   48|      0|    else
   49|      0|    {
   50|       |      // If we process a file inside of directory excluded by "dirmask\".
   51|       |      // we want to exclude such file too. So we convert "dirmask\" to
   52|       |      // "dirmask\*". It is important for operations other than archiving
   53|       |      // with -x. When archiving with -x, directory matched by "dirmask\"
   54|       |      // is excluded from further scanning.
   55|       |
   56|      0|      if (DirMask)
  ------------------
  |  Branch (56:11): [True: 0, False: 0]
  ------------------
   57|      0|        wcsncatz(CurMask,L"*",ASIZE(CurMask));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   58|      0|    }
   59|       |
   60|      0|#ifndef SFX_MODULE
   61|      0|    if (CheckFullPath && IsFullPath(CurMask))
  ------------------
  |  Branch (61:9): [True: 0, False: 0]
  |  Branch (61:26): [True: 0, False: 0]
  ------------------
   62|      0|    {
   63|       |      // We do not need to do the special "*\" processing here, because
   64|       |      // unlike the "else" part of this "if", now we convert names to full
   65|       |      // format, so they all include the path, which is matched by "*\"
   66|       |      // correctly. Moreover, removing "*\" from mask would break
   67|       |      // the comparison, because now all names have the path.
   68|       |
   69|      0|      if (*FullName==0)
  ------------------
  |  Branch (69:11): [True: 0, False: 0]
  ------------------
   70|      0|        ConvertNameToFull(CheckName,FullName,ASIZE(FullName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   71|      0|      if (CmpName(CurMask,FullName,MatchMode))
  ------------------
  |  Branch (71:11): [True: 0, False: 0]
  ------------------
   72|      0|        return true;
   73|      0|    }
   74|      0|    else
   75|      0|#endif
   76|      0|    {
   77|      0|      wchar NewName[NM+2],*CurName=Name;
   78|       |
   79|       |      // Important to convert before "*\" check below, so masks like
   80|       |      // d:*\something are processed properly.
   81|      0|      wchar *CmpMask=ConvertPath(CurMask,NULL,0);
   82|       |
   83|      0|      if (CmpMask[0]=='*' && IsPathDiv(CmpMask[1]))
  ------------------
  |  Branch (83:11): [True: 0, False: 0]
  |  Branch (83:30): [True: 0, False: 0]
  ------------------
   84|      0|      {
   85|       |        // We want "*\name" to match 'name' not only in subdirectories,
   86|       |        // but also in the current directory. We convert the name
   87|       |        // from 'name' to '.\name' to be matched by "*\" part even if it is
   88|       |        // in current directory.
   89|      0|        NewName[0]='.';
   90|      0|        NewName[1]=CPATHDIVIDER;
  ------------------
  |  |  187|      0|#define CPATHDIVIDER '/'
  ------------------
   91|      0|        wcsncpyz(NewName+2,Name,ASIZE(NewName)-2);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   92|      0|        CurName=NewName;
   93|      0|      }
   94|       |
   95|      0|      if (CmpName(CmpMask,CurName,MatchMode))
  ------------------
  |  Branch (95:11): [True: 0, False: 0]
  ------------------
   96|      0|        return true;
   97|      0|    }
   98|      0|  }
   99|      1|  return false;
  100|      1|}
_ZN11CommandData9TimeCheckER7RarTimeS1_S1_:
  193|      1|{
  194|      1|  bool FilterOR=false;
  195|       |
  196|      1|  if (FileMtimeBefore.IsSet()) // Filter present.
  ------------------
  |  Branch (196:7): [True: 0, False: 1]
  ------------------
  197|      0|    if (ftm>=FileMtimeBefore) // Condition not matched.
  ------------------
  |  Branch (197:9): [True: 0, False: 0]
  ------------------
  198|      0|      if (FileMtimeBeforeOR) 
  ------------------
  |  Branch (198:11): [True: 0, False: 0]
  ------------------
  199|      0|        FilterOR=true; // Not matched OR filter is present.
  200|      0|      else
  201|      0|        return true; // Exclude file in AND mode.
  202|      0|    else  // Condition matched.
  203|      0|      if (FileMtimeBeforeOR) 
  ------------------
  |  Branch (203:11): [True: 0, False: 0]
  ------------------
  204|      0|        return false; // Include file in OR mode.
  205|       |
  206|      1|  if (FileMtimeAfter.IsSet()) // Filter present.
  ------------------
  |  Branch (206:7): [True: 0, False: 1]
  ------------------
  207|      0|    if (ftm<FileMtimeAfter) // Condition not matched.
  ------------------
  |  Branch (207:9): [True: 0, False: 0]
  ------------------
  208|      0|      if (FileMtimeAfterOR) 
  ------------------
  |  Branch (208:11): [True: 0, False: 0]
  ------------------
  209|      0|        FilterOR=true; // Not matched OR filter is present.
  210|      0|      else
  211|      0|        return true; // Exclude file in AND mode.
  212|      0|    else  // Condition matched.
  213|      0|      if (FileMtimeAfterOR) 
  ------------------
  |  Branch (213:11): [True: 0, False: 0]
  ------------------
  214|      0|        return false; // Include file in OR mode.
  215|       |
  216|      1|  if (FileCtimeBefore.IsSet()) // Filter present.
  ------------------
  |  Branch (216:7): [True: 0, False: 1]
  ------------------
  217|      0|    if (ftc>=FileCtimeBefore) // Condition not matched.
  ------------------
  |  Branch (217:9): [True: 0, False: 0]
  ------------------
  218|      0|      if (FileCtimeBeforeOR) 
  ------------------
  |  Branch (218:11): [True: 0, False: 0]
  ------------------
  219|      0|        FilterOR=true; // Not matched OR filter is present.
  220|      0|      else
  221|      0|        return true; // Exclude file in AND mode.
  222|      0|    else  // Condition matched.
  223|      0|      if (FileCtimeBeforeOR) 
  ------------------
  |  Branch (223:11): [True: 0, False: 0]
  ------------------
  224|      0|        return false; // Include file in OR mode.
  225|       |
  226|      1|  if (FileCtimeAfter.IsSet()) // Filter present.
  ------------------
  |  Branch (226:7): [True: 0, False: 1]
  ------------------
  227|      0|    if (ftc<FileCtimeAfter) // Condition not matched.
  ------------------
  |  Branch (227:9): [True: 0, False: 0]
  ------------------
  228|      0|      if (FileCtimeAfterOR) 
  ------------------
  |  Branch (228:11): [True: 0, False: 0]
  ------------------
  229|      0|        FilterOR=true; // Not matched OR filter is present.
  230|      0|      else
  231|      0|        return true; // Exclude file in AND mode.
  232|      0|    else  // Condition matched.
  233|      0|      if (FileCtimeAfterOR) 
  ------------------
  |  Branch (233:11): [True: 0, False: 0]
  ------------------
  234|      0|        return false; // Include file in OR mode.
  235|       |
  236|      1|  if (FileAtimeBefore.IsSet()) // Filter present.
  ------------------
  |  Branch (236:7): [True: 0, False: 1]
  ------------------
  237|      0|    if (fta>=FileAtimeBefore) // Condition not matched.
  ------------------
  |  Branch (237:9): [True: 0, False: 0]
  ------------------
  238|      0|      if (FileAtimeBeforeOR) 
  ------------------
  |  Branch (238:11): [True: 0, False: 0]
  ------------------
  239|      0|        FilterOR=true; // Not matched OR filter is present.
  240|      0|      else
  241|      0|        return true; // Exclude file in AND mode.
  242|      0|    else  // Condition matched.
  243|      0|      if (FileAtimeBeforeOR) 
  ------------------
  |  Branch (243:11): [True: 0, False: 0]
  ------------------
  244|      0|        return false; // Include file in OR mode.
  245|       |
  246|      1|  if (FileAtimeAfter.IsSet()) // Filter present.
  ------------------
  |  Branch (246:7): [True: 0, False: 1]
  ------------------
  247|      0|    if (fta<FileAtimeAfter) // Condition not matched.
  ------------------
  |  Branch (247:9): [True: 0, False: 0]
  ------------------
  248|      0|      if (FileAtimeAfterOR) 
  ------------------
  |  Branch (248:11): [True: 0, False: 0]
  ------------------
  249|      0|        FilterOR=true; // Not matched OR filter is present.
  250|      0|      else
  251|      0|        return true; // Exclude file in AND mode.
  252|      0|    else  // Condition matched.
  253|      0|      if (FileAtimeAfterOR) 
  ------------------
  |  Branch (253:11): [True: 0, False: 0]
  ------------------
  254|      0|        return false; // Include file in OR mode.
  255|       |
  256|      1|  return FilterOR; // Exclude if all OR filters are not matched.
  257|      1|}
_ZN11CommandData9SizeCheckEl:
  264|      1|{
  265|      1|  if (Size==INT64NDF) // If called from archive formats like bzip2, not storing the file size.
  ------------------
  |  |   30|      1|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  ------------------
  |  |  |  |   19|      1|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
  |  Branch (265:7): [True: 0, False: 1]
  ------------------
  266|      0|    return false;
  267|      1|  if (FileSizeLess!=INT64NDF && Size>=FileSizeLess)
  ------------------
  |  |   30|      1|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  ------------------
  |  |  |  |   19|      2|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
  |  Branch (267:7): [True: 0, False: 1]
  |  Branch (267:33): [True: 0, False: 0]
  ------------------
  268|      0|    return true;
  269|      1|  if (FileSizeMore!=INT64NDF && Size<=FileSizeMore)
  ------------------
  |  |   30|      1|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  ------------------
  |  |  |  |   19|      2|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
  |  Branch (269:7): [True: 0, False: 1]
  |  Branch (269:33): [True: 0, False: 0]
  ------------------
  270|      0|    return true;
  271|      1|  return false;
  272|      1|}
_ZN11CommandData13IsProcessFileER10FileHeaderPbibPwj:
  281|      1|{
  282|      1|  if (MatchedArg!=NULL && MatchedArgSize>0)
  ------------------
  |  Branch (282:7): [True: 1, False: 0]
  |  Branch (282:27): [True: 1, False: 0]
  ------------------
  283|      1|    *MatchedArg=0;
  284|      1|  bool Dir=FileHead.Dir;
  285|      1|  if (ExclCheck(FileHead.FileName,Dir,false,true))
  ------------------
  |  Branch (285:7): [True: 0, False: 1]
  ------------------
  286|      0|    return 0;
  287|      1|#ifndef SFX_MODULE
  288|      1|  if (TimeCheck(FileHead.mtime,FileHead.ctime,FileHead.atime))
  ------------------
  |  Branch (288:7): [True: 0, False: 1]
  ------------------
  289|      0|    return 0;
  290|      1|  if ((FileHead.FileAttr & ExclFileAttr)!=0 || FileHead.Dir && ExclDir)
  ------------------
  |  Branch (290:7): [True: 0, False: 1]
  |  Branch (290:48): [True: 0, False: 1]
  |  Branch (290:64): [True: 0, False: 0]
  ------------------
  291|      0|    return 0;
  292|      1|  if (InclAttrSet && (!FileHead.Dir && (FileHead.FileAttr & InclFileAttr)==0 ||
  ------------------
  |  Branch (292:7): [True: 0, False: 1]
  |  Branch (292:23): [True: 0, False: 0]
  |  Branch (292:40): [True: 0, False: 0]
  ------------------
  293|      0|      FileHead.Dir && !InclDir))
  ------------------
  |  Branch (293:7): [True: 0, False: 0]
  |  Branch (293:23): [True: 0, False: 0]
  ------------------
  294|      0|    return 0;
  295|      1|  if (!Dir && SizeCheck(FileHead.UnpSize))
  ------------------
  |  Branch (295:7): [True: 1, False: 0]
  |  Branch (295:15): [True: 0, False: 1]
  ------------------
  296|      0|    return 0;
  297|      1|#endif
  298|      1|  wchar *ArgName;
  299|      1|  FileArgs.Rewind();
  300|      1|  for (int StringCount=1;(ArgName=FileArgs.GetString())!=NULL;StringCount++)
  ------------------
  |  Branch (300:26): [True: 1, False: 0]
  ------------------
  301|      1|    if (CmpName(ArgName,FileHead.FileName,MatchType))
  ------------------
  |  Branch (301:9): [True: 1, False: 0]
  ------------------
  302|      1|    {
  303|      1|      if (ExactMatch!=NULL)
  ------------------
  |  Branch (303:11): [True: 1, False: 0]
  ------------------
  304|      1|        *ExactMatch=wcsicompc(ArgName,FileHead.FileName)==0;
  305|      1|      if (MatchedArg!=NULL)
  ------------------
  |  Branch (305:11): [True: 1, False: 0]
  ------------------
  306|      1|        wcsncpyz(MatchedArg,ArgName,MatchedArgSize);
  307|      1|      return StringCount;
  308|      1|    }
  309|      0|  return 0;
  310|      1|}

_Z7mprintfPKwz:
   15|      4|  inline void mprintf(const wchar *fmt,...) {}
_Z7eprintfPKwz:
   16|      2|  inline void eprintf(const wchar *fmt,...) {}

_Z9InitCRC32Pj:
   29|      2|{
   30|      2|  if (CRCTab[1]!=0)
  ------------------
  |  Branch (30:7): [True: 0, False: 2]
  ------------------
   31|      0|    return;
   32|    514|  for (uint I=0;I<256;I++)
  ------------------
  |  Branch (32:17): [True: 512, False: 2]
  ------------------
   33|    512|  {
   34|    512|    uint C=I;
   35|  4.60k|    for (uint J=0;J<8;J++)
  ------------------
  |  Branch (35:19): [True: 4.09k, False: 512]
  ------------------
   36|  4.09k|      C=(C & 1) ? (C>>1)^0xEDB88320 : (C>>1);
  ------------------
  |  Branch (36:9): [True: 2.04k, False: 2.04k]
  ------------------
   37|    512|    CRCTab[I]=C;
   38|    512|  }
   39|      2|}
_Z5CRC32jPKvm:
   63|      1|{
   64|      1|  byte *Data=(byte *)Addr;
   65|       |
   66|      1|#ifdef USE_SLICING
   67|       |  // Align Data to 8 for better performance.
   68|      5|  for (;Size>0 && ((size_t)Data & 7);Size--,Data++)
  ------------------
  |  Branch (68:9): [True: 5, False: 0]
  |  Branch (68:19): [True: 4, False: 1]
  ------------------
   69|      4|    StartCRC=crc_tables[0][(byte)(StartCRC^Data[0])]^(StartCRC>>8);
   70|       |
   71|      6|  for (;Size>=8;Size-=8,Data+=8)
  ------------------
  |  Branch (71:9): [True: 5, False: 1]
  ------------------
   72|      5|  {
   73|       |#ifdef BIG_ENDIAN
   74|       |    StartCRC ^= Data[0]|(Data[1] << 8)|(Data[2] << 16)|(Data[3] << 24);
   75|       |    uint NextData = Data[4]|(Data[5] << 8)|(Data[6] << 16)|(Data[7] << 24);
   76|       |#else
   77|      5|    StartCRC ^= *(uint32 *) Data;
   78|      5|    uint NextData = *(uint32 *) (Data+4);
   79|      5|#endif
   80|      5|    StartCRC = crc_tables[7][(byte) StartCRC       ] ^
   81|      5|               crc_tables[6][(byte)(StartCRC >> 8) ] ^
   82|      5|               crc_tables[5][(byte)(StartCRC >> 16)] ^
   83|      5|               crc_tables[4][(byte)(StartCRC >> 24)] ^
   84|      5|               crc_tables[3][(byte) NextData       ] ^
   85|      5|               crc_tables[2][(byte)(NextData >> 8) ] ^
   86|      5|               crc_tables[1][(byte)(NextData >> 16)] ^
   87|      5|               crc_tables[0][(byte)(NextData >> 24)];
   88|      5|  }
   89|      1|#endif
   90|       |
   91|      4|  for (;Size>0;Size--,Data++) // Process left data.
  ------------------
  |  Branch (91:9): [True: 3, False: 1]
  ------------------
   92|      3|    StartCRC=crc_tables[0][(byte)(StartCRC^Data[0])]^(StartCRC>>8);
   93|       |
   94|      1|  return StartCRC;
   95|      1|}
_ZN11CallInitCRCC2Ev:
   60|      2|struct CallInitCRC {CallInitCRC() {InitTables();}} static CallInit32;
crc.cpp:_ZL10InitTablesv:
   43|      2|{
   44|      2|  InitCRC32(crc_tables[0]);
   45|       |
   46|      2|#ifdef USE_SLICING
   47|    514|  for (uint I=0;I<256;I++) // Build additional lookup tables.
  ------------------
  |  Branch (47:17): [True: 512, False: 2]
  ------------------
   48|    512|  {
   49|    512|    uint C=crc_tables[0][I];
   50|  4.09k|    for (uint J=1;J<8;J++)
  ------------------
  |  Branch (50:19): [True: 3.58k, False: 512]
  ------------------
   51|  3.58k|    {
   52|  3.58k|      C=crc_tables[0][(byte)C]^(C>>8);
   53|  3.58k|      crc_tables[J][I]=C;
   54|  3.58k|    }
   55|    512|  }
   56|      2|#endif
   57|      2|}

_ZN9CryptDataC2Ev:
   12|     12|{
   13|     12|  Method=CRYPT_NONE;
   14|     12|  memset(KDF3Cache,0,sizeof(KDF3Cache));
   15|     12|  memset(KDF5Cache,0,sizeof(KDF5Cache));
   16|     12|  KDF3CachePos=0;
   17|     12|  KDF5CachePos=0;
   18|     12|  memset(CRCTab,0,sizeof(CRCTab));
   19|     12|}
_ZN9CryptDataD2Ev:
   23|     12|{
   24|     12|  cleandata(KDF3Cache,sizeof(KDF3Cache));
   25|     12|  cleandata(KDF5Cache,sizeof(KDF5Cache));
   26|     12|}
_ZN9CryptData12SetCryptKeysEb12CRYPT_METHODP11SecPasswordPKhS4_jPhS5_:
   58|      1|{
   59|      1|  if (!Password->IsSet() || Method==CRYPT_NONE)
  ------------------
  |  Branch (59:7): [True: 1, False: 0]
  |  Branch (59:29): [True: 0, False: 0]
  ------------------
   60|      1|    return false;
   61|       |
   62|      0|  CryptData::Method=Method;
   63|       |
   64|      0|  wchar PwdW[MAXPASSWORD];
   65|      0|  Password->Get(PwdW,ASIZE(PwdW));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   66|      0|  char PwdA[MAXPASSWORD];
   67|      0|  WideToChar(PwdW,PwdA,ASIZE(PwdA));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   68|       |
   69|      0|  switch(Method)
  ------------------
  |  Branch (69:10): [True: 0, False: 0]
  ------------------
   70|      0|  {
   71|      0|#ifndef SFX_MODULE
   72|      0|    case CRYPT_RAR13:
  ------------------
  |  Branch (72:5): [True: 0, False: 0]
  ------------------
   73|      0|      SetKey13(PwdA);
   74|      0|      break;
   75|      0|    case CRYPT_RAR15:
  ------------------
  |  Branch (75:5): [True: 0, False: 0]
  ------------------
   76|      0|      SetKey15(PwdA);
   77|      0|      break;
   78|      0|    case CRYPT_RAR20:
  ------------------
  |  Branch (78:5): [True: 0, False: 0]
  ------------------
   79|      0|      SetKey20(PwdA);
   80|      0|      break;
   81|      0|#endif
   82|      0|    case CRYPT_RAR30:
  ------------------
  |  Branch (82:5): [True: 0, False: 0]
  ------------------
   83|      0|      SetKey30(Encrypt,Password,PwdW,Salt);
   84|      0|      break;
   85|      0|    case CRYPT_RAR50:
  ------------------
  |  Branch (85:5): [True: 0, False: 0]
  ------------------
   86|      0|      SetKey50(Encrypt,Password,PwdW,Salt,InitV,Lg2Cnt,HashKey,PswCheck);
   87|      0|      break;
   88|      0|  }
   89|      0|  cleandata(PwdA,sizeof(PwdA));
   90|      0|  cleandata(PwdW,sizeof(PwdW));
   91|      0|  return true;
   92|      0|}

_ZN12ErrorHandlerC2Ev:
    4|      2|{
    5|      2|  Clean();
    6|      2|}
_ZN12ErrorHandler5CleanEv:
   10|      2|{
   11|      2|  ExitCode=RARX_SUCCESS;
   12|      2|  ErrCount=0;
   13|      2|  EnableBreak=true;
   14|      2|  Silent=false;
   15|      2|  UserBreak=false;
   16|      2|  MainExit=false;
   17|      2|  DisableShutdown=false;
   18|      2|  ReadErrIgnoreAll=false;
   19|      2|}
_ZN12ErrorHandler12SetErrorCodeE8RAR_EXIT:
  244|      5|{
  245|      5|  switch(Code)
  246|      5|  {
  247|      2|    case RARX_WARNING:
  ------------------
  |  Branch (247:5): [True: 2, False: 3]
  ------------------
  248|      2|    case RARX_USERBREAK:
  ------------------
  |  Branch (248:5): [True: 0, False: 5]
  ------------------
  249|      2|      if (ExitCode==RARX_SUCCESS)
  ------------------
  |  Branch (249:11): [True: 1, False: 1]
  ------------------
  250|      1|        ExitCode=Code;
  251|      2|      break;
  252|      3|    case RARX_CRC:
  ------------------
  |  Branch (252:5): [True: 3, False: 2]
  ------------------
  253|      3|      if (ExitCode!=RARX_BADPWD)
  ------------------
  |  Branch (253:11): [True: 3, False: 0]
  ------------------
  254|      3|        ExitCode=Code;
  255|      3|      break;
  256|      0|    case RARX_FATAL:
  ------------------
  |  Branch (256:5): [True: 0, False: 5]
  ------------------
  257|      0|      if (ExitCode==RARX_SUCCESS || ExitCode==RARX_WARNING)
  ------------------
  |  Branch (257:11): [True: 0, False: 0]
  |  Branch (257:37): [True: 0, False: 0]
  ------------------
  258|      0|        ExitCode=RARX_FATAL;
  259|      0|      break;
  260|      0|    default:
  ------------------
  |  Branch (260:5): [True: 0, False: 5]
  ------------------
  261|      0|      ExitCode=Code;
  262|      0|      break;
  263|      5|  }
  264|      5|  ErrCount++;
  265|      5|}

_ZN12ErrorHandler12GetErrorCodeEv:
   58|      2|    RAR_EXIT GetErrorCode() {return ExitCode;}
_ZN12ErrorHandler13GetErrorCountEv:
   59|      2|    uint GetErrorCount() {return ErrCount;}

_ZN10CmdExtractC2EP11CommandData:
    4|      2|{
    5|      2|  CmdExtract::Cmd=Cmd;
    6|       |
    7|      2|  *ArcName=0;
    8|       |
    9|      2|  *DestFileName=0;
   10|       |
   11|      2|  TotalFileCount=0;
   12|      2|  Unp=new Unpack(&DataIO);
   13|      2|#ifdef RAR_SMP
   14|      2|  Unp->SetThreads(Cmd->Threads);
   15|      2|#endif
   16|      2|}
_ZN10CmdExtractD2Ev:
   20|      2|{
   21|      2|  delete Unp;
   22|      2|}
_ZN10CmdExtract9DoExtractEv:
   26|      2|{
   27|       |#if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SILENT)
   28|       |  Fat32=NotFat32=false;
   29|       |#endif
   30|      2|  PasswordCancelled=false;
   31|      2|  DataIO.SetCurrentCommand(Cmd->Command[0]);
   32|       |
   33|      2|  FindData FD;
   34|      4|  while (Cmd->GetArcName(ArcName,ASIZE(ArcName)))
  ------------------
  |  |   10|      4|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (34:10): [True: 2, False: 2]
  ------------------
   35|      2|    if (FindFile::FastFind(ArcName,&FD))
  ------------------
  |  Branch (35:9): [True: 2, False: 0]
  ------------------
   36|      2|      DataIO.TotalArcSize+=FD.Size;
   37|       |
   38|      2|  Cmd->ArcNames.Rewind();
   39|      4|  while (Cmd->GetArcName(ArcName,ASIZE(ArcName)))
  ------------------
  |  |   10|      4|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (39:10): [True: 2, False: 2]
  ------------------
   40|      2|  {
   41|      2|    if (Cmd->ManualPassword)
  ------------------
  |  Branch (41:9): [True: 0, False: 2]
  ------------------
   42|      0|      Cmd->Password.Clean(); // Clean user entered password before processing next archive.
   43|       |  
   44|      2|    ReconstructDone=false; // Must be reset here, not in ExtractArchiveInit().
   45|      2|    UseExactVolName=false; // Must be reset here, not in ExtractArchiveInit().
   46|      2|    while (true)
  ------------------
  |  Branch (46:12): [Folded - Ignored]
  ------------------
   47|      2|    {
   48|      2|      EXTRACT_ARC_CODE Code=ExtractArchive();
   49|      2|      if (Code!=EXTRACT_ARC_REPEAT)
  ------------------
  |  Branch (49:11): [True: 2, False: 0]
  ------------------
   50|      2|        break;
   51|      2|    }
   52|      2|    DataIO.ProcessedArcSize+=DataIO.LastArcSize;
   53|      2|  }
   54|       |
   55|       |  // Clean user entered password. Not really required, just for extra safety.
   56|      2|  if (Cmd->ManualPassword)
  ------------------
  |  Branch (56:7): [True: 0, False: 2]
  ------------------
   57|      0|    Cmd->Password.Clean();
   58|       |
   59|      2|  if (TotalFileCount==0 && Cmd->Command[0]!='I' && 
  ------------------
  |  Branch (59:7): [True: 1, False: 1]
  |  Branch (59:28): [True: 1, False: 0]
  ------------------
   60|      2|      ErrHandler.GetErrorCode()!=RARX_BADPWD) // Not in case of wrong archive password.
  ------------------
  |  Branch (60:7): [True: 1, False: 0]
  ------------------
   61|      1|  {
   62|      1|    if (!PasswordCancelled)
  ------------------
  |  Branch (62:9): [True: 1, False: 0]
  ------------------
   63|      1|      uiMsg(UIERROR_NOFILESTOEXTRACT,ArcName);
   64|       |
   65|       |    // Other error codes may explain a reason of "no files extracted" clearer,
   66|       |    // so set it only if no other errors found (wrong mask set by user).
   67|      1|    if (ErrHandler.GetErrorCode()==RARX_SUCCESS)
  ------------------
  |  Branch (67:9): [True: 0, False: 1]
  ------------------
   68|      0|      ErrHandler.SetErrorCode(RARX_NOFILES);
   69|      1|  }
   70|      1|  else
   71|      1|    if (!Cmd->DisableDone)
  ------------------
  |  Branch (71:9): [True: 1, False: 0]
  ------------------
   72|      1|      if (Cmd->Command[0]=='I')
  ------------------
  |  Branch (72:11): [True: 0, False: 1]
  ------------------
   73|      0|        mprintf(St(MDone));
  ------------------
  |  |    5|      0|#define St(x) (L"")
  ------------------
   74|      1|      else
   75|      1|        if (ErrHandler.GetErrorCount()==0)
  ------------------
  |  Branch (75:13): [True: 0, False: 1]
  ------------------
   76|      0|          mprintf(St(MExtrAllOk));
  ------------------
  |  |    5|      0|#define St(x) (L"")
  ------------------
   77|      1|        else
   78|      1|          mprintf(St(MExtrTotalErr),ErrHandler.GetErrorCount());
  ------------------
  |  |    5|      1|#define St(x) (L"")
  ------------------
   79|      2|}
_ZN10CmdExtract18ExtractArchiveInitER7Archive:
   83|      1|{
   84|      1|  DataIO.AdjustTotalArcSize(&Arc);
   85|       |
   86|      1|  FileCount=0;
   87|      1|  MatchedArgs=0;
   88|      1|#ifndef SFX_MODULE
   89|      1|  FirstFile=true;
   90|      1|#endif
   91|       |
   92|      1|  GlobalPassword=Cmd->Password.IsSet() || uiIsGlobalPasswordSet();
  ------------------
  |  Branch (92:18): [True: 0, False: 1]
  |  Branch (92:43): [True: 0, False: 1]
  ------------------
   93|       |
   94|      1|  DataIO.UnpVolume=false;
   95|       |
   96|      1|  PrevProcessed=false;
   97|      1|  AllMatchesExact=true;
   98|      1|  AnySolidDataUnpackedWell=false;
   99|       |
  100|      1|  StartTime.SetCurrentTime();
  101|      1|}
_ZN10CmdExtract14ExtractArchiveEv:
  105|      2|{
  106|      2|  Archive Arc(Cmd);
  107|      2|  if (*Cmd->UseStdin!=0)
  ------------------
  |  Branch (107:7): [True: 0, False: 2]
  ------------------
  108|      0|  {
  109|      0|    Arc.SetHandleType(FILE_HANDLESTD);
  110|      0|#ifdef USE_QOPEN
  111|      0|    Arc.SetProhibitQOpen(true);
  112|      0|#endif
  113|      0|  }
  114|      2|  else
  115|      2|  {
  116|       |#if defined(_WIN_ALL) && !defined(SFX_MODULE) // WinRAR GUI code also resets the cache.
  117|       |    if (*Cmd->Command=='T' || Cmd->Test)
  118|       |      ResetFileCache(ArcName); // Reset the file cache when testing an archive.
  119|       |#endif
  120|      2|    if (!Arc.WOpen(ArcName))
  ------------------
  |  Branch (120:9): [True: 0, False: 2]
  ------------------
  121|      0|      return EXTRACT_ARC_NEXT;
  122|      2|  }
  123|       |
  124|      2|  if (!Arc.IsArchive(true))
  ------------------
  |  Branch (124:7): [True: 1, False: 1]
  ------------------
  125|      1|  {
  126|       |#if !defined(SFX_MODULE) && !defined(RARDLL)
  127|       |    if (CmpExt(ArcName,L"rev"))
  128|       |    {
  129|       |      wchar FirstVolName[NM];
  130|       |      VolNameToFirstName(ArcName,FirstVolName,ASIZE(FirstVolName),true);
  131|       |
  132|       |      // If several volume names from same volume set are specified
  133|       |      // and current volume is not first in set and first volume is present
  134|       |      // and specified too, let's skip the current volume.
  135|       |      if (wcsicomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
  136|       |          Cmd->ArcNames.Search(FirstVolName,false))
  137|       |        return EXTRACT_ARC_NEXT;
  138|       |      RecVolumesTest(Cmd,NULL,ArcName);
  139|       |      TotalFileCount++; // Suppress "No files to extract" message.
  140|       |      return EXTRACT_ARC_NEXT;
  141|       |    }
  142|       |#endif
  143|       |
  144|      1|    mprintf(St(MNotRAR),ArcName);
  ------------------
  |  |    5|      1|#define St(x) (L"")
  ------------------
  145|       |
  146|      1|#ifndef SFX_MODULE
  147|      1|    if (CmpExt(ArcName,L"rar"))
  ------------------
  |  Branch (147:9): [True: 1, False: 0]
  ------------------
  148|      1|#endif
  149|      1|      ErrHandler.SetErrorCode(RARX_WARNING);
  150|      1|    return EXTRACT_ARC_NEXT;
  151|      1|  }
  152|       |
  153|      1|  if (Arc.FailedHeaderDecryption) // Bad archive password.
  ------------------
  |  Branch (153:7): [True: 0, False: 1]
  ------------------
  154|      0|    return EXTRACT_ARC_NEXT;
  155|       |
  156|      1|#ifndef SFX_MODULE
  157|      1|  if (Arc.Volume && !Arc.FirstVolume && !UseExactVolName)
  ------------------
  |  Branch (157:7): [True: 0, False: 1]
  |  Branch (157:21): [True: 0, False: 0]
  |  Branch (157:41): [True: 0, False: 0]
  ------------------
  158|      0|  {
  159|      0|    wchar FirstVolName[NM];
  160|      0|    VolNameToFirstName(ArcName,FirstVolName,ASIZE(FirstVolName),Arc.NewNumbering);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  161|       |
  162|       |    // If several volume names from same volume set are specified
  163|       |    // and current volume is not first in set and first volume is present
  164|       |    // and specified too, let's skip the current volume.
  165|      0|    if (wcsicomp(ArcName,FirstVolName)!=0 && FileExist(FirstVolName) &&
  ------------------
  |  Branch (165:9): [True: 0, False: 0]
  |  Branch (165:46): [True: 0, False: 0]
  ------------------
  166|      0|        Cmd->ArcNames.Search(FirstVolName,false))
  ------------------
  |  Branch (166:9): [True: 0, False: 0]
  ------------------
  167|      0|      return EXTRACT_ARC_NEXT;
  168|      0|  }
  169|      1|#endif
  170|       |
  171|      1|  int64 VolumeSetSize=0; // Total size of volumes after the current volume.
  172|       |
  173|      1|  if (Arc.Volume)
  ------------------
  |  Branch (173:7): [True: 0, False: 1]
  ------------------
  174|      0|  {
  175|      0|#ifndef SFX_MODULE
  176|       |    // Try to speed up extraction for independent solid volumes by starting
  177|       |    // extraction from non-first volume if we can.
  178|      0|    if (!UseExactVolName && Arc.Solid && DetectStartVolume(Arc.FileName,Arc.NewNumbering))
  ------------------
  |  Branch (178:9): [True: 0, False: 0]
  |  Branch (178:29): [True: 0, False: 0]
  |  Branch (178:42): [True: 0, False: 0]
  ------------------
  179|      0|    {
  180|      0|      UseExactVolName=true;
  181|      0|      return EXTRACT_ARC_REPEAT;
  182|      0|    }
  183|      0|#endif
  184|       |
  185|       |    // Calculate the total size of all accessible volumes.
  186|       |    // This size is necessary to display the correct total progress indicator.
  187|       |
  188|      0|    wchar NextName[NM];
  189|      0|    wcsncpyz(NextName,Arc.FileName,ASIZE(NextName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  190|       |
  191|      0|    while (true)
  ------------------
  |  Branch (191:12): [Folded - Ignored]
  ------------------
  192|      0|    {
  193|       |      // First volume is already added to DataIO.TotalArcSize 
  194|       |      // in initial TotalArcSize calculation in DoExtract.
  195|       |      // So we skip it and start from second volume.
  196|      0|      NextVolumeName(NextName,ASIZE(NextName),!Arc.NewNumbering);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  197|      0|      FindData FD;
  198|      0|      if (FindFile::FastFind(NextName,&FD))
  ------------------
  |  Branch (198:11): [True: 0, False: 0]
  ------------------
  199|      0|        VolumeSetSize+=FD.Size;
  200|      0|      else
  201|      0|        break;
  202|      0|    }
  203|      0|    DataIO.TotalArcSize+=VolumeSetSize;
  204|      0|  }
  205|       |
  206|      1|  ExtractArchiveInit(Arc);
  207|       |
  208|      1|  if (*Cmd->Command=='T' || *Cmd->Command=='I')
  ------------------
  |  Branch (208:7): [True: 0, False: 1]
  |  Branch (208:29): [True: 0, False: 1]
  ------------------
  209|      0|    Cmd->Test=true;
  210|       |
  211|       |
  212|      1|  if (*Cmd->Command=='I')
  ------------------
  |  Branch (212:7): [True: 0, False: 1]
  ------------------
  213|      0|  {
  214|      0|    Cmd->DisablePercentage=true;
  215|      0|  }
  216|      1|  else
  217|      1|    uiStartArchiveExtract(!Cmd->Test,ArcName);
  218|       |
  219|      1|  Arc.ViewComment();
  220|       |
  221|       |
  222|      2|  while (1)
  ------------------
  |  Branch (222:10): [Folded - Ignored]
  ------------------
  223|      2|  {
  224|      2|    size_t Size=Arc.ReadHeader();
  225|       |
  226|       |
  227|      2|    bool Repeat=false;
  228|      2|    if (!ExtractCurrentFile(Arc,Size,Repeat))
  ------------------
  |  Branch (228:9): [True: 1, False: 1]
  ------------------
  229|      1|      if (Repeat)
  ------------------
  |  Branch (229:11): [True: 0, False: 1]
  ------------------
  230|      0|      {
  231|       |        // If we started extraction from not first volume and need to
  232|       |        // restart it from first, we must set DataIO.TotalArcSize to size
  233|       |        // of new first volume to display the total progress correctly.
  234|      0|        FindData NewArc;
  235|      0|        if (FindFile::FastFind(ArcName,&NewArc))
  ------------------
  |  Branch (235:13): [True: 0, False: 0]
  ------------------
  236|      0|          DataIO.TotalArcSize=NewArc.Size;
  237|      0|        return EXTRACT_ARC_REPEAT;
  238|      0|      }
  239|      1|      else
  240|      1|        break;
  241|      2|  }
  242|       |
  243|       |
  244|       |#if !defined(SFX_MODULE) && !defined(RARDLL)
  245|       |  if (Cmd->Test && Arc.Volume)
  246|       |    RecVolumesTest(Cmd,&Arc,ArcName);
  247|       |#endif
  248|       |
  249|      1|  return EXTRACT_ARC_NEXT;
  250|      1|}
_ZN10CmdExtract18ExtractCurrentFileER7ArchivemRb:
  254|      2|{
  255|      2|  wchar Command=Cmd->Command[0];
  256|      2|  if (HeaderSize==0)
  ------------------
  |  Branch (256:7): [True: 1, False: 1]
  ------------------
  257|      1|    if (DataIO.UnpVolume)
  ------------------
  |  Branch (257:9): [True: 0, False: 1]
  ------------------
  258|      0|    {
  259|      0|#ifdef NOVOLUME
  260|      0|      return false;
  261|       |#else
  262|       |      // Supposing we unpack an old RAR volume without the end of archive
  263|       |      // record and last file is not split between volumes.
  264|       |      if (!MergeArchive(Arc,&DataIO,false,Command))
  265|       |      {
  266|       |        ErrHandler.SetErrorCode(RARX_WARNING);
  267|       |        return false;
  268|       |      }
  269|       |#endif
  270|      0|    }
  271|      1|    else
  272|      1|      return false;
  273|       |
  274|      1|  HEADER_TYPE HeaderType=Arc.GetHeaderType();
  275|      1|  if (HeaderType!=HEAD_FILE)
  ------------------
  |  Branch (275:7): [True: 0, False: 1]
  ------------------
  276|      0|  {
  277|      0|#ifndef SFX_MODULE
  278|      0|    if (Arc.Format==RARFMT15 && HeaderType==HEAD3_OLDSERVICE && PrevProcessed)
  ------------------
  |  Branch (278:9): [True: 0, False: 0]
  |  Branch (278:33): [True: 0, False: 0]
  |  Branch (278:65): [True: 0, False: 0]
  ------------------
  279|      0|      SetExtraInfo20(Cmd,Arc,DestFileName);
  280|      0|#endif
  281|      0|    if (HeaderType==HEAD_SERVICE && PrevProcessed)
  ------------------
  |  Branch (281:9): [True: 0, False: 0]
  |  Branch (281:37): [True: 0, False: 0]
  ------------------
  282|      0|      SetExtraInfo(Cmd,Arc,DestFileName);
  283|      0|    if (HeaderType==HEAD_ENDARC)
  ------------------
  |  Branch (283:9): [True: 0, False: 0]
  ------------------
  284|      0|      if (Arc.EndArcHead.NextVolume)
  ------------------
  |  Branch (284:11): [True: 0, False: 0]
  ------------------
  285|      0|      {
  286|      0|#ifdef NOVOLUME
  287|      0|        return false;
  288|       |#else
  289|       |        if (!MergeArchive(Arc,&DataIO,false,Command))
  290|       |        {
  291|       |          ErrHandler.SetErrorCode(RARX_WARNING);
  292|       |          return false;
  293|       |        }
  294|       |        Arc.Seek(Arc.CurBlockPos,SEEK_SET);
  295|       |        return true;
  296|       |#endif
  297|      0|      }
  298|      0|      else
  299|      0|        return false;
  300|      0|    Arc.SeekToNext();
  301|      0|    return true;
  302|      0|  }
  303|      1|  PrevProcessed=false;
  304|       |
  305|       |  // We can get negative sizes in corrupt archive and it is unacceptable
  306|       |  // for size comparisons in ComprDataIO::UnpRead, where we cast sizes
  307|       |  // to size_t and can exceed another read or available size. We could fix it
  308|       |  // when reading an archive. But we prefer to do it here, because this
  309|       |  // function is called directly in unrar.dll, so we fix bad parameters
  310|       |  // passed to dll. Also we want to see real negative sizes in the listing
  311|       |  // of corrupt archive. To prevent uninitialized data access perform
  312|       |  // these checks after rejecting zero length and non-file headers above.
  313|      1|  if (Arc.FileHead.PackSize<0)
  ------------------
  |  Branch (313:7): [True: 0, False: 1]
  ------------------
  314|      0|    Arc.FileHead.PackSize=0;
  315|      1|  if (Arc.FileHead.UnpSize<0)
  ------------------
  |  Branch (315:7): [True: 0, False: 1]
  ------------------
  316|      0|    Arc.FileHead.UnpSize=0;
  317|       |
  318|      1|  if (!Cmd->Recurse && MatchedArgs>=Cmd->FileArgs.ItemsCount() && AllMatchesExact)
  ------------------
  |  Branch (318:7): [True: 1, False: 0]
  |  Branch (318:24): [True: 0, False: 1]
  |  Branch (318:67): [True: 0, False: 0]
  ------------------
  319|      0|    return false;
  320|       |
  321|      1|  int MatchType=MATCH_WILDSUBPATH;
  322|       |
  323|      1|  bool EqualNames=false;
  324|      1|  wchar MatchedArg[NM];
  325|      1|  int MatchNumber=Cmd->IsProcessFile(Arc.FileHead,&EqualNames,MatchType,0,MatchedArg,ASIZE(MatchedArg));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  326|      1|  bool MatchFound=MatchNumber!=0;
  327|      1|#ifndef SFX_MODULE
  328|      1|  if (Cmd->ExclPath==EXCL_BASEPATH)
  ------------------
  |  Branch (328:7): [True: 0, False: 1]
  ------------------
  329|      0|  {
  330|      0|    wcsncpyz(Cmd->ArcPath,MatchedArg,ASIZE(Cmd->ArcPath));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  331|      0|    *PointToName(Cmd->ArcPath)=0;
  332|      0|    if (IsWildcard(Cmd->ArcPath)) // Cannot correctly process path*\* masks here.
  ------------------
  |  Branch (332:9): [True: 0, False: 0]
  ------------------
  333|      0|      *Cmd->ArcPath=0;
  334|      0|  }
  335|      1|#endif
  336|      1|  if (MatchFound && !EqualNames)
  ------------------
  |  Branch (336:7): [True: 1, False: 0]
  |  Branch (336:21): [True: 1, False: 0]
  ------------------
  337|      1|    AllMatchesExact=false;
  338|       |
  339|      1|  Arc.ConvertAttributes();
  340|       |
  341|       |#if !defined(SFX_MODULE) && !defined(RARDLL)
  342|       |  if (Arc.FileHead.SplitBefore && FirstFile && !UseExactVolName)
  343|       |  {
  344|       |    wchar CurVolName[NM];
  345|       |    wcsncpyz(CurVolName,ArcName,ASIZE(CurVolName));
  346|       |    GetFirstVolIfFullSet(ArcName,Arc.NewNumbering,ArcName,ASIZE(ArcName));
  347|       |
  348|       |    if (wcsicomp(ArcName,CurVolName)!=0 && FileExist(ArcName))
  349|       |    {
  350|       |      wcsncpyz(Cmd->ArcName,ArcName,ASIZE(ArcName)); // For GUI "Delete archive after extraction".
  351|       |      // If first volume name does not match the current name and if such
  352|       |      // volume name really exists, let's unpack from this first volume.
  353|       |      Repeat=true;
  354|       |      return false;
  355|       |    }
  356|       |#ifndef RARDLL
  357|       |    if (!ReconstructDone)
  358|       |    {
  359|       |      ReconstructDone=true;
  360|       |      if (RecVolumesRestore(Cmd,Arc.FileName,true))
  361|       |      {
  362|       |        Repeat=true;
  363|       |        return false;
  364|       |      }
  365|       |    }
  366|       |#endif
  367|       |    wcsncpyz(ArcName,CurVolName,ASIZE(ArcName));
  368|       |  }
  369|       |#endif
  370|       |
  371|      1|  wchar ArcFileName[NM];
  372|      1|  ConvertPath(Arc.FileHead.FileName,ArcFileName,ASIZE(ArcFileName));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  373|       |
  374|      1|  if (Arc.FileHead.Version)
  ------------------
  |  Branch (374:7): [True: 0, False: 1]
  ------------------
  375|      0|  {
  376|      0|    if (Cmd->VersionControl!=1 && !EqualNames)
  ------------------
  |  Branch (376:9): [True: 0, False: 0]
  |  Branch (376:35): [True: 0, False: 0]
  ------------------
  377|      0|    {
  378|      0|      if (Cmd->VersionControl==0)
  ------------------
  |  Branch (378:11): [True: 0, False: 0]
  ------------------
  379|      0|        MatchFound=false;
  380|      0|      int Version=ParseVersionFileName(ArcFileName,false);
  381|      0|      if (Cmd->VersionControl-1==Version)
  ------------------
  |  Branch (381:11): [True: 0, False: 0]
  ------------------
  382|      0|        ParseVersionFileName(ArcFileName,true);
  383|      0|      else
  384|      0|        MatchFound=false;
  385|      0|    }
  386|      0|  }
  387|      1|  else
  388|      1|    if (!Arc.IsArcDir() && Cmd->VersionControl>1)
  ------------------
  |  Branch (388:9): [True: 1, False: 0]
  |  Branch (388:28): [True: 0, False: 1]
  ------------------
  389|      0|      MatchFound=false;
  390|       |
  391|      1|  DataIO.UnpVolume=Arc.FileHead.SplitAfter;
  392|      1|  DataIO.NextVolumeMissing=false;
  393|       |
  394|      1|  Arc.Seek(Arc.NextBlockPos-Arc.FileHead.PackSize,SEEK_SET);
  395|       |
  396|      1|  bool ExtrFile=false;
  397|      1|  bool SkipSolid=false;
  398|       |
  399|      1|#ifndef SFX_MODULE
  400|      1|  if (FirstFile && (MatchFound || Arc.Solid) && Arc.FileHead.SplitBefore)
  ------------------
  |  Branch (400:7): [True: 1, False: 0]
  |  Branch (400:21): [True: 1, False: 0]
  |  Branch (400:35): [True: 0, False: 0]
  |  Branch (400:49): [True: 0, False: 1]
  ------------------
  401|      0|  {
  402|      0|    if (MatchFound)
  ------------------
  |  Branch (402:9): [True: 0, False: 0]
  ------------------
  403|      0|    {
  404|      0|      uiMsg(UIERROR_NEEDPREVVOL,Arc.FileName,ArcFileName);
  405|      0|#ifdef RARDLL
  406|      0|      Cmd->DllError=ERAR_BAD_DATA;
  ------------------
  |  |    9|      0|#define ERAR_BAD_DATA           12
  ------------------
  407|      0|#endif
  408|      0|      ErrHandler.SetErrorCode(RARX_OPEN);
  409|      0|    }
  410|      0|    MatchFound=false;
  411|      0|  }
  412|       |
  413|      1|  FirstFile=false;
  414|      1|#endif
  415|       |
  416|      1|  if (Arc.FileHead.Encrypted && Cmd->SkipEncrypted)
  ------------------
  |  Branch (416:7): [True: 0, False: 1]
  |  Branch (416:33): [True: 0, False: 0]
  ------------------
  417|      0|    if (Arc.Solid)
  ------------------
  |  Branch (417:9): [True: 0, False: 0]
  ------------------
  418|      0|      return false; // Abort the entire extraction for solid archive.
  419|      0|    else
  420|      0|      MatchFound=false; // Skip only the current file for non-solid archive.
  421|       |  
  422|      1|  if (MatchFound || (SkipSolid=Arc.Solid)!=0)
  ------------------
  |  Branch (422:7): [True: 1, False: 0]
  |  Branch (422:21): [True: 0, False: 0]
  ------------------
  423|      1|  {
  424|       |    // First common call of uiStartFileExtract. It is done before overwrite
  425|       |    // prompts, so if SkipSolid state is changed below, we'll need to make
  426|       |    // additional uiStartFileExtract calls with updated parameters.
  427|      1|    if (!uiStartFileExtract(ArcFileName,!Cmd->Test,Cmd->Test && Command!='I',SkipSolid))
  ------------------
  |  Branch (427:9): [True: 0, False: 1]
  |  Branch (427:52): [True: 0, False: 1]
  |  Branch (427:65): [True: 0, False: 0]
  ------------------
  428|      0|      return false;
  429|       |
  430|      1|    ExtrPrepareName(Arc,ArcFileName,DestFileName,ASIZE(DestFileName));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  431|       |
  432|       |    // DestFileName can be set empty in case of excessive -ap switch.
  433|      1|    ExtrFile=!SkipSolid && *DestFileName!=0 && !Arc.FileHead.SplitBefore;
  ------------------
  |  Branch (433:14): [True: 1, False: 0]
  |  Branch (433:28): [True: 1, False: 0]
  |  Branch (433:48): [True: 1, False: 0]
  ------------------
  434|       |
  435|      1|    if ((Cmd->FreshFiles || Cmd->UpdateFiles) && (Command=='E' || Command=='X'))
  ------------------
  |  Branch (435:10): [True: 0, False: 1]
  |  Branch (435:29): [True: 0, False: 1]
  |  Branch (435:51): [True: 0, False: 0]
  |  Branch (435:67): [True: 0, False: 0]
  ------------------
  436|      0|    {
  437|      0|      FindData FD;
  438|      0|      if (FindFile::FastFind(DestFileName,&FD))
  ------------------
  |  Branch (438:11): [True: 0, False: 0]
  ------------------
  439|      0|      {
  440|      0|        if (FD.mtime >= Arc.FileHead.mtime)
  ------------------
  |  Branch (440:13): [True: 0, False: 0]
  ------------------
  441|      0|        {
  442|       |          // If directory already exists and its modification time is newer 
  443|       |          // than start of extraction, it is likely it was created 
  444|       |          // when creating a path to one of already extracted items. 
  445|       |          // In such case we'll better update its time even if archived 
  446|       |          // directory is older.
  447|       |
  448|      0|          if (!FD.IsDir || FD.mtime<StartTime)
  ------------------
  |  Branch (448:15): [True: 0, False: 0]
  |  Branch (448:28): [True: 0, False: 0]
  ------------------
  449|      0|            ExtrFile=false;
  450|      0|        }
  451|      0|      }
  452|      0|      else
  453|      0|        if (Cmd->FreshFiles)
  ------------------
  |  Branch (453:13): [True: 0, False: 0]
  ------------------
  454|      0|          ExtrFile=false;
  455|      0|    }
  456|       |
  457|      1|    if (!CheckUnpVer(Arc,ArcFileName))
  ------------------
  |  Branch (457:9): [True: 0, False: 1]
  ------------------
  458|      0|    {
  459|      0|      ErrHandler.SetErrorCode(RARX_FATAL);
  460|      0|#ifdef RARDLL
  461|      0|      Cmd->DllError=ERAR_UNKNOWN_FORMAT;
  ------------------
  |  |   11|      0|#define ERAR_UNKNOWN_FORMAT     14
  ------------------
  462|      0|#endif
  463|      0|      Arc.SeekToNext();
  464|      0|      return !Arc.Solid; // Can try extracting next file only in non-solid archive.
  465|      0|    }
  466|       |
  467|      1|    while (true) // Repeat the password prompt for wrong and empty passwords.
  ------------------
  |  Branch (467:12): [Folded - Ignored]
  ------------------
  468|      1|    {
  469|      1|      if (Arc.FileHead.Encrypted)
  ------------------
  |  Branch (469:11): [True: 0, False: 1]
  ------------------
  470|      0|      {
  471|       |        // Stop archive extracting if user cancelled a password prompt.
  472|      0|#ifdef RARDLL
  473|      0|        if (!ExtrDllGetPassword())
  ------------------
  |  Branch (473:13): [True: 0, False: 0]
  ------------------
  474|      0|        {
  475|      0|          Cmd->DllError=ERAR_MISSING_PASSWORD;
  ------------------
  |  |   19|      0|#define ERAR_MISSING_PASSWORD   22
  ------------------
  476|      0|          return false;
  477|      0|        }
  478|       |#else
  479|       |        if (!ExtrGetPassword(Arc,ArcFileName))
  480|       |        {
  481|       |          PasswordCancelled=true;
  482|       |          return false;
  483|       |        }
  484|       |#endif
  485|      0|      }
  486|       |
  487|       |      // Set a password before creating the file, so we can skip creating
  488|       |      // in case of wrong password.
  489|      1|      SecPassword FilePassword=Cmd->Password;
  490|       |#if defined(_WIN_ALL) && !defined(SFX_MODULE)
  491|       |      ConvertDosPassword(Arc,FilePassword);
  492|       |#endif
  493|       |
  494|      1|      byte PswCheck[SIZE_PSWCHECK];
  495|      1|      DataIO.SetEncryption(false,Arc.FileHead.CryptMethod,&FilePassword,
  496|      1|             Arc.FileHead.SaltSet ? Arc.FileHead.Salt:NULL,
  ------------------
  |  Branch (496:14): [True: 0, False: 1]
  ------------------
  497|      1|             Arc.FileHead.InitV,Arc.FileHead.Lg2Count,
  498|      1|             Arc.FileHead.HashKey,PswCheck);
  499|       |
  500|       |      // If header is damaged, we cannot rely on password check value,
  501|       |      // because it can be damaged too.
  502|      1|      if (Arc.FileHead.Encrypted && Arc.FileHead.UsePswCheck &&
  ------------------
  |  Branch (502:11): [True: 0, False: 1]
  |  Branch (502:37): [True: 0, False: 0]
  ------------------
  503|      1|          memcmp(Arc.FileHead.PswCheck,PswCheck,SIZE_PSWCHECK)!=0 &&
  ------------------
  |  |   12|      0|#define SIZE_PSWCHECK             8
  ------------------
  |  Branch (503:11): [True: 0, False: 0]
  ------------------
  504|      1|          !Arc.BrokenHeader)
  ------------------
  |  Branch (504:11): [True: 0, False: 0]
  ------------------
  505|      0|      {
  506|      0|        if (GlobalPassword) // For -p<pwd> or Ctrl+P to avoid the infinite loop.
  ------------------
  |  Branch (506:13): [True: 0, False: 0]
  ------------------
  507|      0|        {
  508|       |          // This message is used by Android GUI to reset cached passwords.
  509|       |          // Update appropriate code if changed.
  510|      0|          uiMsg(UIERROR_BADPSW,Arc.FileName,ArcFileName);
  511|      0|        }
  512|      0|        else // For passwords entered manually.
  513|      0|        {
  514|       |          // This message is used by Android GUI and Windows GUI and SFX to
  515|       |          // reset cached passwords. Update appropriate code if changed.
  516|      0|          uiMsg(UIWAIT_BADPSW,Arc.FileName,ArcFileName);
  517|      0|          Cmd->Password.Clean();
  518|       |
  519|       |          // Avoid new requests for unrar.dll to prevent the infinite loop
  520|       |          // if app always returns the same password.
  521|       |#ifndef RARDLL
  522|       |          continue; // Request a password again.
  523|       |#endif
  524|      0|        }
  525|      0|#ifdef RARDLL
  526|       |        // If we already have ERAR_EOPEN as result of missing volume,
  527|       |        // we should not replace it with less precise ERAR_BAD_PASSWORD.
  528|      0|        if (Cmd->DllError!=ERAR_EOPEN)
  ------------------
  |  |   12|      0|#define ERAR_EOPEN              15
  ------------------
  |  Branch (528:13): [True: 0, False: 0]
  ------------------
  529|      0|          Cmd->DllError=ERAR_BAD_PASSWORD;
  ------------------
  |  |   21|      0|#define ERAR_BAD_PASSWORD       24
  ------------------
  530|      0|#endif
  531|      0|        ErrHandler.SetErrorCode(RARX_BADPWD);
  532|      0|        ExtrFile=false;
  533|      0|      }
  534|      1|      break;
  535|      1|    }
  536|       |
  537|      1|#ifdef RARDLL
  538|      1|    if (*Cmd->DllDestName!=0)
  ------------------
  |  Branch (538:9): [True: 0, False: 1]
  ------------------
  539|      0|      wcsncpyz(DestFileName,Cmd->DllDestName,ASIZE(DestFileName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  540|      1|#endif
  541|       |
  542|      1|    File CurFile;
  543|       |
  544|      1|    bool LinkEntry=Arc.FileHead.RedirType!=FSREDIR_NONE;
  545|      1|    if (LinkEntry && Arc.FileHead.RedirType!=FSREDIR_FILECOPY)
  ------------------
  |  Branch (545:9): [True: 1, False: 0]
  |  Branch (545:22): [True: 1, False: 0]
  ------------------
  546|      1|    {
  547|      1|      if (ExtrFile && Command!='P' && !Cmd->Test)
  ------------------
  |  Branch (547:11): [True: 1, False: 0]
  |  Branch (547:23): [True: 1, False: 0]
  |  Branch (547:39): [True: 1, False: 0]
  ------------------
  548|      1|      {
  549|       |        // Overwrite prompt for symbolic and hard links.
  550|      1|        bool UserReject=false;
  551|      1|        if (FileExist(DestFileName) && !UserReject)
  ------------------
  |  Branch (551:13): [True: 0, False: 1]
  |  Branch (551:40): [True: 0, False: 0]
  ------------------
  552|      0|          FileCreate(Cmd,NULL,DestFileName,ASIZE(DestFileName),&UserReject,Arc.FileHead.UnpSize,&Arc.FileHead.mtime);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  553|      1|        if (UserReject)
  ------------------
  |  Branch (553:13): [True: 0, False: 1]
  ------------------
  554|      0|          ExtrFile=false;
  555|      1|      }
  556|      1|    }
  557|      0|    else
  558|      0|      if (Arc.IsArcDir())
  ------------------
  |  Branch (558:11): [True: 0, False: 0]
  ------------------
  559|      0|      {
  560|      0|        if (!ExtrFile || Command=='P' || Command=='I' || Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH)
  ------------------
  |  Branch (560:13): [True: 0, False: 0]
  |  Branch (560:26): [True: 0, False: 0]
  |  Branch (560:42): [True: 0, False: 0]
  |  Branch (560:58): [True: 0, False: 0]
  |  Branch (560:74): [True: 0, False: 0]
  ------------------
  561|      0|          return true;
  562|      0|        TotalFileCount++;
  563|      0|        ExtrCreateDir(Arc,ArcFileName);
  564|       |        // It is important to not increment MatchedArgs here, so we extract
  565|       |        // dir with its entire contents and not dir record only even if
  566|       |        // dir record precedes files.
  567|      0|        return true;
  568|      0|      }
  569|      0|      else
  570|      0|        if (ExtrFile) // Create files and file copies (FSREDIR_FILECOPY).
  ------------------
  |  Branch (570:13): [True: 0, False: 0]
  ------------------
  571|      0|          ExtrFile=ExtrCreateFile(Arc,CurFile);
  572|       |
  573|      1|    if (!ExtrFile && Arc.Solid)
  ------------------
  |  Branch (573:9): [True: 0, False: 1]
  |  Branch (573:22): [True: 0, False: 0]
  ------------------
  574|      0|    {
  575|      0|      SkipSolid=true;
  576|      0|      ExtrFile=true;
  577|       |
  578|       |      // We changed SkipSolid, so we need to call uiStartFileExtract
  579|       |      // with "Skip" parameter to change the operation status 
  580|       |      // from "extracting" to "skipping". For example, it can be necessary
  581|       |      // if user answered "No" to overwrite prompt when unpacking
  582|       |      // a solid archive.
  583|      0|      if (!uiStartFileExtract(ArcFileName,false,false,true))
  ------------------
  |  Branch (583:11): [True: 0, False: 0]
  ------------------
  584|      0|        return false;
  585|      0|    }
  586|      1|    if (ExtrFile)
  ------------------
  |  Branch (586:9): [True: 1, False: 0]
  ------------------
  587|      1|    {
  588|       |      // Set it in test mode, so we also test subheaders such as NTFS streams
  589|       |      // after tested file.
  590|      1|      if (Cmd->Test)
  ------------------
  |  Branch (590:11): [True: 0, False: 1]
  ------------------
  591|      0|        PrevProcessed=true;
  592|       |
  593|      1|      bool TestMode=Cmd->Test || SkipSolid; // Unpack to memory, not to disk.
  ------------------
  |  Branch (593:21): [True: 0, False: 1]
  |  Branch (593:34): [True: 0, False: 1]
  ------------------
  594|       |
  595|      1|      if (!SkipSolid)
  ------------------
  |  Branch (595:11): [True: 1, False: 0]
  ------------------
  596|      1|      {
  597|      1|        if (!TestMode && Command!='P' && CurFile.IsDevice())
  ------------------
  |  Branch (597:13): [True: 1, False: 0]
  |  Branch (597:26): [True: 1, False: 0]
  |  Branch (597:42): [True: 0, False: 1]
  ------------------
  598|      0|        {
  599|      0|          uiMsg(UIERROR_INVALIDNAME,Arc.FileName,DestFileName);
  600|      0|          ErrHandler.WriteError(Arc.FileName,DestFileName);
  601|      0|        }
  602|      1|        TotalFileCount++;
  603|      1|      }
  604|      1|      FileCount++;
  605|      1|      if (Command!='I' && !Cmd->DisableNames)
  ------------------
  |  Branch (605:11): [True: 1, False: 0]
  |  Branch (605:27): [True: 1, False: 0]
  ------------------
  606|      1|        if (SkipSolid)
  ------------------
  |  Branch (606:13): [True: 0, False: 1]
  ------------------
  607|      0|          mprintf(St(MExtrSkipFile),ArcFileName);
  ------------------
  |  |    5|      0|#define St(x) (L"")
  ------------------
  608|      1|        else
  609|      1|          switch(Cmd->Test ? 'T':Command) // "Test" can be also enabled by -t switch.
  ------------------
  |  Branch (609:18): [True: 0, False: 1]
  |  Branch (609:18): [True: 0, False: 1]
  ------------------
  610|      1|          {
  611|      0|            case 'T':
  ------------------
  |  Branch (611:13): [True: 0, False: 1]
  ------------------
  612|      0|              mprintf(St(MExtrTestFile),ArcFileName);
  ------------------
  |  |    5|      0|#define St(x) (L"")
  ------------------
  613|      0|              break;
  614|      0|#ifndef SFX_MODULE
  615|      0|            case 'P':
  ------------------
  |  Branch (615:13): [True: 0, False: 1]
  ------------------
  616|      0|              mprintf(St(MExtrPrinting),ArcFileName);
  ------------------
  |  |    5|      0|#define St(x) (L"")
  ------------------
  617|      0|              break;
  618|      0|#endif
  619|      1|            case 'X':
  ------------------
  |  Branch (619:13): [True: 1, False: 0]
  ------------------
  620|      1|            case 'E':
  ------------------
  |  Branch (620:13): [True: 0, False: 1]
  ------------------
  621|      1|              mprintf(St(MExtrFile),DestFileName);
  ------------------
  |  |    5|      1|#define St(x) (L"")
  ------------------
  622|      1|              break;
  623|      1|          }
  624|      1|      if (!Cmd->DisablePercentage && !Cmd->DisableNames)
  ------------------
  |  Branch (624:11): [True: 1, False: 0]
  |  Branch (624:38): [True: 1, False: 0]
  ------------------
  625|      1|        mprintf(L"     ");
  626|      1|      if (Cmd->DisableNames)
  ------------------
  |  Branch (626:11): [True: 0, False: 1]
  ------------------
  627|      0|        uiEolAfterMsg(); // Avoid erasing preceding messages by percentage indicator in -idn mode.
  628|       |
  629|      1|      DataIO.CurUnpRead=0;
  630|      1|      DataIO.CurUnpWrite=0;
  631|      1|      DataIO.UnpHash.Init(Arc.FileHead.FileHash.Type,Cmd->Threads);
  632|      1|      DataIO.PackedDataHash.Init(Arc.FileHead.FileHash.Type,Cmd->Threads);
  633|      1|      DataIO.SetPackedSizeToRead(Arc.FileHead.PackSize);
  634|      1|      DataIO.SetFiles(&Arc,&CurFile);
  635|      1|      DataIO.SetTestMode(TestMode);
  636|      1|      DataIO.SetSkipUnpCRC(SkipSolid);
  637|       |
  638|       |#if defined(_WIN_ALL) && !defined(SFX_MODULE) && !defined(SILENT)
  639|       |      if (!TestMode && !Arc.BrokenHeader &&
  640|       |          Arc.FileHead.UnpSize>0xffffffff && (Fat32 || !NotFat32))
  641|       |      {
  642|       |        if (!Fat32) // Not detected yet.
  643|       |          NotFat32=!(Fat32=IsFAT(Cmd->ExtrPath));
  644|       |        if (Fat32)
  645|       |          uiMsg(UIMSG_FAT32SIZE); // Inform user about FAT32 size limit.
  646|       |      }
  647|       |#endif
  648|       |
  649|      1|      uint64 Preallocated=0;
  650|      1|      if (!TestMode && !Arc.BrokenHeader && Arc.FileHead.UnpSize>1000000 &&
  ------------------
  |  Branch (650:11): [True: 1, False: 0]
  |  Branch (650:24): [True: 0, False: 1]
  |  Branch (650:45): [True: 0, False: 0]
  ------------------
  651|      1|          Arc.FileHead.PackSize*1024>Arc.FileHead.UnpSize && Arc.IsSeekable() &&
  ------------------
  |  Branch (651:11): [True: 0, False: 0]
  |  Branch (651:62): [True: 0, False: 0]
  ------------------
  652|      1|          (Arc.FileHead.UnpSize<100000000 || Arc.FileLength()>Arc.FileHead.PackSize))
  ------------------
  |  Branch (652:12): [True: 0, False: 0]
  |  Branch (652:46): [True: 0, False: 0]
  ------------------
  653|      0|      {
  654|      0|        CurFile.Prealloc(Arc.FileHead.UnpSize);
  655|      0|        Preallocated=Arc.FileHead.UnpSize;
  656|      0|      }
  657|      1|      CurFile.SetAllowDelete(!Cmd->KeepBroken);
  658|       |
  659|      1|      bool FileCreateMode=!TestMode && !SkipSolid && Command!='P';
  ------------------
  |  Branch (659:27): [True: 1, False: 0]
  |  Branch (659:40): [True: 1, False: 0]
  |  Branch (659:54): [True: 1, False: 0]
  ------------------
  660|      1|      bool ShowChecksum=true; // Display checksum verification result.
  661|       |
  662|      1|      bool LinkSuccess=true; // Assume success for test mode.
  663|      1|      if (LinkEntry)
  ------------------
  |  Branch (663:11): [True: 1, False: 0]
  ------------------
  664|      1|      {
  665|      1|        FILE_SYSTEM_REDIRECT Type=Arc.FileHead.RedirType;
  666|       |
  667|      1|        if (Type==FSREDIR_HARDLINK || Type==FSREDIR_FILECOPY)
  ------------------
  |  Branch (667:13): [True: 0, False: 1]
  |  Branch (667:39): [True: 0, False: 1]
  ------------------
  668|      0|        {
  669|      0|          wchar RedirName[NM];
  670|      0|          ConvertPath(Arc.FileHead.RedirName,RedirName,ASIZE(RedirName));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  671|       |
  672|      0|          wchar NameExisting[NM];
  673|      0|          ExtrPrepareName(Arc,RedirName,NameExisting,ASIZE(NameExisting));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  674|      0|          if (FileCreateMode && *NameExisting!=0) // *NameExisting can be 0 in case of excessive -ap switch.
  ------------------
  |  Branch (674:15): [True: 0, False: 0]
  |  Branch (674:33): [True: 0, False: 0]
  ------------------
  675|      0|            if (Type==FSREDIR_HARDLINK)
  ------------------
  |  Branch (675:17): [True: 0, False: 0]
  ------------------
  676|      0|              LinkSuccess=ExtractHardlink(Cmd,DestFileName,NameExisting,ASIZE(NameExisting));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  677|      0|            else
  678|      0|              LinkSuccess=ExtractFileCopy(CurFile,Arc.FileName,DestFileName,NameExisting,ASIZE(NameExisting));
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  679|      0|        }
  680|      1|        else
  681|      1|          if (Type==FSREDIR_UNIXSYMLINK || Type==FSREDIR_WINSYMLINK || Type==FSREDIR_JUNCTION)
  ------------------
  |  Branch (681:15): [True: 0, False: 1]
  |  Branch (681:44): [True: 0, False: 1]
  |  Branch (681:72): [True: 0, False: 1]
  ------------------
  682|      0|          {
  683|      0|            if (FileCreateMode)
  ------------------
  |  Branch (683:17): [True: 0, False: 0]
  ------------------
  684|      0|              LinkSuccess=ExtractSymlink(Cmd,DataIO,Arc,DestFileName);
  685|      0|          }
  686|      1|          else
  687|      1|          {
  688|      1|            uiMsg(UIERROR_UNKNOWNEXTRA,Arc.FileName,DestFileName);
  689|      1|            LinkSuccess=false;
  690|      1|          }
  691|       |          
  692|      1|          if (!LinkSuccess || Arc.Format==RARFMT15 && !FileCreateMode)
  ------------------
  |  Branch (692:15): [True: 1, False: 0]
  |  Branch (692:31): [True: 0, False: 0]
  |  Branch (692:55): [True: 0, False: 0]
  ------------------
  693|      1|          {
  694|       |            // RAR 5.x links have a valid data checksum even in case of
  695|       |            // failure, because they do not store any data.
  696|       |            // We do not want to display "OK" in this case.
  697|       |            // For 4.x symlinks we verify the checksum only when extracting,
  698|       |            // but not when testing an archive.
  699|      1|            ShowChecksum=false;
  700|      1|          }
  701|      1|          PrevProcessed=FileCreateMode && LinkSuccess;
  ------------------
  |  Branch (701:25): [True: 1, False: 0]
  |  Branch (701:43): [True: 0, False: 1]
  ------------------
  702|      1|      }
  703|      0|      else
  704|      0|        if (!Arc.FileHead.SplitBefore)
  ------------------
  |  Branch (704:13): [True: 0, False: 0]
  ------------------
  705|      0|          if (Arc.FileHead.Method==0)
  ------------------
  |  Branch (705:15): [True: 0, False: 0]
  ------------------
  706|      0|            UnstoreFile(DataIO,Arc.FileHead.UnpSize);
  707|      0|          else
  708|      0|          {
  709|      0|            Unp->Init(Arc.FileHead.WinSize,Arc.FileHead.Solid);
  710|      0|            Unp->SetDestSize(Arc.FileHead.UnpSize);
  711|      0|#ifndef SFX_MODULE
  712|      0|            if (Arc.Format!=RARFMT50 && Arc.FileHead.UnpVer<=15)
  ------------------
  |  Branch (712:17): [True: 0, False: 0]
  |  Branch (712:41): [True: 0, False: 0]
  ------------------
  713|      0|              Unp->DoUnpack(15,FileCount>1 && Arc.Solid);
  ------------------
  |  Branch (713:32): [True: 0, False: 0]
  |  Branch (713:47): [True: 0, False: 0]
  ------------------
  714|      0|            else
  715|      0|#endif
  716|      0|              Unp->DoUnpack(Arc.FileHead.UnpVer,Arc.FileHead.Solid);
  717|      0|          }
  718|       |
  719|      1|      Arc.SeekToNext();
  720|       |
  721|       |      // We check for "split after" flag to detect partially extracted files
  722|       |      // from incomplete volume sets. For them file header contains packed
  723|       |      // data hash, which must not be compared against unpacked data hash
  724|       |      // to prevent accidental match. Moreover, for -m0 volumes packed data
  725|       |      // hash would match truncated unpacked data hash and lead to fake "OK"
  726|       |      // in incomplete volume set.
  727|      1|      bool ValidCRC=!Arc.FileHead.SplitAfter && DataIO.UnpHash.Cmp(&Arc.FileHead.FileHash,Arc.FileHead.UseHashKey ? Arc.FileHead.HashKey:NULL);
  ------------------
  |  Branch (727:21): [True: 1, False: 0]
  |  Branch (727:49): [True: 1, False: 0]
  |  Branch (727:91): [True: 0, False: 1]
  ------------------
  728|       |
  729|       |      // We set AnySolidDataUnpackedWell to true if we found at least one
  730|       |      // valid non-zero solid file in preceding solid stream. If it is true
  731|       |      // and if current encrypted file is broken, we do not need to hint
  732|       |      // about a wrong password and can report CRC error only.
  733|      1|      if (!Arc.FileHead.Solid)
  ------------------
  |  Branch (733:11): [True: 1, False: 0]
  ------------------
  734|      1|        AnySolidDataUnpackedWell=false; // Reset the flag, because non-solid file is found.
  735|      0|      else
  736|      0|        if (Arc.FileHead.Method!=0 && Arc.FileHead.UnpSize>0 && ValidCRC)
  ------------------
  |  Branch (736:13): [True: 0, False: 0]
  |  Branch (736:39): [True: 0, False: 0]
  |  Branch (736:65): [True: 0, False: 0]
  ------------------
  737|      0|          AnySolidDataUnpackedWell=true;
  738|       | 
  739|      1|      bool BrokenFile=false;
  740|       |      
  741|       |      // Checksum is not calculated in skip solid mode for performance reason.
  742|      1|      if (!SkipSolid && ShowChecksum)
  ------------------
  |  Branch (742:11): [True: 1, False: 0]
  |  Branch (742:25): [True: 0, False: 1]
  ------------------
  743|      0|      {
  744|      0|        if (ValidCRC)
  ------------------
  |  Branch (744:13): [True: 0, False: 0]
  ------------------
  745|      0|        {
  746|      0|          if (Command!='P' && Command!='I' && !Cmd->DisableNames)
  ------------------
  |  Branch (746:15): [True: 0, False: 0]
  |  Branch (746:31): [True: 0, False: 0]
  |  Branch (746:47): [True: 0, False: 0]
  ------------------
  747|      0|            mprintf(L"%s%s ",Cmd->DisablePercentage ? L" ":L"\b\b\b\b\b ",
  ------------------
  |  Branch (747:30): [True: 0, False: 0]
  ------------------
  748|      0|              Arc.FileHead.FileHash.Type==HASH_NONE ? L"  ?":St(MOk));
  ------------------
  |  |    5|      0|#define St(x) (L"")
  ------------------
  |  Branch (748:15): [True: 0, False: 0]
  ------------------
  749|      0|        }
  750|      0|        else
  751|      0|        {
  752|      0|          if (Arc.FileHead.Encrypted && (!Arc.FileHead.UsePswCheck || 
  ------------------
  |  Branch (752:15): [True: 0, False: 0]
  |  Branch (752:42): [True: 0, False: 0]
  ------------------
  753|      0|              Arc.BrokenHeader) && !AnySolidDataUnpackedWell)
  ------------------
  |  Branch (753:15): [True: 0, False: 0]
  |  Branch (753:36): [True: 0, False: 0]
  ------------------
  754|      0|            uiMsg(UIERROR_CHECKSUMENC,Arc.FileName,ArcFileName);
  755|      0|          else
  756|      0|            uiMsg(UIERROR_CHECKSUM,Arc.FileName,ArcFileName);
  757|      0|          BrokenFile=true;
  758|      0|          ErrHandler.SetErrorCode(RARX_CRC);
  759|      0|#ifdef RARDLL
  760|       |          // If we already have ERAR_EOPEN as result of missing volume
  761|       |          // or ERAR_BAD_PASSWORD for RAR5 wrong password,
  762|       |          // we should not replace it with less precise ERAR_BAD_DATA.
  763|      0|          if (Cmd->DllError!=ERAR_EOPEN && Cmd->DllError!=ERAR_BAD_PASSWORD)
  ------------------
  |  |   12|      0|#define ERAR_EOPEN              15
  ------------------
                        if (Cmd->DllError!=ERAR_EOPEN && Cmd->DllError!=ERAR_BAD_PASSWORD)
  ------------------
  |  |   21|      0|#define ERAR_BAD_PASSWORD       24
  ------------------
  |  Branch (763:15): [True: 0, False: 0]
  |  Branch (763:44): [True: 0, False: 0]
  ------------------
  764|      0|            Cmd->DllError=ERAR_BAD_DATA;
  ------------------
  |  |    9|      0|#define ERAR_BAD_DATA           12
  ------------------
  765|      0|#endif
  766|      0|        }
  767|      0|      }
  768|      1|      else
  769|      1|      {
  770|       |        // We check SkipSolid to remove percent for skipped solid files only.
  771|       |        // We must not apply these \b to links with ShowChecksum==false
  772|       |        // and their possible error messages.
  773|      1|        if (SkipSolid) 
  ------------------
  |  Branch (773:13): [True: 0, False: 1]
  ------------------
  774|      0|          mprintf(L"\b\b\b\b\b     ");
  775|      1|      }
  776|       |
  777|       |      // If we successfully unpacked a hard link, we wish to set its file
  778|       |      // attributes. Hard link shares file metadata with link target,
  779|       |      // so we do not need to set link time or owner. But when we overwrite
  780|       |      // an existing link, we can call PrepareToDelete(), which affects
  781|       |      // link target attributes as well. So we set link attributes to restore
  782|       |      // both target and link attributes if PrepareToDelete() changed them.
  783|      1|      bool SetAttrOnly=LinkEntry && Arc.FileHead.RedirType==FSREDIR_HARDLINK && LinkSuccess;
  ------------------
  |  Branch (783:24): [True: 1, False: 0]
  |  Branch (783:37): [True: 0, False: 1]
  |  Branch (783:81): [True: 0, False: 0]
  ------------------
  784|       |
  785|      1|      if (!TestMode && (Command=='X' || Command=='E') &&
  ------------------
  |  Branch (785:11): [True: 1, False: 0]
  |  Branch (785:25): [True: 1, False: 0]
  |  Branch (785:41): [True: 0, False: 0]
  ------------------
  786|      1|          (!LinkEntry || SetAttrOnly || Arc.FileHead.RedirType==FSREDIR_FILECOPY && LinkSuccess) && 
  ------------------
  |  Branch (786:12): [True: 0, False: 1]
  |  Branch (786:26): [True: 0, False: 1]
  |  Branch (786:41): [True: 0, False: 1]
  |  Branch (786:85): [True: 0, False: 0]
  ------------------
  787|      1|          (!BrokenFile || Cmd->KeepBroken))
  ------------------
  |  Branch (787:12): [True: 0, False: 0]
  |  Branch (787:27): [True: 0, False: 0]
  ------------------
  788|      0|      {
  789|       |        // Below we use DestFileName instead of CurFile.FileName,
  790|       |        // so we can set file attributes also for hard links, which do not
  791|       |        // have the open CurFile. These strings are the same for other items.
  792|       |
  793|      0|        if (!SetAttrOnly)
  ------------------
  |  Branch (793:13): [True: 0, False: 0]
  ------------------
  794|      0|        {
  795|       |          // We could preallocate more space that really written to broken file
  796|       |          // or file with crafted header.
  797|      0|          if (Preallocated>0 && (BrokenFile || DataIO.CurUnpWrite!=Preallocated))
  ------------------
  |  Branch (797:15): [True: 0, False: 0]
  |  Branch (797:34): [True: 0, False: 0]
  |  Branch (797:48): [True: 0, False: 0]
  ------------------
  798|      0|            CurFile.Truncate();
  799|       |
  800|       |
  801|      0|          CurFile.SetOpenFileTime(
  802|      0|            Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.FileHead.mtime,
  ------------------
  |  Branch (802:13): [True: 0, False: 0]
  ------------------
  803|      0|            Cmd->xctime==EXTTIME_NONE ? NULL:&Arc.FileHead.ctime,
  ------------------
  |  Branch (803:13): [True: 0, False: 0]
  ------------------
  804|      0|            Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.FileHead.atime);
  ------------------
  |  Branch (804:13): [True: 0, False: 0]
  ------------------
  805|      0|          CurFile.Close();
  806|       |
  807|      0|          SetFileHeaderExtra(Cmd,Arc,DestFileName);
  808|       |
  809|      0|          CurFile.SetCloseFileTime(
  810|      0|            Cmd->xmtime==EXTTIME_NONE ? NULL:&Arc.FileHead.mtime,
  ------------------
  |  Branch (810:13): [True: 0, False: 0]
  ------------------
  811|      0|            Cmd->xatime==EXTTIME_NONE ? NULL:&Arc.FileHead.atime);
  ------------------
  |  Branch (811:13): [True: 0, False: 0]
  ------------------
  812|      0|        }
  813|       |        
  814|       |#if defined(_WIN_ALL) && !defined(SFX_MODULE)
  815|       |        if (Cmd->SetCompressedAttr &&
  816|       |            (Arc.FileHead.FileAttr & FILE_ATTRIBUTE_COMPRESSED)!=0)
  817|       |          SetFileCompression(DestFileName,true);
  818|       |        if (Cmd->ClearArc)
  819|       |          Arc.FileHead.FileAttr&=~FILE_ATTRIBUTE_ARCHIVE;
  820|       |#endif
  821|      0|        if (!Cmd->IgnoreGeneralAttr && !SetFileAttr(DestFileName,Arc.FileHead.FileAttr))
  ------------------
  |  Branch (821:13): [True: 0, False: 0]
  |  Branch (821:40): [True: 0, False: 0]
  ------------------
  822|      0|        {
  823|      0|          uiMsg(UIERROR_FILEATTR,Arc.FileName,DestFileName);
  824|       |          // Android cannot set file attributes and while UIERROR_FILEATTR
  825|       |          // above is handled by Android RAR silently, this call would cause
  826|       |          // "Operation not permitted" message for every unpacked file.
  827|      0|          ErrHandler.SysErrMsg();
  828|      0|        }
  829|       |
  830|      0|        PrevProcessed=true;
  831|      0|      }
  832|      1|    }
  833|      1|  }
  834|       |  // It is important to increment it for files, but not dirs. So we extract
  835|       |  // dir with its entire contents, not just dir record only even if dir
  836|       |  // record precedes files.
  837|      1|  if (MatchFound)
  ------------------
  |  Branch (837:7): [True: 1, False: 0]
  ------------------
  838|      1|    MatchedArgs++;
  839|      1|  if (DataIO.NextVolumeMissing)
  ------------------
  |  Branch (839:7): [True: 0, False: 1]
  ------------------
  840|      0|    return false;
  841|      1|  if (!ExtrFile)
  ------------------
  |  Branch (841:7): [True: 0, False: 1]
  ------------------
  842|      0|    if (!Arc.Solid)
  ------------------
  |  Branch (842:9): [True: 0, False: 0]
  ------------------
  843|      0|      Arc.SeekToNext();
  844|      0|    else
  845|      0|      if (!SkipSolid)
  ------------------
  |  Branch (845:11): [True: 0, False: 0]
  ------------------
  846|      0|        return false;
  847|      1|  return true;
  848|      1|}
_ZN10CmdExtract15ExtrPrepareNameER7ArchivePKwPwm:
  902|      1|{
  903|      1|  wcsncpyz(DestName,Cmd->ExtrPath,DestSize);
  904|       |
  905|      1|  if (*Cmd->ExtrPath!=0)
  ------------------
  |  Branch (905:7): [True: 0, False: 1]
  ------------------
  906|      0|  {
  907|      0|     wchar LastChar=*PointToLastChar(Cmd->ExtrPath);
  908|       |    // We need IsPathDiv check here to correctly handle Unix forward slash
  909|       |    // in the end of destination path in Windows: rar x arc dest/
  910|       |    // so we call IsPathDiv first instead of just calling AddEndSlash,
  911|       |    // which checks for only one type of path separator.
  912|       |    // IsDriveDiv is needed for current drive dir: rar x arc d:
  913|      0|    if (!IsPathDiv(LastChar) && !IsDriveDiv(LastChar))
  ------------------
  |  Branch (913:9): [True: 0, False: 0]
  |  Branch (913:33): [True: 0, False: 0]
  ------------------
  914|      0|    {
  915|       |      // Destination path can be without trailing slash if it come from GUI shell.
  916|      0|      AddEndSlash(DestName,DestSize);
  917|      0|    }
  918|      0|  }
  919|       |
  920|      1|#ifndef SFX_MODULE
  921|      1|  if (Cmd->AppendArcNameToPath!=APPENDARCNAME_NONE)
  ------------------
  |  Branch (921:7): [True: 0, False: 1]
  ------------------
  922|      0|  {
  923|      0|    switch(Cmd->AppendArcNameToPath)
  ------------------
  |  Branch (923:12): [True: 0, False: 0]
  ------------------
  924|      0|    {
  925|      0|      case APPENDARCNAME_DESTPATH: // To subdir of destination path.
  ------------------
  |  Branch (925:7): [True: 0, False: 0]
  ------------------
  926|      0|        wcsncatz(DestName,PointToName(Arc.FirstVolumeName),DestSize);
  927|      0|        SetExt(DestName,NULL,DestSize);
  928|      0|        break;
  929|      0|      case APPENDARCNAME_OWNSUBDIR: // To subdir of archive own dir.
  ------------------
  |  Branch (929:7): [True: 0, False: 0]
  ------------------
  930|      0|        wcsncpyz(DestName,Arc.FirstVolumeName,DestSize);
  931|      0|        SetExt(DestName,NULL,DestSize);
  932|      0|        break;
  933|      0|      case APPENDARCNAME_OWNDIR:  // To archive own dir.
  ------------------
  |  Branch (933:7): [True: 0, False: 0]
  ------------------
  934|      0|        wcsncpyz(DestName,Arc.FirstVolumeName,DestSize);
  935|      0|        RemoveNameFromPath(DestName);
  936|      0|        break;
  937|      0|    }
  938|      0|    AddEndSlash(DestName,DestSize);
  939|      0|  }
  940|      1|#endif
  941|       |
  942|      1|#ifndef SFX_MODULE
  943|      1|  wchar *ArcPath=*Cmd->ExclArcPath!=0 ? Cmd->ExclArcPath:Cmd->ArcPath;
  ------------------
  |  Branch (943:18): [True: 0, False: 1]
  ------------------
  944|      1|  size_t ArcPathLength=wcslen(ArcPath);
  945|      1|  if (ArcPathLength>0)
  ------------------
  |  Branch (945:7): [True: 0, False: 1]
  ------------------
  946|      0|  {
  947|      0|    size_t NameLength=wcslen(ArcFileName);
  948|      0|    if (NameLength>=ArcPathLength &&  wcsnicompc(ArcPath,ArcFileName,ArcPathLength)==0 &&
  ------------------
  |  Branch (948:9): [True: 0, False: 0]
  |  Branch (948:39): [True: 0, False: 0]
  ------------------
  949|      0|        (IsPathDiv(ArcPath[ArcPathLength-1]) || 
  ------------------
  |  Branch (949:10): [True: 0, False: 0]
  ------------------
  950|      0|         IsPathDiv(ArcFileName[ArcPathLength]) || ArcFileName[ArcPathLength]==0))
  ------------------
  |  Branch (950:10): [True: 0, False: 0]
  |  Branch (950:51): [True: 0, False: 0]
  ------------------
  951|      0|    {
  952|      0|      ArcFileName+=Min(ArcPathLength,NameLength);
  ------------------
  |  |    4|      0|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  953|      0|      while (IsPathDiv(*ArcFileName))
  ------------------
  |  Branch (953:14): [True: 0, False: 0]
  ------------------
  954|      0|        ArcFileName++;
  955|      0|      if (*ArcFileName==0) // Excessive -ap switch.
  ------------------
  |  Branch (955:11): [True: 0, False: 0]
  ------------------
  956|      0|      {
  957|      0|        *DestName=0;
  958|      0|        return;
  959|      0|      }
  960|      0|    }
  961|      0|  }
  962|      1|#endif
  963|       |
  964|      1|  wchar Command=Cmd->Command[0];
  965|       |  // Use -ep3 only in systems, where disk letters are exist, not in Unix.
  966|      1|  bool AbsPaths=Cmd->ExclPath==EXCL_ABSPATH && Command=='X' && IsDriveDiv(':');
  ------------------
  |  Branch (966:17): [True: 0, False: 1]
  |  Branch (966:48): [True: 0, False: 0]
  |  Branch (966:64): [True: 0, False: 0]
  ------------------
  967|       |
  968|       |  // We do not use any user specified destination paths when extracting
  969|       |  // absolute paths in -ep3 mode.
  970|      1|  if (AbsPaths)
  ------------------
  |  Branch (970:7): [True: 0, False: 1]
  ------------------
  971|      0|    *DestName=0;
  972|       |
  973|      1|  if (Command=='E' || Cmd->ExclPath==EXCL_SKIPWHOLEPATH)
  ------------------
  |  Branch (973:7): [True: 0, False: 1]
  |  Branch (973:23): [True: 0, False: 1]
  ------------------
  974|      0|    wcsncatz(DestName,PointToName(ArcFileName),DestSize);
  975|      1|  else
  976|      1|    wcsncatz(DestName,ArcFileName,DestSize);
  977|       |
  978|       |#ifdef _WIN_ALL
  979|       |  // Must do after Cmd->ArcPath processing above, so file name and arc path
  980|       |  // trailing spaces are in sync.
  981|       |  if (!Cmd->AllowIncompatNames)
  982|       |    MakeNameCompatible(DestName,DestSize);
  983|       |#endif
  984|       |
  985|      1|  wchar DiskLetter=toupperw(DestName[0]);
  986|       |
  987|      1|  if (AbsPaths)
  ------------------
  |  Branch (987:7): [True: 0, False: 1]
  ------------------
  988|      0|  {
  989|      0|    if (DestName[1]=='_' && IsPathDiv(DestName[2]) &&
  ------------------
  |  Branch (989:9): [True: 0, False: 0]
  |  Branch (989:29): [True: 0, False: 0]
  ------------------
  990|      0|        DiskLetter>='A' && DiskLetter<='Z')
  ------------------
  |  Branch (990:9): [True: 0, False: 0]
  |  Branch (990:28): [True: 0, False: 0]
  ------------------
  991|      0|      DestName[1]=':';
  992|      0|    else
  993|      0|      if (DestName[0]=='_' && DestName[1]=='_')
  ------------------
  |  Branch (993:11): [True: 0, False: 0]
  |  Branch (993:31): [True: 0, False: 0]
  ------------------
  994|      0|      {
  995|       |        // Convert __server\share to \\server\share.
  996|      0|        DestName[0]=CPATHDIVIDER;
  ------------------
  |  |  187|      0|#define CPATHDIVIDER '/'
  ------------------
  997|      0|        DestName[1]=CPATHDIVIDER;
  ------------------
  |  |  187|      0|#define CPATHDIVIDER '/'
  ------------------
  998|      0|      }
  999|      0|  }
 1000|      1|}
_ZN10CmdExtract11CheckUnpVerER7ArchivePKw:
 1234|      1|{
 1235|      1|  bool WrongVer;
 1236|      1|  if (Arc.Format==RARFMT50) // Both SFX and RAR can unpack RAR 5.0 archives.
  ------------------
  |  Branch (1236:7): [True: 1, False: 0]
  ------------------
 1237|      1|    WrongVer=Arc.FileHead.UnpVer>VER_UNPACK5;
  ------------------
  |  |   20|      1|#define  VER_UNPACK5            50U // It is stored as 0, but we add 50 when reading an archive.
  ------------------
 1238|      0|  else
 1239|      0|  {
 1240|       |#ifdef SFX_MODULE   // SFX can unpack only RAR 2.9 archives.
 1241|       |    WrongVer=Arc.FileHead.UnpVer!=VER_UNPACK;
 1242|       |#else               // All formats since 1.3 for RAR.
 1243|      0|    WrongVer=Arc.FileHead.UnpVer<13 || Arc.FileHead.UnpVer>VER_UNPACK;
  ------------------
  |  |   19|      0|#define  VER_UNPACK             29U
  ------------------
  |  Branch (1243:14): [True: 0, False: 0]
  |  Branch (1243:40): [True: 0, False: 0]
  ------------------
 1244|      0|#endif
 1245|      0|  }
 1246|       |
 1247|       |  // We can unpack stored files regardless of compression version field.
 1248|      1|  if (Arc.FileHead.Method==0)
  ------------------
  |  Branch (1248:7): [True: 1, False: 0]
  ------------------
 1249|      1|    WrongVer=false;
 1250|       |
 1251|      1|  if (WrongVer)
  ------------------
  |  Branch (1251:7): [True: 0, False: 1]
  ------------------
 1252|      0|  {
 1253|      0|    ErrHandler.UnknownMethodMsg(Arc.FileName,ArcFileName);
 1254|      0|    uiMsg(UIERROR_NEWERRAR,Arc.FileName);
 1255|      0|  }
 1256|      1|  return !WrongVer;
 1257|      1|}

_ZN4FileC2Ev:
    4|      3|{
    5|      3|  hFile=FILE_BAD_HANDLE;
  ------------------
  |  |   11|      3|  #define FILE_BAD_HANDLE -1
  ------------------
    6|      3|  *FileName=0;
    7|      3|  NewFile=false;
    8|      3|  LastWrite=false;
    9|      3|  HandleType=FILE_HANDLENORMAL;
   10|      3|  LineInput=false;
   11|      3|  SkipClose=false;
   12|      3|  ErrorType=FILE_SUCCESS;
   13|      3|  OpenShared=false;
   14|      3|  AllowDelete=true;
   15|      3|  AllowExceptions=true;
   16|      3|  PreserveAtime=false;
   17|       |#ifdef _WIN_ALL
   18|       |  CreateMode=FMF_UNDEFINED;
   19|       |#endif
   20|      3|  ReadErrorMode=FREM_ASK;
   21|      3|  TruncatedAfterReadError=false;
   22|      3|  CurFilePos=0;
   23|      3|}
_ZN4FileD2Ev:
   27|      3|{
   28|      3|  if (hFile!=FILE_BAD_HANDLE && !SkipClose)
  ------------------
  |  |   11|      6|  #define FILE_BAD_HANDLE -1
  ------------------
  |  Branch (28:7): [True: 2, False: 1]
  |  Branch (28:33): [True: 2, False: 0]
  ------------------
   29|      2|    if (NewFile)
  ------------------
  |  Branch (29:9): [True: 0, False: 2]
  ------------------
   30|      0|      Delete();
   31|      2|    else
   32|      2|      Close();
   33|      3|}
_ZN4File4OpenEPKwj:
   49|      2|{
   50|      2|  ErrorType=FILE_SUCCESS;
   51|      2|  FileHandle hNewFile;
   52|      2|  bool OpenShared=File::OpenShared || (Mode & FMF_OPENSHARED)!=0;
  ------------------
  |  Branch (52:19): [True: 0, False: 2]
  |  Branch (52:39): [True: 0, False: 2]
  ------------------
   53|      2|  bool UpdateMode=(Mode & FMF_UPDATE)!=0;
   54|      2|  bool WriteMode=(Mode & FMF_WRITE)!=0;
   55|       |#ifdef _WIN_ALL
   56|       |  uint Access=WriteMode ? GENERIC_WRITE:GENERIC_READ;
   57|       |  if (UpdateMode)
   58|       |    Access|=GENERIC_WRITE;
   59|       |  uint ShareMode=(Mode & FMF_OPENEXCLUSIVE) ? 0 : FILE_SHARE_READ;
   60|       |  if (OpenShared)
   61|       |    ShareMode|=FILE_SHARE_WRITE;
   62|       |  uint Flags=FILE_FLAG_SEQUENTIAL_SCAN;
   63|       |  FindData FD;
   64|       |  if (PreserveAtime)
   65|       |    Access|=FILE_WRITE_ATTRIBUTES; // Needed to preserve atime.
   66|       |  hNewFile=CreateFile(Name,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL);
   67|       |
   68|       |  DWORD LastError;
   69|       |  if (hNewFile==FILE_BAD_HANDLE)
   70|       |  {
   71|       |    LastError=GetLastError();
   72|       |
   73|       |    wchar LongName[NM];
   74|       |    if (GetWinLongPath(Name,LongName,ASIZE(LongName)))
   75|       |    {
   76|       |      hNewFile=CreateFile(LongName,Access,ShareMode,NULL,OPEN_EXISTING,Flags,NULL);
   77|       |
   78|       |      // For archive names longer than 260 characters first CreateFile
   79|       |      // (without \\?\) fails and sets LastError to 3 (access denied).
   80|       |      // We need the correct "file not found" error code to decide
   81|       |      // if we create a new archive or quit with "cannot create" error.
   82|       |      // So we need to check the error code after \\?\ CreateFile again,
   83|       |      // otherwise we'll fail to create new archives with long names.
   84|       |      // But we cannot simply assign the new code to LastError,
   85|       |      // because it would break "..\arcname.rar" relative names processing.
   86|       |      // First CreateFile returns the correct "file not found" code for such
   87|       |      // names, but "\\?\" CreateFile returns ERROR_INVALID_NAME treating
   88|       |      // dots as a directory name. So we check only for "file not found"
   89|       |      // error here and for other errors use the first CreateFile result.
   90|       |      if (GetLastError()==ERROR_FILE_NOT_FOUND)
   91|       |        LastError=ERROR_FILE_NOT_FOUND;
   92|       |    }
   93|       |  }
   94|       |  if (hNewFile==FILE_BAD_HANDLE && LastError==ERROR_FILE_NOT_FOUND)
   95|       |    ErrorType=FILE_NOTFOUND;
   96|       |  if (PreserveAtime && hNewFile!=FILE_BAD_HANDLE)
   97|       |  {
   98|       |    FILETIME ft={0xffffffff,0xffffffff}; // This value prevents atime modification.
   99|       |    SetFileTime(hNewFile,NULL,&ft,NULL);
  100|       |  }
  101|       |
  102|       |#else
  103|      2|  int flags=UpdateMode ? O_RDWR:(WriteMode ? O_WRONLY:O_RDONLY);
  ------------------
  |  Branch (103:13): [True: 0, False: 2]
  |  Branch (103:34): [True: 0, False: 2]
  ------------------
  104|       |#ifdef O_BINARY
  105|       |  flags|=O_BINARY;
  106|       |#if defined(_AIX) && defined(_LARGE_FILE_API)
  107|       |  flags|=O_LARGEFILE;
  108|       |#endif
  109|       |#endif
  110|       |  // NDK r20 has O_NOATIME, but fails to create files with it in Android 7+.
  111|      2|#if defined(O_NOATIME)
  112|      2|  if (PreserveAtime)
  ------------------
  |  Branch (112:7): [True: 0, False: 2]
  ------------------
  113|      0|    flags|=O_NOATIME;
  114|      2|#endif
  115|      2|  char NameA[NM];
  116|      2|  WideToChar(Name,NameA,ASIZE(NameA));
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  117|       |
  118|      2|  int handle=open(NameA,flags);
  119|      2|#ifdef LOCK_EX
  120|       |
  121|       |#ifdef _OSF_SOURCE
  122|       |  extern "C" int flock(int, int);
  123|       |#endif
  124|      2|  if (!OpenShared && UpdateMode && handle>=0 && flock(handle,LOCK_EX|LOCK_NB)==-1)
  ------------------
  |  Branch (124:7): [True: 2, False: 0]
  |  Branch (124:22): [True: 0, False: 2]
  |  Branch (124:36): [True: 0, False: 0]
  |  Branch (124:49): [True: 0, False: 0]
  ------------------
  125|      0|  {
  126|      0|    close(handle);
  127|      0|    return false;
  128|      0|  }
  129|       |
  130|      2|#endif
  131|      2|  if (handle==-1)
  ------------------
  |  Branch (131:7): [True: 0, False: 2]
  ------------------
  132|      0|    hNewFile=FILE_BAD_HANDLE;
  ------------------
  |  |   11|      0|  #define FILE_BAD_HANDLE -1
  ------------------
  133|      2|  else
  134|      2|  {
  135|      2|#ifdef FILE_USE_OPEN
  136|      2|    hNewFile=handle;
  137|       |#else
  138|       |    hNewFile=fdopen(handle,UpdateMode ? UPDATEBINARY:READBINARY);
  139|       |#endif
  140|      2|  }
  141|      2|  if (hNewFile==FILE_BAD_HANDLE && errno==ENOENT)
  ------------------
  |  |   11|      4|  #define FILE_BAD_HANDLE -1
  ------------------
  |  Branch (141:7): [True: 0, False: 2]
  |  Branch (141:36): [True: 0, False: 0]
  ------------------
  142|      0|    ErrorType=FILE_NOTFOUND;
  143|      2|#endif
  144|      2|  NewFile=false;
  145|      2|  HandleType=FILE_HANDLENORMAL;
  146|      2|  SkipClose=false;
  147|      2|  bool Success=hNewFile!=FILE_BAD_HANDLE;
  ------------------
  |  |   11|      2|  #define FILE_BAD_HANDLE -1
  ------------------
  148|      2|  if (Success)
  ------------------
  |  Branch (148:7): [True: 2, False: 0]
  ------------------
  149|      2|  {
  150|      2|    hFile=hNewFile;
  151|      2|    wcsncpyz(FileName,Name,ASIZE(FileName));
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  152|      2|    TruncatedAfterReadError=false;
  153|      2|  }
  154|      2|  return Success;
  155|      2|}
_ZN4File5WOpenEPKw:
  168|      2|{
  169|      2|  if (Open(Name))
  ------------------
  |  Branch (169:7): [True: 2, False: 0]
  ------------------
  170|      2|    return true;
  171|      0|  ErrHandler.OpenErrorMsg(Name);
  172|      0|  return false;
  173|      2|}
_ZN4File5CloseEv:
  242|      2|{
  243|      2|  bool Success=true;
  244|       |
  245|      2|  if (hFile!=FILE_BAD_HANDLE)
  ------------------
  |  |   11|      2|  #define FILE_BAD_HANDLE -1
  ------------------
  |  Branch (245:7): [True: 2, False: 0]
  ------------------
  246|      2|  {
  247|      2|    if (!SkipClose)
  ------------------
  |  Branch (247:9): [True: 2, False: 0]
  ------------------
  248|      2|    {
  249|       |#ifdef _WIN_ALL
  250|       |      // We use the standard system handle for stdout in Windows
  251|       |      // and it must not be closed here.
  252|       |      if (HandleType==FILE_HANDLENORMAL)
  253|       |        Success=CloseHandle(hFile)==TRUE;
  254|       |#else
  255|      2|#ifdef FILE_USE_OPEN
  256|      2|      Success=close(hFile)!=-1;
  257|       |#else
  258|       |      Success=fclose(hFile)!=EOF;
  259|       |#endif
  260|      2|#endif
  261|      2|    }
  262|      2|    hFile=FILE_BAD_HANDLE;
  ------------------
  |  |   11|      2|  #define FILE_BAD_HANDLE -1
  ------------------
  263|      2|  }
  264|      2|  HandleType=FILE_HANDLENORMAL;
  265|      2|  if (!Success && AllowExceptions)
  ------------------
  |  Branch (265:7): [True: 0, False: 2]
  |  Branch (265:19): [True: 0, False: 0]
  ------------------
  266|      0|    ErrHandler.CloseError(FileName);
  267|      2|  return Success;
  268|      2|}
_ZN4File4ReadEPvm:
  375|      9|{
  376|      9|  if (TruncatedAfterReadError)
  ------------------
  |  Branch (376:7): [True: 0, False: 9]
  ------------------
  377|      0|    return 0;
  378|       |
  379|      9|  int64 FilePos=0; // Initialized only to suppress some compilers warning.
  380|       |
  381|      9|  if (ReadErrorMode==FREM_IGNORE)
  ------------------
  |  Branch (381:7): [True: 0, False: 9]
  ------------------
  382|      0|    FilePos=Tell();
  383|      9|  int TotalRead=0;
  384|      9|  while (true)
  ------------------
  |  Branch (384:10): [Folded - Ignored]
  ------------------
  385|      9|  {
  386|      9|    int ReadSize=DirectRead(Data,Size);
  387|       |
  388|      9|    if (ReadSize==-1)
  ------------------
  |  Branch (388:9): [True: 0, False: 9]
  ------------------
  389|      0|    {
  390|      0|      ErrorType=FILE_READERROR;
  391|      0|      if (AllowExceptions)
  ------------------
  |  Branch (391:11): [True: 0, False: 0]
  ------------------
  392|      0|        if (ReadErrorMode==FREM_IGNORE)
  ------------------
  |  Branch (392:13): [True: 0, False: 0]
  ------------------
  393|      0|        {
  394|      0|          ReadSize=0;
  395|      0|          for (size_t I=0;I<Size;I+=512)
  ------------------
  |  Branch (395:27): [True: 0, False: 0]
  ------------------
  396|      0|          {
  397|      0|            Seek(FilePos+I,SEEK_SET);
  398|      0|            size_t SizeToRead=Min(Size-I,512);
  ------------------
  |  |    4|      0|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  399|      0|            int ReadCode=DirectRead(Data,SizeToRead);
  400|      0|            ReadSize+=(ReadCode==-1) ? 512:ReadCode;
  ------------------
  |  Branch (400:23): [True: 0, False: 0]
  ------------------
  401|      0|            if (ReadSize!=-1)
  ------------------
  |  Branch (401:17): [True: 0, False: 0]
  ------------------
  402|      0|              TotalRead+=ReadSize;
  403|      0|          }
  404|      0|        }
  405|      0|        else
  406|      0|        {
  407|      0|          bool Ignore=false,Retry=false,Quit=false;
  408|      0|          if (ReadErrorMode==FREM_ASK && HandleType==FILE_HANDLENORMAL)
  ------------------
  |  Branch (408:15): [True: 0, False: 0]
  |  Branch (408:42): [True: 0, False: 0]
  ------------------
  409|      0|          {
  410|      0|            ErrHandler.AskRepeatRead(FileName,Ignore,Retry,Quit);
  411|      0|            if (Retry)
  ------------------
  |  Branch (411:17): [True: 0, False: 0]
  ------------------
  412|      0|              continue;
  413|      0|          }
  414|      0|          if (Ignore || ReadErrorMode==FREM_TRUNCATE)
  ------------------
  |  Branch (414:15): [True: 0, False: 0]
  |  Branch (414:25): [True: 0, False: 0]
  ------------------
  415|      0|          {
  416|      0|            TruncatedAfterReadError=true;
  417|      0|            return 0;
  418|      0|          }
  419|      0|          ErrHandler.ReadError(FileName);
  420|      0|        }
  421|      0|    }
  422|      9|    TotalRead+=ReadSize; // If ReadSize is -1, TotalRead is also set to -1 here.
  423|       |
  424|      9|    if (HandleType==FILE_HANDLESTD && !LineInput && ReadSize>0 && (uint)ReadSize<Size)
  ------------------
  |  Branch (424:9): [True: 0, False: 9]
  |  Branch (424:39): [True: 0, False: 0]
  |  Branch (424:53): [True: 0, False: 0]
  |  Branch (424:67): [True: 0, False: 0]
  ------------------
  425|      0|    {
  426|       |      // Unlike regular files, for pipe we can read only as much as was
  427|       |      // written at the other end of pipe. We had seen data coming in small
  428|       |      // ~80 byte chunks when piping from 'type arc.rar'. Extraction code
  429|       |      // would fail if we read an incomplete archive header from stdin.
  430|       |      // So here we ensure that requested size is completely read.
  431|       |      // But we return the available data immediately in "line input" mode,
  432|       |      // when processing user's input in console prompts. Otherwise apps
  433|       |      // piping user responses to multiple Ask() prompts can hang if no more
  434|       |      // data is available yet and pipe isn't closed.
  435|      0|      Data=(byte*)Data+ReadSize;
  436|      0|      Size-=ReadSize;
  437|      0|      continue;
  438|      0|    }
  439|      9|    break;
  440|      9|  }
  441|      9|  if (TotalRead>0) // Can be -1 for error and AllowExceptions disabled.
  ------------------
  |  Branch (441:7): [True: 8, False: 1]
  ------------------
  442|      8|    CurFilePos+=TotalRead;
  443|      9|  return TotalRead; // It can return -1 only if AllowExceptions is disabled.
  444|      9|}
_ZN4File10DirectReadEPvm:
  449|      9|{
  450|       |#ifdef _WIN_ALL
  451|       |  const size_t MaxDeviceRead=20000;
  452|       |  const size_t MaxLockedRead=32768;
  453|       |#endif
  454|      9|  if (HandleType==FILE_HANDLESTD)
  ------------------
  |  Branch (454:7): [True: 0, False: 9]
  ------------------
  455|      0|  {
  456|       |#ifdef _WIN_ALL
  457|       |//    if (Size>MaxDeviceRead)
  458|       |//      Size=MaxDeviceRead;
  459|       |    hFile=GetStdHandle(STD_INPUT_HANDLE);
  460|       |#else
  461|      0|#ifdef FILE_USE_OPEN
  462|      0|    hFile=STDIN_FILENO;
  463|       |#else
  464|       |    hFile=stdin;
  465|       |#endif
  466|      0|#endif
  467|      0|  }
  468|       |#ifdef _WIN_ALL
  469|       |  // For pipes like 'type file.txt | rar -si arcname' ReadFile may return
  470|       |  // data in small ~4KB blocks. It may slightly reduce the compression ratio.
  471|       |  DWORD Read;
  472|       |  if (!ReadFile(hFile,Data,(DWORD)Size,&Read,NULL))
  473|       |  {
  474|       |    if (IsDevice() && Size>MaxDeviceRead)
  475|       |      return DirectRead(Data,MaxDeviceRead);
  476|       |    if (HandleType==FILE_HANDLESTD && GetLastError()==ERROR_BROKEN_PIPE)
  477|       |      return 0;
  478|       |
  479|       |    // We had a bug report about failure to archive 1C database lock file
  480|       |    // 1Cv8tmp.1CL, which is a zero length file with a region above 200 KB
  481|       |    // permanently locked. If our first read request uses too large buffer
  482|       |    // and if we are in -dh mode, so we were able to open the file,
  483|       |    // we'll fail with "Read error". So now we use try a smaller buffer size
  484|       |    // in case of lock error.
  485|       |    if (HandleType==FILE_HANDLENORMAL && Size>MaxLockedRead &&
  486|       |        GetLastError()==ERROR_LOCK_VIOLATION)
  487|       |      return DirectRead(Data,MaxLockedRead);
  488|       |
  489|       |    return -1;
  490|       |  }
  491|       |  return Read;
  492|       |#else
  493|      9|#ifdef FILE_USE_OPEN
  494|      9|  ssize_t ReadSize=read(hFile,Data,Size);
  495|      9|  if (ReadSize==-1)
  ------------------
  |  Branch (495:7): [True: 0, False: 9]
  ------------------
  496|      0|    return -1;
  497|      9|  return (int)ReadSize;
  498|       |#else
  499|       |  if (LastWrite)
  500|       |  {
  501|       |    fflush(hFile);
  502|       |    LastWrite=false;
  503|       |  }
  504|       |  clearerr(hFile);
  505|       |  size_t ReadSize=fread(Data,1,Size,hFile);
  506|       |  if (ferror(hFile))
  507|       |    return -1;
  508|       |  return (int)ReadSize;
  509|       |#endif
  510|      9|#endif
  511|      9|}
_ZN4File4SeekEli:
  515|      7|{
  516|      7|  if (!RawSeek(Offset,Method) && AllowExceptions)
  ------------------
  |  Branch (516:7): [True: 0, False: 7]
  |  Branch (516:34): [True: 0, False: 0]
  ------------------
  517|      0|    ErrHandler.SeekError(FileName);
  518|      7|}
_ZN4File7RawSeekEli:
  522|      7|{
  523|      7|  if (hFile==FILE_BAD_HANDLE)
  ------------------
  |  |   11|      7|  #define FILE_BAD_HANDLE -1
  ------------------
  |  Branch (523:7): [True: 0, False: 7]
  ------------------
  524|      0|    return true;
  525|      7|  if (!IsSeekable())
  ------------------
  |  Branch (525:7): [True: 0, False: 7]
  ------------------
  526|      0|  {
  527|      0|    if (Method==SEEK_CUR)
  ------------------
  |  Branch (527:9): [True: 0, False: 0]
  ------------------
  528|      0|    {
  529|      0|      Offset+=CurFilePos;
  530|      0|      Method=SEEK_SET;
  531|      0|    }
  532|      0|    if (Method==SEEK_SET && Offset>=CurFilePos) // Reading for seek forward.
  ------------------
  |  Branch (532:9): [True: 0, False: 0]
  |  Branch (532:29): [True: 0, False: 0]
  ------------------
  533|      0|    {
  534|      0|      uint64 SkipSize=Offset-CurFilePos;
  535|      0|      while (SkipSize>0)
  ------------------
  |  Branch (535:14): [True: 0, False: 0]
  ------------------
  536|      0|      {
  537|      0|        byte Buf[4096];
  538|      0|        int ReadSize=Read(Buf,(size_t)Min(SkipSize,ASIZE(Buf)));
  ------------------
  |  |    4|      0|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  539|      0|        if (ReadSize<=0)
  ------------------
  |  Branch (539:13): [True: 0, False: 0]
  ------------------
  540|      0|          return false;
  541|      0|        SkipSize-=ReadSize;
  542|      0|      }
  543|      0|      CurFilePos=Offset;
  544|      0|      return true;
  545|      0|    }
  546|       |
  547|      0|    return false; // Backward or end of file seek on unseekable file.
  548|      0|  }
  549|      7|  if (Offset<0 && Method!=SEEK_SET)
  ------------------
  |  Branch (549:7): [True: 0, False: 7]
  |  Branch (549:19): [True: 0, False: 0]
  ------------------
  550|      0|  {
  551|      0|    Offset=(Method==SEEK_CUR ? Tell():FileLength())+Offset;
  ------------------
  |  Branch (551:13): [True: 0, False: 0]
  ------------------
  552|      0|    Method=SEEK_SET;
  553|      0|  }
  554|       |#ifdef _WIN_ALL
  555|       |  LONG HighDist=(LONG)(Offset>>32);
  556|       |  if (SetFilePointer(hFile,(LONG)Offset,&HighDist,Method)==0xffffffff &&
  557|       |      GetLastError()!=NO_ERROR)
  558|       |    return false;
  559|       |#else
  560|      7|  LastWrite=false;
  561|      7|#ifdef FILE_USE_OPEN
  562|      7|  if (lseek(hFile,(off_t)Offset,Method)==-1)
  ------------------
  |  Branch (562:7): [True: 0, False: 7]
  ------------------
  563|      0|    return false;
  564|       |#elif defined(_LARGEFILE_SOURCE) && !defined(_OSF_SOURCE) && !defined(__VMS)
  565|       |  if (fseeko(hFile,Offset,Method)!=0)
  566|       |    return false;
  567|       |#else
  568|       |  if (fseek(hFile,(long)Offset,Method)!=0)
  569|       |    return false;
  570|       |#endif
  571|      7|#endif
  572|      7|  return true;
  573|      7|}
_ZN4File4TellEv:
  577|      8|{
  578|      8|  if (hFile==FILE_BAD_HANDLE)
  ------------------
  |  |   11|      8|  #define FILE_BAD_HANDLE -1
  ------------------
  |  Branch (578:7): [True: 0, False: 8]
  ------------------
  579|      0|    if (AllowExceptions)
  ------------------
  |  Branch (579:9): [True: 0, False: 0]
  ------------------
  580|      0|      ErrHandler.SeekError(FileName);
  581|      0|    else
  582|      0|      return -1;
  583|      8|  if (!IsSeekable())
  ------------------
  |  Branch (583:7): [True: 0, False: 8]
  ------------------
  584|      0|    return CurFilePos;
  585|       |#ifdef _WIN_ALL
  586|       |  LONG HighDist=0;
  587|       |  uint LowDist=SetFilePointer(hFile,0,&HighDist,FILE_CURRENT);
  588|       |  if (LowDist==0xffffffff && GetLastError()!=NO_ERROR)
  589|       |    if (AllowExceptions)
  590|       |      ErrHandler.SeekError(FileName);
  591|       |    else
  592|       |      return -1;
  593|       |  return INT32TO64(HighDist,LowDist);
  594|       |#else
  595|      8|#ifdef FILE_USE_OPEN
  596|      8|  return lseek(hFile,0,SEEK_CUR);
  597|       |#elif defined(_LARGEFILE_SOURCE) && !defined(_OSF_SOURCE)
  598|       |  return ftello(hFile);
  599|       |#else
  600|       |  return ftell(hFile);
  601|       |#endif
  602|      8|#endif
  603|      8|}
_ZN4File10FileLengthEv:
  751|      2|{
  752|      2|  int64 SavePos=Tell();
  753|      2|  Seek(0,SEEK_END);
  754|      2|  int64 Length=Tell();
  755|      2|  Seek(SavePos,SEEK_SET);
  756|      2|  return Length;
  757|      2|}
_ZN4File8IsDeviceEv:
  761|      3|{
  762|      3|  if (hFile==FILE_BAD_HANDLE)
  ------------------
  |  |   11|      3|  #define FILE_BAD_HANDLE -1
  ------------------
  |  Branch (762:7): [True: 1, False: 2]
  ------------------
  763|      1|    return false;
  764|       |#ifdef _WIN_ALL
  765|       |  uint Type=GetFileType(hFile);
  766|       |  return Type==FILE_TYPE_CHAR || Type==FILE_TYPE_PIPE;
  767|       |#else
  768|      2|  return isatty(GetFD());
  769|      3|#endif
  770|      3|}

_ZN4File10IsSeekableEv:
  127|     16|    bool IsSeekable() {return HandleType!=FILE_HANDLESTD;}
_ZN4File14SetAllowDeleteEb:
  134|      1|    void SetAllowDelete(bool Allow) {AllowDelete=Allow;}
_ZN4File5GetFDEv:
  140|      2|    {
  141|      2|#ifdef FILE_USE_OPEN
  142|      2|      return hFile;
  143|       |#else
  144|       |      return fileno(hFile);
  145|       |#endif
  146|      2|    }

_Z9FileExistPKw:
  191|      1|{
  192|       |#ifdef _WIN_ALL
  193|       |  return GetFileAttr(Name)!=0xffffffff;
  194|       |#elif defined(ENABLE_ACCESS)
  195|      1|  char NameA[NM];
  196|      1|  WideToChar(Name,NameA,ASIZE(NameA));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  197|      1|  return access(NameA,0)==0;
  198|       |#else
  199|       |  FindData FD;
  200|       |  return FindFile::FastFind(Name,&FD);
  201|       |#endif
  202|      1|}
_Z5IsDirj:
  219|      2|{
  220|       |#ifdef _WIN_ALL
  221|       |  return Attr!=0xffffffff && (Attr & FILE_ATTRIBUTE_DIRECTORY)!=0;
  222|       |#endif
  223|      2|#if defined(_UNIX)
  224|      2|  return (Attr & 0xF000)==0x4000;
  225|      2|#endif
  226|      2|}
_Z6IsLinkj:
  239|      2|{
  240|      2|#ifdef _UNIX
  241|      2|  return (Attr & 0xF000)==0xA000;
  242|       |#elif defined(_WIN_ALL)
  243|       |  return (Attr & FILE_ATTRIBUTE_REPARSE_POINT)!=0;
  244|       |#else
  245|       |  return false;
  246|       |#endif
  247|      2|}

_ZN8FindFile8FastFindEPKwP8FindDatab:
  109|      2|{
  110|      2|  fd->Error=false;
  111|       |#ifndef _UNIX
  112|       |  if (IsWildcard(FindMask))
  113|       |    return false;
  114|       |#endif    
  115|       |#ifdef _WIN_ALL
  116|       |  HANDLE hFind=Win32Find(INVALID_HANDLE_VALUE,FindMask,fd);
  117|       |  if (hFind==INVALID_HANDLE_VALUE)
  118|       |    return false;
  119|       |  FindClose(hFind);
  120|       |#else
  121|      2|  char FindMaskA[NM];
  122|      2|  WideToChar(FindMask,FindMaskA,ASIZE(FindMaskA));
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  123|       |
  124|      2|  struct stat st;
  125|      2|  if (GetSymLink)
  ------------------
  |  Branch (125:7): [True: 0, False: 2]
  ------------------
  126|      0|  {
  127|      0|#ifdef SAVE_LINKS
  128|      0|    if (lstat(FindMaskA,&st)!=0)
  ------------------
  |  Branch (128:9): [True: 0, False: 0]
  ------------------
  129|       |#else
  130|       |    if (stat(FindMaskA,&st)!=0)
  131|       |#endif
  132|      0|    {
  133|      0|      fd->Error=(errno!=ENOENT);
  134|      0|      return false;
  135|      0|    }
  136|      0|  }
  137|      2|  else
  138|      2|    if (stat(FindMaskA,&st)!=0)
  ------------------
  |  Branch (138:9): [True: 0, False: 2]
  ------------------
  139|      0|    {
  140|      0|      fd->Error=(errno!=ENOENT);
  141|      0|      return false;
  142|      0|    }
  143|      2|  fd->FileAttr=st.st_mode;
  144|      2|  fd->Size=st.st_size;
  145|       |
  146|      2|#ifdef UNIX_TIME_NS
  147|       |#if defined(_APPLE)
  148|       |  fd->mtime.SetUnixNS(st.st_mtimespec.tv_sec*(uint64)1000000000+st.st_mtimespec.tv_nsec);
  149|       |  fd->atime.SetUnixNS(st.st_atimespec.tv_sec*(uint64)1000000000+st.st_atimespec.tv_nsec);
  150|       |  fd->ctime.SetUnixNS(st.st_ctimespec.tv_sec*(uint64)1000000000+st.st_ctimespec.tv_nsec);
  151|       |#else
  152|      2|  fd->mtime.SetUnixNS(st.st_mtim.tv_sec*(uint64)1000000000+st.st_mtim.tv_nsec);
  153|      2|  fd->atime.SetUnixNS(st.st_atim.tv_sec*(uint64)1000000000+st.st_atim.tv_nsec);
  154|      2|  fd->ctime.SetUnixNS(st.st_ctim.tv_sec*(uint64)1000000000+st.st_ctim.tv_nsec);
  155|      2|#endif
  156|       |#else
  157|       |  fd->mtime.SetUnix(st.st_mtime);
  158|       |  fd->atime.SetUnix(st.st_atime);
  159|       |  fd->ctime.SetUnix(st.st_ctime);
  160|       |#endif
  161|       |
  162|      2|  wcsncpyz(fd->Name,FindMask,ASIZE(fd->Name));
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  163|      2|#endif
  164|      2|  fd->Flags=0;
  165|      2|  fd->IsDir=IsDir(fd->FileAttr);
  166|      2|  fd->IsLink=IsLink(fd->FileAttr);
  167|       |
  168|      2|  return true;
  169|      2|}

_ZN8BitInputC2Eb:
    4|      4|{
    5|      4|  ExternalBuffer=false;
    6|      4|  if (AllocBuffer)
  ------------------
  |  Branch (6:7): [True: 4, False: 0]
  ------------------
    7|      4|  {
    8|       |    // getbits32 attempts to read data from InAddr, ... InAddr+3 positions.
    9|       |    // So let's allocate 3 additional bytes for situation, when we need to
   10|       |    // read only 1 byte from the last position of buffer and avoid a crash
   11|       |    // from access to next 3 bytes, which contents we do not need.
   12|      4|    size_t BufSize=MAX_SIZE+3;
   13|      4|    InBuf=new byte[BufSize];
   14|       |
   15|       |    // Ensure that we get predictable results when accessing bytes in area
   16|       |    // not filled with read data.
   17|      4|    memset(InBuf,0,BufSize);
   18|      4|  }
   19|      0|  else
   20|      0|    InBuf=NULL;
   21|      4|}
_ZN8BitInputD2Ev:
   25|      4|{
   26|      4|  if (!ExternalBuffer)
  ------------------
  |  Branch (26:7): [True: 4, False: 0]
  ------------------
   27|      4|    delete[] InBuf;
   28|      4|}

_ZN8BitInput12InitBitInputEv:
   20|      2|    {
   21|      2|      InAddr=InBit=0;
   22|      2|    }

_ZN9HashValue4InitE9HASH_TYPE:
    4|      1|{
    5|      1|  HashValue::Type=Type;
    6|       |
    7|       |  // Zero length data CRC32 is 0. It is important to set it when creating
    8|       |  // headers with no following data like directories or symlinks.
    9|      1|  if (Type==HASH_RAR14 || Type==HASH_CRC32)
  ------------------
  |  Branch (9:7): [True: 0, False: 1]
  |  Branch (9:27): [True: 0, False: 1]
  ------------------
   10|      0|    CRC32=0;
   11|      1|  if (Type==HASH_BLAKE2)
  ------------------
  |  Branch (11:7): [True: 0, False: 1]
  ------------------
   12|      0|  {
   13|       |    // dd0e891776933f43c7d032b08a917e25741f8aa9a12c12e1cac8801500f2ca4f
   14|       |    // is BLAKE2sp hash of empty data. We init the structure to this value,
   15|       |    // so if we create a file or service header with no following data like
   16|       |    // "file copy" or "symlink", we set the checksum to proper value avoiding
   17|       |    // additional header type or size checks when extracting.
   18|      0|    static byte EmptyHash[32]={
   19|      0|      0xdd, 0x0e, 0x89, 0x17, 0x76, 0x93, 0x3f, 0x43,
   20|      0|      0xc7, 0xd0, 0x32, 0xb0, 0x8a, 0x91, 0x7e, 0x25,
   21|      0|      0x74, 0x1f, 0x8a, 0xa9, 0xa1, 0x2c, 0x12, 0xe1,
   22|      0|      0xca, 0xc8, 0x80, 0x15, 0x00, 0xf2, 0xca, 0x4f
   23|      0|    };
   24|      0|    memcpy(Digest,EmptyHash,sizeof(Digest));
   25|      0|  }
   26|      1|}
_ZN9HashValueeqERKS_:
   30|      1|{
   31|      1|  if (Type==HASH_NONE || cmp.Type==HASH_NONE)
  ------------------
  |  Branch (31:7): [True: 1, False: 0]
  |  Branch (31:26): [True: 0, False: 0]
  ------------------
   32|      1|    return true;
   33|      0|  if (Type==HASH_RAR14 && cmp.Type==HASH_RAR14 || 
  ------------------
  |  Branch (33:7): [True: 0, False: 0]
  |  Branch (33:27): [True: 0, False: 0]
  ------------------
   34|      0|      Type==HASH_CRC32 && cmp.Type==HASH_CRC32)
  ------------------
  |  Branch (34:7): [True: 0, False: 0]
  |  Branch (34:27): [True: 0, False: 0]
  ------------------
   35|      0|    return CRC32==cmp.CRC32;
   36|      0|  if (Type==HASH_BLAKE2 && cmp.Type==HASH_BLAKE2)
  ------------------
  |  Branch (36:7): [True: 0, False: 0]
  |  Branch (36:28): [True: 0, False: 0]
  ------------------
   37|      0|    return memcmp(Digest,cmp.Digest,sizeof(Digest))==0;
   38|      0|  return false;
   39|      0|}
_ZN8DataHashC2Ev:
   43|     12|{
   44|     12|  blake2ctx=NULL;
   45|     12|  HashType=HASH_NONE;
   46|     12|#ifdef RAR_SMP
   47|     12|  ThPool=NULL;
   48|     12|  MaxThreads=0;
   49|     12|#endif
   50|     12|}
_ZN8DataHashD2Ev:
   54|     12|{
   55|     12|#ifdef RAR_SMP
   56|     12|  delete ThPool;
   57|     12|#endif
   58|     12|  cleandata(&CurCRC32, sizeof(CurCRC32));
   59|     12|  if (blake2ctx!=NULL)
  ------------------
  |  Branch (59:7): [True: 2, False: 10]
  ------------------
   60|      2|  {
   61|      2|    cleandata(blake2ctx, sizeof(blake2sp_state));
   62|      2|    delete blake2ctx;
   63|      2|  }
   64|     12|}
_ZN8DataHash4InitE9HASH_TYPEj:
   68|      2|{
   69|      2|  if (blake2ctx==NULL)
  ------------------
  |  Branch (69:7): [True: 2, False: 0]
  ------------------
   70|      2|    blake2ctx=new blake2sp_state;
   71|      2|  HashType=Type;
   72|      2|  if (Type==HASH_RAR14)
  ------------------
  |  Branch (72:7): [True: 0, False: 2]
  ------------------
   73|      0|    CurCRC32=0;
   74|      2|  if (Type==HASH_CRC32)
  ------------------
  |  Branch (74:7): [True: 0, False: 2]
  ------------------
   75|      0|    CurCRC32=0xffffffff; // Initial CRC32 value.
   76|      2|  if (Type==HASH_BLAKE2)
  ------------------
  |  Branch (76:7): [True: 0, False: 2]
  ------------------
   77|      0|    blake2sp_init(blake2ctx);
   78|      2|#ifdef RAR_SMP
   79|      2|  DataHash::MaxThreads=Min(MaxThreads,MaxHashThreads);
  ------------------
  |  |    4|      2|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 2]
  |  |  ------------------
  ------------------
   80|      2|#endif
   81|      2|}
_ZN8DataHash6ResultEP9HashValue:
  107|      1|{
  108|      1|  Result->Type=HashType;
  109|      1|  if (HashType==HASH_RAR14)
  ------------------
  |  Branch (109:7): [True: 0, False: 1]
  ------------------
  110|      0|    Result->CRC32=CurCRC32;
  111|      1|  if (HashType==HASH_CRC32)
  ------------------
  |  Branch (111:7): [True: 0, False: 1]
  ------------------
  112|      0|    Result->CRC32=CurCRC32^0xffffffff;
  113|      1|  if (HashType==HASH_BLAKE2)
  ------------------
  |  Branch (113:7): [True: 0, False: 1]
  ------------------
  114|      0|  {
  115|       |    // Preserve the original context, so we can continue hashing if necessary.
  116|      0|    blake2sp_state res=*blake2ctx;
  117|      0|    blake2sp_final(&res,Result->Digest);
  118|      0|  }
  119|      1|}
_ZN8DataHash3CmpEP9HashValuePh:
  129|      1|{
  130|      1|  HashValue Final;
  131|      1|  Result(&Final);
  132|      1|  if (Key!=NULL)
  ------------------
  |  Branch (132:7): [True: 0, False: 1]
  ------------------
  133|      0|    ConvertHashToMAC(&Final,Key);
  134|      1|  return Final==*CmpValue;
  135|      1|}

_ZN10FileHeader5ResetEm:
    4|      1|{
    5|      1|  SubData.Alloc(SubDataSize);
    6|      1|  BaseBlock::Reset();
    7|      1|  FileHash.Init(HASH_NONE);
    8|      1|  mtime.Reset();
    9|      1|  atime.Reset();
   10|      1|  ctime.Reset();
   11|      1|  SplitBefore=false;
   12|      1|  SplitAfter=false;
   13|       |
   14|      1|  UnknownUnpSize=0;
   15|       |
   16|      1|  SubFlags=0; // Important for RAR 3.0 subhead.
   17|       |  
   18|      1|  CryptMethod=CRYPT_NONE;
   19|      1|  Encrypted=false;
   20|      1|  SaltSet=false;
   21|      1|  UsePswCheck=false;
   22|      1|  UseHashKey=false;
   23|      1|  Lg2Count=0;
   24|       |
   25|      1|  Solid=false;
   26|      1|  Dir=false;
   27|      1|  WinSize=0;
   28|      1|  Inherited=false;
   29|      1|  SubBlock=false;
   30|      1|  CommentInHeader=false;
   31|      1|  Version=false;
   32|      1|  LargeFile=false;
   33|       |
   34|      1|  RedirType=FSREDIR_NONE;
   35|      1|  DirTarget=false;
   36|      1|  UnixOwnerSet=false;
   37|      1|}

_ZN9BaseBlock5ResetEv:
  148|      3|  {
  149|      3|    SkipIfUnknown=false;
  150|      3|  }

_Z7CmpNamePKwS0_i:
   20|      1|{
   21|      1|  bool ForceCase=(CmpMode&MATCH_FORCECASESENSITIVE)!=0;
  ------------------
  |  |   34|      1|#define MATCH_FORCECASESENSITIVE 0x80000000
  ------------------
   22|       |
   23|      1|  CmpMode&=MATCH_MODEMASK;
  ------------------
  |  |   33|      1|#define MATCH_MODEMASK           0x0000ffff
  ------------------
   24|       |
   25|      1|  if (CmpMode!=MATCH_NAMES)
  ------------------
  |  Branch (25:7): [True: 1, False: 0]
  ------------------
   26|      1|  {
   27|      1|    size_t WildLength=wcslen(Wildcard);
   28|      1|    if (CmpMode!=MATCH_EXACT && CmpMode!=MATCH_EXACTPATH && CmpMode!=MATCH_ALLWILD &&
  ------------------
  |  Branch (28:9): [True: 1, False: 0]
  |  Branch (28:33): [True: 1, False: 0]
  |  Branch (28:61): [True: 1, False: 0]
  ------------------
   29|      1|        mwcsnicompc(Wildcard,Name,WildLength,ForceCase)==0)
  ------------------
  |  Branch (29:9): [True: 0, False: 1]
  ------------------
   30|      0|    {
   31|       |      // For all modes except MATCH_NAMES, MATCH_EXACT, MATCH_EXACTPATH, MATCH_ALLWILD,
   32|       |      // "path1" mask must match "path1\path2\filename.ext" and "path1" names.
   33|      0|      wchar NextCh=Name[WildLength];
   34|      0|      if (NextCh==L'\\' || NextCh==L'/' || NextCh==0)
  ------------------
  |  Branch (34:11): [True: 0, False: 0]
  |  Branch (34:28): [True: 0, False: 0]
  |  Branch (34:44): [True: 0, False: 0]
  ------------------
   35|      0|        return(true);
   36|      0|    }
   37|       |
   38|       |    // Nothing more to compare for MATCH_SUBPATHONLY.
   39|      1|    if (CmpMode==MATCH_SUBPATHONLY)
  ------------------
  |  Branch (39:9): [True: 0, False: 1]
  ------------------
   40|      0|      return(false);
   41|       |
   42|      1|    wchar Path1[NM],Path2[NM];
   43|      1|    GetFilePath(Wildcard,Path1,ASIZE(Path1));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   44|      1|    GetFilePath(Name,Path2,ASIZE(Path2));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   45|       |
   46|      1|    if ((CmpMode==MATCH_EXACT || CmpMode==MATCH_EXACTPATH) &&
  ------------------
  |  Branch (46:10): [True: 0, False: 1]
  |  Branch (46:34): [True: 0, False: 1]
  ------------------
   47|      1|        mwcsicompc(Path1,Path2,ForceCase)!=0)
  ------------------
  |  Branch (47:9): [True: 0, False: 0]
  ------------------
   48|      0|      return(false);
   49|      1|    if (CmpMode==MATCH_ALLWILD)
  ------------------
  |  Branch (49:9): [True: 0, False: 1]
  ------------------
   50|      0|      return match(Wildcard,Name,ForceCase);
   51|      1|    if (CmpMode==MATCH_SUBPATH || CmpMode==MATCH_WILDSUBPATH)
  ------------------
  |  Branch (51:9): [True: 0, False: 1]
  |  Branch (51:35): [True: 1, False: 0]
  ------------------
   52|      1|      if (IsWildcard(Path1))
  ------------------
  |  Branch (52:11): [True: 0, False: 1]
  ------------------
   53|      0|        return(match(Wildcard,Name,ForceCase));
   54|      1|      else
   55|      1|        if (CmpMode==MATCH_SUBPATH || IsWildcard(Wildcard))
  ------------------
  |  Branch (55:13): [True: 0, False: 1]
  |  Branch (55:39): [True: 1, False: 0]
  ------------------
   56|      1|        {
   57|      1|          if (*Path1 && mwcsnicompc(Path1,Path2,wcslen(Path1),ForceCase)!=0)
  ------------------
  |  Branch (57:15): [True: 0, False: 1]
  |  Branch (57:25): [True: 0, False: 0]
  ------------------
   58|      0|            return(false);
   59|      1|        }
   60|      0|        else
   61|      0|          if (mwcsicompc(Path1,Path2,ForceCase)!=0)
  ------------------
  |  Branch (61:15): [True: 0, False: 0]
  ------------------
   62|      0|            return(false);
   63|      1|  }
   64|      1|  wchar *Name1=PointToName(Wildcard);
   65|      1|  wchar *Name2=PointToName(Name);
   66|       |
   67|       |  // Always return false for RAR temporary files to exclude them
   68|       |  // from archiving operations.
   69|       |//  if (mwcsnicompc(L"__rar_",Name2,6,false)==0)
   70|       |//    return(false);
   71|       |
   72|      1|  if (CmpMode==MATCH_EXACT)
  ------------------
  |  Branch (72:7): [True: 0, False: 1]
  ------------------
   73|      0|    return(mwcsicompc(Name1,Name2,ForceCase)==0);
   74|       |
   75|      1|  return(match(Name1,Name2,ForceCase));
   76|      1|}
match.cpp:_ZL5matchPKwS0_b:
   80|      1|{
   81|      1|  for (;; ++string)
   82|      1|  {
   83|      1|    wchar stringc=touppercw(*string,ForceCase);
   84|      1|    wchar patternc=touppercw(*pattern++,ForceCase);
   85|      1|    switch (patternc)
   86|      1|    {
   87|      0|      case 0:
  ------------------
  |  Branch (87:7): [True: 0, False: 1]
  ------------------
   88|      0|        return(stringc==0);
   89|      0|      case '?':
  ------------------
  |  Branch (89:7): [True: 0, False: 1]
  ------------------
   90|      0|        if (stringc == 0)
  ------------------
  |  Branch (90:13): [True: 0, False: 0]
  ------------------
   91|      0|          return(false);
   92|      0|        break;
   93|      1|      case '*':
  ------------------
  |  Branch (93:7): [True: 1, False: 0]
  ------------------
   94|      1|        if (*pattern==0)
  ------------------
  |  Branch (94:13): [True: 1, False: 0]
  ------------------
   95|      1|          return(true);
   96|      0|        if (*pattern=='.')
  ------------------
  |  Branch (96:13): [True: 0, False: 0]
  ------------------
   97|      0|        {
   98|      0|          if (pattern[1]=='*' && pattern[2]==0)
  ------------------
  |  Branch (98:15): [True: 0, False: 0]
  |  Branch (98:34): [True: 0, False: 0]
  ------------------
   99|      0|            return(true);
  100|      0|          const wchar *dot=wcschr(string,'.');
  101|      0|          if (pattern[1]==0)
  ------------------
  |  Branch (101:15): [True: 0, False: 0]
  ------------------
  102|      0|            return (dot==NULL || dot[1]==0);
  ------------------
  |  Branch (102:21): [True: 0, False: 0]
  |  Branch (102:34): [True: 0, False: 0]
  ------------------
  103|      0|          if (dot!=NULL)
  ------------------
  |  Branch (103:15): [True: 0, False: 0]
  ------------------
  104|      0|          {
  105|      0|            string=dot;
  106|      0|            if (wcspbrk(pattern,L"*?")==NULL && wcschr(string+1,'.')==NULL)
  ------------------
  |  Branch (106:17): [True: 0, False: 0]
  |  Branch (106:49): [True: 0, False: 0]
  ------------------
  107|      0|              return(mwcsicompc(pattern+1,string+1,ForceCase)==0);
  108|      0|          }
  109|      0|        }
  110|       |
  111|      0|        while (*string)
  ------------------
  |  Branch (111:16): [True: 0, False: 0]
  ------------------
  112|      0|          if (match(pattern,string++,ForceCase))
  ------------------
  |  Branch (112:15): [True: 0, False: 0]
  ------------------
  113|      0|            return(true);
  114|      0|        return(false);
  115|      0|      default:
  ------------------
  |  Branch (115:7): [True: 0, False: 1]
  ------------------
  116|      0|        if (patternc != stringc)
  ------------------
  |  Branch (116:13): [True: 0, False: 0]
  ------------------
  117|      0|        {
  118|       |          // Allow "name." mask match "name" and "name.\" match "name\".
  119|      0|          if (patternc=='.' && (stringc==0 || stringc=='\\' || stringc=='.'))
  ------------------
  |  Branch (119:15): [True: 0, False: 0]
  |  Branch (119:33): [True: 0, False: 0]
  |  Branch (119:47): [True: 0, False: 0]
  |  Branch (119:64): [True: 0, False: 0]
  ------------------
  120|      0|            return(match(pattern,string,ForceCase));
  121|      0|          else
  122|      0|            return(false);
  123|      0|        }
  124|      0|        break;
  125|      1|    }
  126|      1|  }
  127|      1|}
_Z9touppercwjb:
    8|      2|{
    9|      2|  if (ForceCase)
  ------------------
  |  Branch (9:7): [True: 0, False: 2]
  ------------------
   10|      0|    return ch;
   11|      2|#if defined(_UNIX)
   12|      2|  return ch;
   13|       |#else
   14|       |  return toupperw(ch);
   15|       |#endif
   16|      2|}
match.cpp:_ZL11mwcsnicompcPKwS0_mb:
  139|      1|{
  140|      1|  if (ForceCase)
  ------------------
  |  Branch (140:7): [True: 0, False: 1]
  ------------------
  141|      0|    return wcsncmp(Str1,Str2,N);
  142|      1|#if defined(_UNIX)
  143|      1|  return wcsncmp(Str1,Str2,N);
  144|       |#else
  145|       |  return wcsnicomp(Str1,Str2,N);
  146|       |#endif
  147|      1|}

_ZN8ModelPPMC2Ev:
   31|      2|{
   32|      2|  MinContext=NULL;
   33|      2|  MaxContext=NULL;
   34|      2|  MedContext=NULL;
   35|      2|}

_ZN10RAROptionsC2Ev:
    4|      2|{
    5|      2|  Init();
    6|      2|}
_ZN10RAROptionsD2Ev:
   10|      2|{
   11|       |  // It is important for security reasons, so we do not have the unnecessary
   12|       |  // password data left in memory.
   13|      2|  memset(this,0,sizeof(RAROptions));
   14|      2|}
_ZN10RAROptions4InitEv:
   18|      4|{
   19|      4|  memset(this,0,sizeof(RAROptions));
   20|      4|  WinSize=0x2000000;
   21|      4|  Overwrite=OVERWRITE_DEFAULT;
   22|      4|  Method=3;
   23|      4|  MsgStream=MSG_STDOUT;
   24|      4|  ConvertNames=NAMES_ORIGINALCASE;
   25|      4|  xmtime=EXTTIME_MAX;
   26|      4|  FileSizeLess=INT64NDF;
  ------------------
  |  |   30|      4|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  ------------------
  |  |  |  |   19|      4|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
   27|      4|  FileSizeMore=INT64NDF;
  ------------------
  |  |   30|      4|#define INT64NDF INT32TO64(0x7fffffff,0x7fffffff)
  |  |  ------------------
  |  |  |  |   19|      4|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  |  |  ------------------
  ------------------
   28|      4|  HashType=HASH_CRC32;
   29|      4|#ifdef RAR_SMP
   30|      4|  Threads=GetNumberOfThreads();
   31|      4|#endif
   32|      4|#ifdef USE_QOPEN
   33|      4|  QOpenMode=QOPEN_AUTO;
   34|      4|#endif
   35|      4|}

_Z11PointToNamePKw:
    4|      7|{
    5|     27|  for (int I=(int)wcslen(Path)-1;I>=0;I--)
  ------------------
  |  Branch (5:34): [True: 20, False: 7]
  ------------------
    6|     20|    if (IsPathDiv(Path[I]))
  ------------------
  |  Branch (6:9): [True: 0, False: 20]
  ------------------
    7|      0|      return (wchar*)&Path[I+1];
    8|      7|  return (wchar*)((*Path!=0 && IsDriveDiv(Path[1])) ? Path+2:Path);
  ------------------
  |  Branch (8:20): [True: 7, False: 0]
  |  Branch (8:32): [True: 0, False: 7]
  ------------------
    9|      7|}
_Z11ConvertPathPKwPwm:
   20|      2|{
   21|      2|  const wchar *DestPtr=SrcPath;
   22|       |
   23|       |  // Prevent \..\ in any part of path string.
   24|      8|  for (const wchar *s=DestPtr;*s!=0;s++)
  ------------------
  |  Branch (24:31): [True: 6, False: 2]
  ------------------
   25|      6|    if (IsPathDiv(s[0]) && s[1]=='.' && s[2]=='.' && IsPathDiv(s[3]))
  ------------------
  |  Branch (25:9): [True: 0, False: 6]
  |  Branch (25:28): [True: 0, False: 0]
  |  Branch (25:41): [True: 0, False: 0]
  |  Branch (25:54): [True: 0, False: 0]
  ------------------
   26|      0|      DestPtr=s+4;
   27|       |
   28|       |  // Remove any amount of <d>:\ and any sequence of . and \ in the beginning of path string.
   29|      2|  while (*DestPtr!=0)
  ------------------
  |  Branch (29:10): [True: 2, False: 0]
  ------------------
   30|      2|  {
   31|      2|    const wchar *s=DestPtr;
   32|      2|    if (s[0]!=0 && IsDriveDiv(s[1]))
  ------------------
  |  Branch (32:9): [True: 2, False: 0]
  |  Branch (32:20): [True: 0, False: 2]
  ------------------
   33|      0|      s+=2;
   34|      2|    if (s[0]=='\\' && s[1]=='\\')
  ------------------
  |  Branch (34:9): [True: 0, False: 2]
  |  Branch (34:23): [True: 0, False: 0]
  ------------------
   35|      0|    {
   36|      0|      const wchar *Slash=wcschr(s+2,'\\');
   37|      0|      if (Slash!=NULL && (Slash=wcschr(Slash+1,'\\'))!=NULL)
  ------------------
  |  Branch (37:11): [True: 0, False: 0]
  |  Branch (37:26): [True: 0, False: 0]
  ------------------
   38|      0|        s=Slash+1;
   39|      0|    }
   40|      2|    for (const wchar *t=s;*t!=0;t++)
  ------------------
  |  Branch (40:27): [True: 2, False: 0]
  ------------------
   41|      2|      if (IsPathDiv(*t))
  ------------------
  |  Branch (41:11): [True: 0, False: 2]
  ------------------
   42|      0|        s=t+1;
   43|      2|      else
   44|      2|        if (*t!='.')
  ------------------
  |  Branch (44:13): [True: 2, False: 0]
  ------------------
   45|      2|          break;
   46|      2|    if (s==DestPtr)
  ------------------
  |  Branch (46:9): [True: 2, False: 0]
  ------------------
   47|      2|      break;
   48|      0|    DestPtr=s;
   49|      0|  }
   50|       |
   51|       |  // Code above does not remove last "..", doing here.
   52|      2|  if (DestPtr[0]=='.' && DestPtr[1]=='.' && DestPtr[2]==0)
  ------------------
  |  Branch (52:7): [True: 0, False: 2]
  |  Branch (52:26): [True: 0, False: 0]
  |  Branch (52:45): [True: 0, False: 0]
  ------------------
   53|      0|    DestPtr+=2;
   54|       |  
   55|      2|  if (DestPath!=NULL)
  ------------------
  |  Branch (55:7): [True: 1, False: 1]
  ------------------
   56|      1|  {
   57|       |    // SrcPath and DestPath can point to same memory area,
   58|       |    // so we use the temporary buffer for copying.
   59|      1|    wchar TmpStr[NM];
   60|      1|    wcsncpyz(TmpStr,DestPtr,ASIZE(TmpStr));
  ------------------
  |  |   10|      1|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   61|      1|    wcsncpyz(DestPath,TmpStr,DestSize);
   62|      1|  }
   63|      2|  return (wchar *)DestPtr;
   64|      2|}
_Z6GetExtPKw:
  108|      1|{
  109|      1|  return Name==NULL ? NULL:wcsrchr(PointToName(Name),'.');
  ------------------
  |  Branch (109:10): [True: 0, False: 1]
  ------------------
  110|      1|}
_Z6CmpExtPKwS0_:
  115|      1|{
  116|      1|  wchar *NameExt=GetExt(Name);
  117|      1|  return NameExt!=NULL && wcsicomp(NameExt+1,Ext)==0;
  ------------------
  |  Branch (117:10): [True: 1, False: 0]
  |  Branch (117:27): [True: 1, False: 0]
  ------------------
  118|      1|}
_Z10IsWildcardPKw:
  122|      2|{
  123|      2|  if (Str==NULL)
  ------------------
  |  Branch (123:7): [True: 0, False: 2]
  ------------------
  124|      0|    return false;
  125|       |#ifdef _WIN_ALL
  126|       |  // Not treat the special NTFS \\?\d: path prefix as a wildcard.
  127|       |  if (Str[0]=='\\' && Str[1]=='\\' && Str[2]=='?' && Str[3]=='\\')
  128|       |    Str+=4;
  129|       |#endif
  130|      2|  return wcspbrk(Str,L"*?")!=NULL;
  131|      2|}
_Z9IsPathDivi:
  135|     28|{
  136|       |#ifdef _WIN_ALL
  137|       |  return Ch=='\\' || Ch=='/';
  138|       |#else
  139|     28|  return Ch==CPATHDIVIDER;
  ------------------
  |  |  187|     28|#define CPATHDIVIDER '/'
  ------------------
  140|     28|#endif
  141|     28|}
_Z10IsDriveDivi:
  145|      9|{
  146|      9|#ifdef _UNIX
  147|      9|  return false;
  148|       |#else
  149|       |  return Ch==':';
  150|       |#endif
  151|      9|}
_Z11GetFilePathPKwPwm:
  197|      2|{
  198|      2|  if (MaxLength==0)
  ------------------
  |  Branch (198:7): [True: 0, False: 2]
  ------------------
  199|      0|    return;
  200|      2|  size_t PathLength=Min(MaxLength-1,size_t(PointToName(FullName)-FullName));
  ------------------
  |  |    4|      2|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  201|      2|  wcsncpy(Path,FullName,PathLength);
  202|      2|  Path[PathLength]=0;
  203|      2|}

_ZN9QuickOpenC2Ev:
    4|      2|{
    5|      2|  Buf=NULL;
    6|      2|  Init(NULL,false);
    7|      2|}
_ZN9QuickOpenD2Ev:
   11|      2|{
   12|      2|  Close();
   13|      2|  delete[] Buf;
   14|      2|}
_ZN9QuickOpen4InitEP7Archiveb:
   18|      2|{
   19|      2|  if (Arc!=NULL) // Unless called from constructor.
  ------------------
  |  Branch (19:7): [True: 0, False: 2]
  ------------------
   20|      0|    Close();
   21|       |
   22|      2|  QuickOpen::Arc=Arc;
   23|      2|  QuickOpen::WriteMode=WriteMode;
   24|       |
   25|      2|  ListStart=NULL;
   26|      2|  ListEnd=NULL;
   27|       |
   28|      2|  if (Buf==NULL)
  ------------------
  |  Branch (28:7): [True: 2, False: 0]
  ------------------
   29|      2|    Buf=new byte[MaxBufSize];
   30|       |
   31|      2|  CurBufSize=0; // Current size of buffered data in write mode.
   32|       |
   33|      2|  Loaded=false;
   34|      2|}
_ZN9QuickOpen5CloseEv:
   38|      2|{
   39|      2|  QuickOpenItem *Item=ListStart;
   40|      2|  while (Item!=NULL)
  ------------------
  |  Branch (40:10): [True: 0, False: 2]
  ------------------
   41|      0|  {
   42|      0|    QuickOpenItem *Next=Item->Next;
   43|      0|    delete[] Item->Header;
   44|      0|    delete Item;
   45|      0|    Item=Next;
   46|      0|  }
   47|      2|}
_ZN9QuickOpen4ReadEPvmRm:
  125|      9|{
  126|      9|  if (!Loaded)
  ------------------
  |  Branch (126:7): [True: 9, False: 0]
  ------------------
  127|      9|    return false;
  128|       |  // Find next suitable cached block.
  129|      0|  while (LastReadHeaderPos+LastReadHeader.Size()<=SeekPos)
  ------------------
  |  Branch (129:10): [True: 0, False: 0]
  ------------------
  130|      0|    if (!ReadNext())
  ------------------
  |  Branch (130:9): [True: 0, False: 0]
  ------------------
  131|      0|      break;
  132|      0|  if (!Loaded)
  ------------------
  |  Branch (132:7): [True: 0, False: 0]
  ------------------
  133|      0|  {
  134|       |    // If something wrong happened, let's set the correct file pointer
  135|       |    // and stop further quick open processing.
  136|      0|    if (UnsyncSeekPos)
  ------------------
  |  Branch (136:9): [True: 0, False: 0]
  ------------------
  137|      0|      Arc->File::Seek(SeekPos,SEEK_SET);
  138|      0|    return false;
  139|      0|  }
  140|       |
  141|      0|  if (SeekPos>=LastReadHeaderPos && SeekPos+Size<=LastReadHeaderPos+LastReadHeader.Size())
  ------------------
  |  Branch (141:7): [True: 0, False: 0]
  |  Branch (141:37): [True: 0, False: 0]
  ------------------
  142|      0|  {
  143|      0|    memcpy(Data,LastReadHeader+size_t(SeekPos-LastReadHeaderPos),Size);
  144|      0|    Result=Size;
  145|      0|    SeekPos+=Size;
  146|      0|    UnsyncSeekPos=true;
  147|      0|  }
  148|      0|  else
  149|      0|  {
  150|      0|    if (UnsyncSeekPos)
  ------------------
  |  Branch (150:9): [True: 0, False: 0]
  ------------------
  151|      0|    {
  152|      0|      Arc->File::Seek(SeekPos,SEEK_SET);
  153|      0|      UnsyncSeekPos=false;
  154|      0|    }
  155|      0|    int ReadSize=Arc->File::Read(Data,Size);
  156|      0|    if (ReadSize<0)
  ------------------
  |  Branch (156:9): [True: 0, False: 0]
  ------------------
  157|      0|    {
  158|      0|      Loaded=false;
  159|      0|      return false;
  160|      0|    }
  161|      0|    Result=ReadSize;
  162|      0|    SeekPos+=ReadSize;
  163|      0|  }
  164|       |  
  165|      0|  return true;
  166|      0|}
_ZN9QuickOpen4SeekEli:
  170|      7|{
  171|      7|  if (!Loaded)
  ------------------
  |  Branch (171:7): [True: 7, False: 0]
  ------------------
  172|      7|    return false;
  173|       |
  174|       |  // Normally we process an archive sequentially from beginning to end,
  175|       |  // so we read quick open data sequentially. But some operations like
  176|       |  // archive updating involve several passes. So if we detect that file
  177|       |  // pointer is moved back, we reload quick open data from beginning.
  178|      0|  if (Method==SEEK_SET && (uint64)Offset<SeekPos && (uint64)Offset<LastReadHeaderPos)
  ------------------
  |  Branch (178:7): [True: 0, False: 0]
  |  Branch (178:27): [True: 0, False: 0]
  |  Branch (178:53): [True: 0, False: 0]
  ------------------
  179|      0|    Load(QOHeaderPos);
  180|       |
  181|      0|  if (Method==SEEK_SET)
  ------------------
  |  Branch (181:7): [True: 0, False: 0]
  ------------------
  182|      0|    SeekPos=Offset;
  183|      0|  if (Method==SEEK_CUR)
  ------------------
  |  Branch (183:7): [True: 0, False: 0]
  ------------------
  184|      0|    SeekPos+=Offset;
  185|      0|  UnsyncSeekPos=true;
  186|       |
  187|      0|  if (Method==SEEK_END)
  ------------------
  |  Branch (187:7): [True: 0, False: 0]
  ------------------
  188|      0|  {
  189|      0|    Arc->File::Seek(Offset,SEEK_END);
  190|      0|    SeekPos=Arc->File::Tell();
  191|      0|    UnsyncSeekPos=false;
  192|      0|  }
  193|      0|  return true;
  194|      7|}
_ZN9QuickOpen4TellEPl:
  198|      8|{
  199|      8|  if (!Loaded)
  ------------------
  |  Branch (199:7): [True: 8, False: 0]
  ------------------
  200|      8|    return false;
  201|      0|  *Pos=SeekPos;
  202|      0|  return true;
  203|      8|}

_ZN9QuickOpen6UnloadEv:
   55|      2|    void Unload() { Loaded=false; }

_ZN5RarVMC2Ev:
    4|      2|{
    5|      2|  Mem=NULL;
    6|      2|}
_ZN5RarVMD2Ev:
   10|      2|{
   11|      2|  delete[] Mem;
   12|      2|}

_ZN7RawReadC2EP4File:
   11|      3|{
   12|      3|  RawRead::SrcFile=SrcFile;
   13|      3|  Reset();
   14|      3|}
_ZN7RawRead5ResetEv:
   18|      3|{
   19|      3|  Data.SoftReset();
   20|      3|  ReadPos=0;
   21|      3|  DataSize=0;
   22|      3|  Crypt=NULL;
   23|      3|}
_ZN7RawRead4ReadEm:
   27|      4|{
   28|      4|  size_t ReadSize=0;
   29|      4|#if !defined(RAR_NOCRYPT)
   30|      4|  if (Crypt!=NULL)
  ------------------
  |  Branch (30:7): [True: 0, False: 4]
  ------------------
   31|      0|  {
   32|       |    // Full size of buffer with already read data including data read 
   33|       |    // for encryption block alignment.
   34|      0|    size_t FullSize=Data.Size();
   35|       |
   36|       |    // Data read for alignment and not processed yet.
   37|      0|    size_t DataLeft=FullSize-DataSize;
   38|       |
   39|      0|    if (Size>DataLeft) // Need to read more than we already have.
  ------------------
  |  Branch (39:9): [True: 0, False: 0]
  ------------------
   40|      0|    {
   41|      0|      size_t SizeToRead=Size-DataLeft;
   42|      0|      size_t AlignedReadSize=SizeToRead+((~SizeToRead+1) & CRYPT_BLOCK_MASK);
  ------------------
  |  |   16|      0|#define CRYPT_BLOCK_MASK         (CRYPT_BLOCK_SIZE-1) // 0xf
  |  |  ------------------
  |  |  |  |   15|      0|#define CRYPT_BLOCK_SIZE         16
  |  |  ------------------
  ------------------
   43|      0|      Data.Add(AlignedReadSize);
   44|      0|      ReadSize=SrcFile->Read(&Data[FullSize],AlignedReadSize);
   45|      0|      Crypt->DecryptBlock(&Data[FullSize],AlignedReadSize);
   46|      0|      DataSize+=ReadSize==0 ? 0:Size;
  ------------------
  |  Branch (46:17): [True: 0, False: 0]
  ------------------
   47|      0|    }
   48|      0|    else // Use buffered data, no real read.
   49|      0|    {
   50|      0|      ReadSize=Size;
   51|      0|      DataSize+=Size;
   52|      0|    }
   53|      0|  }
   54|      4|  else
   55|      4|#endif
   56|      4|    if (Size!=0)
  ------------------
  |  Branch (56:9): [True: 4, False: 0]
  ------------------
   57|      4|    {
   58|      4|      Data.Add(Size);
   59|      4|      ReadSize=SrcFile->Read(&Data[DataSize],Size);
   60|      4|      DataSize+=ReadSize;
   61|      4|    }
   62|      4|  return ReadSize;
   63|      4|}
_ZN7RawRead4Get4Ev:
   96|      2|{
   97|      2|  if (ReadPos+3<DataSize)
  ------------------
  |  Branch (97:7): [True: 2, False: 0]
  ------------------
   98|      2|  {
   99|      2|    uint Result=Data[ReadPos]+(Data[ReadPos+1]<<8)+(Data[ReadPos+2]<<16)+
  100|      2|                (Data[ReadPos+3]<<24);
  101|      2|    ReadPos+=4;
  102|      2|    return Result;
  103|      2|  }
  104|      0|  return 0;
  105|      2|}
_ZN7RawRead4GetVEv:
  116|     18|{
  117|     18|  uint64 Result=0;
  118|       |  // Need to check Shift<64, because for shift greater than or equal to
  119|       |  // the width of the promoted left operand, the behavior is undefined.
  120|     30|  for (uint Shift=0;ReadPos<DataSize && Shift<64;Shift+=7)
  ------------------
  |  Branch (120:21): [True: 29, False: 1]
  |  Branch (120:41): [True: 29, False: 0]
  ------------------
  121|     29|  {
  122|     29|    byte CurByte=Data[ReadPos++];
  123|     29|    Result+=uint64(CurByte & 0x7f)<<Shift;
  124|     29|    if ((CurByte & 0x80)==0)
  ------------------
  |  Branch (124:9): [True: 17, False: 12]
  ------------------
  125|     17|      return Result; // Decoded successfully.
  126|     29|  }
  127|      1|  return 0; // Out of buffer border.
  128|     18|}
_ZN7RawRead8GetVSizeEm:
  133|      2|{
  134|      5|  for (size_t CurPos=Pos;CurPos<DataSize;CurPos++)
  ------------------
  |  Branch (134:26): [True: 4, False: 1]
  ------------------
  135|      4|    if ((Data[CurPos] & 0x80)==0)
  ------------------
  |  Branch (135:9): [True: 1, False: 3]
  ------------------
  136|      1|      return int(CurPos-Pos+1);
  137|      1|  return 0; // Buffer overflow.
  138|      2|}
_ZN7RawRead4GetBEPvm:
  142|      2|{
  143|      2|  byte *F=(byte *)Field;
  144|      2|  size_t CopySize=Min(DataSize-ReadPos,Size);
  ------------------
  |  |    4|      2|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  145|      2|  if (CopySize>0)
  ------------------
  |  Branch (145:7): [True: 1, False: 1]
  ------------------
  146|      1|    memcpy(F,&Data[ReadPos],CopySize);
  147|      2|  if (Size>CopySize)
  ------------------
  |  Branch (147:7): [True: 0, False: 2]
  ------------------
  148|      0|    memset(F+CopySize,0,Size-CopySize);
  149|      2|  ReadPos+=CopySize;
  150|      2|  return CopySize;
  151|      2|}
_ZN7RawRead8GetCRC50Ev:
  176|      1|{
  177|      1|  if (DataSize<=4)
  ------------------
  |  Branch (177:7): [True: 0, False: 1]
  ------------------
  178|      0|    return 0xffffffff;
  179|      1|  return CRC32(0xffffffff,&Data[4],DataSize-4) ^ 0xffffffff;
  180|      1|}

_ZN7RawRead4SizeEv:
   29|      3|    size_t Size() {return DataSize;}
_ZN7RawRead8DataLeftEv:
   31|      4|    size_t DataLeft() {return DataSize-ReadPos;}
_ZN7RawRead6GetPosEv:
   32|      3|    size_t GetPos() {return ReadPos;}
_ZN7RawRead6SetPosEm:
   33|      2|    void SetPos(size_t Pos) {ReadPos=Pos;}

_ZN11ComprDataIOC2Ev:
    4|      4|{
    5|      4|#ifndef RAR_NOCRYPT
    6|      4|  Crypt=new CryptData;
    7|      4|  Decrypt=new CryptData;
    8|      4|#endif
    9|       |
   10|      4|  Init();
   11|      4|}
_ZN11ComprDataIO4InitEv:
   15|      4|{
   16|      4|  UnpackFromMemory=false;
   17|      4|  UnpackToMemory=false;
   18|      4|  UnpPackedSize=0;
   19|      4|  UnpPackedLeft=0;
   20|      4|  ShowProgress=true;
   21|      4|  TestMode=false;
   22|      4|  SkipUnpCRC=false;
   23|      4|  NoFileHeader=false;
   24|      4|  PackVolume=false;
   25|      4|  UnpVolume=false;
   26|      4|  NextVolumeMissing=false;
   27|      4|  SrcFile=NULL;
   28|      4|  DestFile=NULL;
   29|      4|  UnpWrAddr=NULL;
   30|      4|  UnpWrSize=0;
   31|      4|  Command=NULL;
   32|      4|  Encryption=false;
   33|      4|  Decryption=false;
   34|      4|  CurPackRead=CurPackWrite=CurUnpRead=CurUnpWrite=0;
   35|      4|  LastPercent=-1;
   36|      4|  SubHead=NULL;
   37|      4|  SubHeadPos=NULL;
   38|      4|  CurrentCommand=0;
   39|      4|  ProcessedArcSize=0;
   40|      4|  LastArcSize=0;
   41|      4|  TotalArcSize=0;
   42|      4|}
_ZN11ComprDataIOD2Ev:
   46|      4|{
   47|      4|#ifndef RAR_NOCRYPT
   48|      4|  delete Crypt;
   49|      4|  delete Decrypt;
   50|      4|#endif
   51|      4|}
_ZN11ComprDataIO8SetFilesEP4FileS1_:
  233|      1|{
  234|      1|  if (SrcFile!=NULL)
  ------------------
  |  Branch (234:7): [True: 1, False: 0]
  ------------------
  235|      1|    ComprDataIO::SrcFile=SrcFile;
  236|      1|  if (DestFile!=NULL)
  ------------------
  |  Branch (236:7): [True: 1, False: 0]
  ------------------
  237|      1|    ComprDataIO::DestFile=DestFile;
  238|      1|  LastPercent=-1;
  239|      1|}
_ZN11ComprDataIO13SetEncryptionEb12CRYPT_METHODP11SecPasswordPKhS4_jPhS5_:
  252|      1|{
  253|      1|#ifndef RAR_NOCRYPT
  254|      1|  if (Encrypt)
  ------------------
  |  Branch (254:7): [True: 0, False: 1]
  ------------------
  255|      0|    Encryption=Crypt->SetCryptKeys(true,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck);
  256|      1|  else
  257|      1|    Decryption=Decrypt->SetCryptKeys(false,Method,Password,Salt,InitV,Lg2Cnt,HashKey,PswCheck);
  258|      1|#endif
  259|      1|}
_ZN11ComprDataIO18AdjustTotalArcSizeEP7Archive:
  297|      1|{
  298|       |  // If we know a position of QO or RR blocks, use them to adjust the total
  299|       |  // packed size to beginning of these blocks. Earlier we already calculated
  300|       |  // the total size based on entire archive sizes. We also set LastArcSize
  301|       |  // to start of first trailing block, to add it later to ProcessedArcSize.
  302|      1|  int64 ArcLength=Arc->IsSeekable() ? Arc->FileLength() : 0;
  ------------------
  |  Branch (302:19): [True: 1, False: 0]
  ------------------
  303|      1|  if (Arc->MainHead.QOpenOffset!=0) // QO is always preceding RR record.
  ------------------
  |  Branch (303:7): [True: 0, False: 1]
  ------------------
  304|      0|    LastArcSize=Arc->MainHead.QOpenOffset;
  305|      1|  else
  306|      1|    if (Arc->MainHead.RROffset!=0)
  ------------------
  |  Branch (306:9): [True: 0, False: 1]
  ------------------
  307|      0|      LastArcSize=Arc->MainHead.RROffset;
  308|      1|    else
  309|      1|    {
  310|       |      // If neither QO nor RR are found, exclude the approximate size of
  311|       |      // end of archive block.
  312|       |      // We select EndBlock to be larger than typical 8 bytes HEAD_ENDARC,
  313|       |      // but to not exceed the smallest 22 bytes HEAD_FILE with 1 byte file
  314|       |      // name, so we do not have two files with 100% at the end of archive.
  315|      1|      const uint EndBlock=23;
  316|       |
  317|      1|      if (ArcLength>EndBlock)
  ------------------
  |  Branch (317:11): [True: 1, False: 0]
  ------------------
  318|      1|        LastArcSize=ArcLength-EndBlock;
  319|      1|    }
  320|       |
  321|      1|  TotalArcSize-=ArcLength-LastArcSize;
  322|      1|}

_ZN11ComprDataIO19SetPackedSizeToReadEl:
   66|      1|    void SetPackedSizeToRead(int64 Size) {UnpPackedSize=UnpPackedLeft=Size;}
_ZN11ComprDataIO11SetTestModeEb:
   67|      1|    void SetTestMode(bool Mode) {TestMode=Mode;}
_ZN11ComprDataIO13SetSkipUnpCRCEb:
   68|      1|    void SetSkipUnpCRC(bool Skip) {SkipUnpCRC=Skip;}
_ZN11ComprDataIO17SetCurrentCommandEw:
   78|      2|    void SetCurrentCommand(wchar Cmd) {CurrentCommand=Cmd;}

_ZN8RijndaelC2Ev:
   84|     12|{
   85|     12|  if (S5[0]==0)
  ------------------
  |  Branch (85:7): [True: 1, False: 11]
  ------------------
   86|      1|    GenerateTables();
   87|     12|  CBCMode = true; // Always true for RAR.
   88|     12|}
_ZN8Rijndael14GenerateTablesEv:
  456|      1|{
  457|    257|  for (int I=0;I<256;I++)
  ------------------
  |  Branch (457:16): [True: 256, False: 1]
  ------------------
  458|    256|    S5[S[I]]=I;
  459|       |
  460|    257|  for (int I=0;I<256;I++)
  ------------------
  |  Branch (460:16): [True: 256, False: 1]
  ------------------
  461|    256|  {   
  462|    256|    byte s=S[I];
  463|    256|    T1[I][1]=T1[I][2]=T2[I][2]=T2[I][3]=T3[I][0]=T3[I][3]=T4[I][0]=T4[I][1]=s;
  464|    256|    T1[I][0]=T2[I][1]=T3[I][2]=T4[I][3]=gmul(s,2);
  465|    256|    T1[I][3]=T2[I][0]=T3[I][1]=T4[I][2]=gmul(s,3);
  466|       |
  467|    256|    byte b=S5[I];
  468|    256|    U1[b][3]=U2[b][0]=U3[b][1]=U4[b][2]=T5[I][3]=T6[I][0]=T7[I][1]=T8[I][2]=gmul(b,0xb);
  469|    256|    U1[b][1]=U2[b][2]=U3[b][3]=U4[b][0]=T5[I][1]=T6[I][2]=T7[I][3]=T8[I][0]=gmul(b,0x9);
  470|    256|    U1[b][2]=U2[b][3]=U3[b][0]=U4[b][1]=T5[I][2]=T6[I][3]=T7[I][0]=T8[I][1]=gmul(b,0xd);
  471|    256|    U1[b][0]=U2[b][1]=U3[b][2]=U4[b][3]=T5[I][0]=T6[I][1]=T7[I][2]=T8[I][3]=gmul(b,0xe);
  472|    256|  }
  473|      1|}
rijndael.cpp:_ZL4gmulhh:
  439|  1.53k|{
  440|  1.53k|  const byte poly=0x1b; // Lower byte of AES 0x11b irreducible polynomial.
  441|  1.53k|  byte result = 0;
  442|  6.65k|  while (b>0)
  ------------------
  |  Branch (442:10): [True: 5.12k, False: 1.53k]
  ------------------
  443|  5.12k|  {
  444|  5.12k|    if ((b & 1) != 0) 
  ------------------
  |  Branch (444:9): [True: 3.58k, False: 1.53k]
  ------------------
  445|  3.58k|      result ^= a;
  446|  5.12k|    a = (a & 0x80) ? (a<<1)^poly : a<<1;
  ------------------
  |  Branch (446:9): [True: 2.56k, False: 2.56k]
  ------------------
  447|  5.12k|    b >>= 1;
  448|  5.12k|  }
  449|  1.53k|  return result;
  450|  1.53k|}

_ZN11SecPasswordC2Ev:
   58|     98|{
   59|     98|  CrossProcess=false;
   60|     98|  Set(L"");
   61|     98|}
_ZN11SecPasswordD2Ev:
   65|     99|{
   66|     99|  Clean();
   67|     99|}
_ZN11SecPassword5CleanEv:
   71|     99|{
   72|     99|  PasswordSet=false;
   73|     99|  cleandata(Password,sizeof(Password));
   74|     99|}
_Z9cleandataPvm:
   81|    137|{
   82|    137|  if (data==NULL || size==0)
  ------------------
  |  Branch (82:7): [True: 0, False: 137]
  |  Branch (82:21): [True: 0, False: 137]
  ------------------
   83|      0|    return;
   84|       |#if defined(_WIN_ALL) && defined(_MSC_VER)
   85|       |  SecureZeroMemory(data,size);
   86|       |#else
   87|       |  // 'volatile' is required. Otherwise optimizers can remove this function
   88|       |  // if cleaning local variables, which are not used after that.
   89|    137|  volatile byte *d = (volatile byte *)data;
   90|   114k|  for (size_t i=0;i<size;i++)
  ------------------
  |  Branch (90:19): [True: 114k, False: 137]
  ------------------
   91|   114k|    d[i]=0;
   92|    137|#endif
   93|    137|}
_ZN11SecPassword3SetEPKw:
  126|     98|{
  127|     98|  if (*Psw==0)
  ------------------
  |  Branch (127:7): [True: 98, False: 0]
  ------------------
  128|     98|  {
  129|     98|    PasswordSet=false;
  130|     98|    memset(Password,0,sizeof(Password));
  131|     98|  }
  132|      0|  else
  133|      0|  {
  134|      0|    PasswordSet=true;
  135|      0|    Process(Psw,wcslen(Psw)+1,Password,ASIZE(Password),true);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  136|      0|  }
  137|     98|}

_ZN11SecPassword5IsSetEv:
   22|      2|    bool IsSet() {return PasswordSet;}

_Z9wcsicompcPKwS0_:
  243|      1|{
  244|      1|#if defined(_UNIX)
  245|      1|  return wcscmp(s1,s2);
  246|       |#else
  247|       |  return wcsicomp(s1,s2);
  248|       |#endif
  249|      1|}
_Z8wcsncpyzPwPKwm:
  276|     16|{
  277|     16|  if (maxlen>0)
  ------------------
  |  Branch (277:7): [True: 16, False: 0]
  ------------------
  278|     16|  {
  279|    100|    while (--maxlen>0 && *src!=0)
  ------------------
  |  Branch (279:12): [True: 100, False: 0]
  |  Branch (279:26): [True: 84, False: 16]
  ------------------
  280|     84|      *dest++=*src++;
  281|     16|    *dest=0;
  282|     16|  }
  283|     16|}
_Z8wcsncatzPwPKwm:
  301|      1|{
  302|      1|  size_t length = wcslen(dest);
  303|      1|  if (maxlen > length)
  ------------------
  |  Branch (303:7): [True: 1, False: 0]
  ------------------
  304|      1|    wcsncpyz(dest + length, src, maxlen - length);
  305|      1|}

_ZN10StringListC2Ev:
    4|     10|{
    5|     10|  Reset();
    6|     10|}
_ZN10StringList5ResetEv:
   10|     20|{
   11|     20|  Rewind();
   12|     20|  StringData.Reset();
   13|     20|  StringsCount=0;
   14|     20|  SavePosNumber=0;
   15|     20|}
_ZN10StringList9AddStringEPKw:
   27|      4|{
   28|      4|  if (Str==NULL)
  ------------------
  |  Branch (28:7): [True: 0, False: 4]
  ------------------
   29|      0|    Str=L"";
   30|       |
   31|      4|  size_t PrevSize=StringData.Size();
   32|      4|  StringData.Add(wcslen(Str)+1);
   33|      4|  wcscpy(&StringData[PrevSize],Str);
   34|       |
   35|      4|  StringsCount++;
   36|      4|}
_ZN10StringList9GetStringEPwm:
   50|      9|{
   51|      9|  wchar *StrPtr;
   52|      9|  if (!GetString(&StrPtr))
  ------------------
  |  Branch (52:7): [True: 5, False: 4]
  ------------------
   53|      5|    return false;
   54|      4|  wcsncpyz(Str,StrPtr,MaxLength);
   55|      4|  return true;
   56|      9|}
_ZN10StringList9GetStringEv:
   78|      1|{
   79|      1|  wchar *Str;
   80|      1|  GetString(&Str);
   81|      1|  return Str;
   82|      1|}
_ZN10StringList9GetStringEPPw:
   86|     10|{
   87|     10|  if (CurPos>=StringData.Size()) // No more strings left unprocessed.
  ------------------
  |  Branch (87:7): [True: 5, False: 5]
  ------------------
   88|      5|  {
   89|      5|    if (Str!=NULL)
  ------------------
  |  Branch (89:9): [True: 5, False: 0]
  ------------------
   90|      5|      *Str=NULL;
   91|      5|    return false;
   92|      5|  }
   93|       |
   94|      5|  wchar *CurStr=&StringData[CurPos];
   95|      5|  CurPos+=wcslen(CurStr)+1;
   96|      5|  if (Str!=NULL)
  ------------------
  |  Branch (96:7): [True: 5, False: 0]
  ------------------
   97|      5|    *Str=CurStr;
   98|       |
   99|      5|  return true;
  100|     10|}
_ZN10StringList6RewindEv:
  104|     24|{
  105|     24|  CurPos=0;
  106|     24|}

_ZN10StringList10ItemsCountEv:
   24|      4|    size_t ItemsCount() {return StringsCount;};

_ZN12SubAllocatorC2Ev:
   12|      2|{
   13|      2|  Clean();
   14|      2|}
_ZN12SubAllocator5CleanEv:
   18|      2|{
   19|      2|  SubAllocatorSize=0;
   20|      2|}
_ZN12SubAllocator16StopSubAllocatorEv:
   70|      2|{
   71|      2|  if ( SubAllocatorSize ) 
  ------------------
  |  Branch (71:8): [True: 0, False: 2]
  ------------------
   72|      0|  {
   73|      0|    SubAllocatorSize=0;
   74|      0|    free(HeapStart);
   75|      0|  }
   76|      2|}

_ZN12SubAllocatorD2Ev:
   70|      2|    ~SubAllocator() {StopSubAllocator();}

_Z14GetNumberOfCPUv:
  112|      4|{
  113|       |#ifndef RAR_SMP
  114|       |  return 1;
  115|       |#else
  116|      4|#ifdef _UNIX
  117|      4|#ifdef _SC_NPROCESSORS_ONLN
  118|      4|  uint Count=(uint)sysconf(_SC_NPROCESSORS_ONLN);
  119|      4|  return Count<1 ? 1:Count;
  ------------------
  |  Branch (119:10): [True: 0, False: 4]
  ------------------
  120|       |#elif defined(_APPLE)
  121|       |  uint Count;
  122|       |  size_t Size=sizeof(Count);
  123|       |  return sysctlbyname("hw.ncpu",&Count,&Size,NULL,0)==0 ? Count:1;
  124|       |#endif
  125|       |#else // !_UNIX
  126|       |  DWORD_PTR ProcessMask;
  127|       |  DWORD_PTR SystemMask;
  128|       |
  129|       |  if (!GetProcessAffinityMask(GetCurrentProcess(),&ProcessMask,&SystemMask))
  130|       |    return 1;
  131|       |  uint Count=0;
  132|       |  for (DWORD_PTR Mask=1;Mask!=0;Mask<<=1)
  133|       |    if ((ProcessMask & Mask)!=0)
  134|       |      Count++;
  135|       |  return Count<1 ? 1:Count;
  136|       |#endif
  137|       |
  138|      4|#endif // RAR_SMP
  139|      4|}
_Z18GetNumberOfThreadsv:
  143|      4|{
  144|      4|  uint NumCPU=GetNumberOfCPU();
  145|      4|  if (NumCPU<1)
  ------------------
  |  Branch (145:7): [True: 0, False: 4]
  ------------------
  146|      0|    return 1;
  147|      4|  if (NumCPU>MaxPoolThreads)
  ------------------
  |  Branch (147:7): [True: 0, False: 4]
  ------------------
  148|      0|    return MaxPoolThreads;
  149|      4|  return NumCPU;
  150|      4|}
threadpool.cpp:_ZL21CriticalSectionCreateP15pthread_mutex_t:
    2|      2|{
    3|       |#ifdef _WIN_ALL
    4|       |  InitializeCriticalSection(CritSection);
    5|       |  return true;
    6|       |#elif defined(_UNIX)
    7|      2|  return pthread_mutex_init(CritSection,NULL)==0;
    8|      2|#endif
    9|      2|}
threadpool.cpp:_ZL21CriticalSectionDeleteP15pthread_mutex_t:
   13|      2|{
   14|       |#ifdef _WIN_ALL
   15|       |  DeleteCriticalSection(CritSection);
   16|       |#elif defined(_UNIX)
   17|      2|  pthread_mutex_destroy(CritSection);
   18|      2|#endif
   19|      2|}

_ZN10ThreadPoolC2Ej:
   11|      2|{
   12|      2|  MaxAllowedThreads = MaxThreads;
   13|      2|  if (MaxAllowedThreads>MaxPoolThreads)
  ------------------
  |  Branch (13:7): [True: 0, False: 2]
  ------------------
   14|      0|    MaxAllowedThreads=MaxPoolThreads;
   15|      2|  if (MaxAllowedThreads==0)
  ------------------
  |  Branch (15:7): [True: 0, False: 2]
  ------------------
   16|      0|    MaxAllowedThreads=1;
   17|       |
   18|      2|  ThreadsCreatedCount=0;
   19|       |
   20|       |  // If we have more threads than queue size, we'll hang on pool destroying,
   21|       |  // not releasing all waiting threads.
   22|      2|  if (MaxAllowedThreads>ASIZE(TaskQueue))
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (22:7): [True: 0, False: 2]
  ------------------
   23|      0|    MaxAllowedThreads=ASIZE(TaskQueue);
  ------------------
  |  |   10|      0|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   24|       |
   25|      2|  Closing=false;
   26|       |
   27|      2|  bool Success = CriticalSectionCreate(&CritSection);
   28|       |#ifdef _WIN_ALL
   29|       |  QueuedTasksCnt=CreateSemaphore(NULL,0,ASIZE(TaskQueue),NULL);
   30|       |  NoneActive=CreateEvent(NULL,TRUE,TRUE,NULL);
   31|       |  Success=Success && QueuedTasksCnt!=NULL && NoneActive!=NULL;
   32|       |#elif defined(_UNIX)
   33|      2|  AnyActive = false;
   34|      2|  QueuedTasksCnt = 0;
   35|      2|  Success=Success && pthread_cond_init(&AnyActiveCond,NULL)==0 &&
  ------------------
  |  Branch (35:11): [True: 2, False: 0]
  |  Branch (35:22): [True: 2, False: 0]
  ------------------
   36|      2|          pthread_mutex_init(&AnyActiveMutex,NULL)==0 &&
  ------------------
  |  Branch (36:11): [True: 2, False: 0]
  ------------------
   37|      2|          pthread_cond_init(&QueuedTasksCntCond,NULL)==0 &&
  ------------------
  |  Branch (37:11): [True: 2, False: 0]
  ------------------
   38|      2|          pthread_mutex_init(&QueuedTasksCntMutex,NULL)==0;
  ------------------
  |  Branch (38:11): [True: 2, False: 0]
  ------------------
   39|      2|#endif
   40|      2|  if (!Success)
  ------------------
  |  Branch (40:7): [True: 0, False: 2]
  ------------------
   41|      0|  {
   42|      0|    ErrHandler.GeneralErrMsg(L"\nThread pool initialization failed.");
   43|      0|    ErrHandler.Exit(RARX_FATAL);
   44|      0|  }
   45|       |
   46|      2|  QueueTop = 0;
   47|      2|  QueueBottom = 0;
   48|      2|  ActiveThreads = 0;
   49|      2|}
_ZN10ThreadPoolD2Ev:
   53|      2|{
   54|      2|  WaitDone();
   55|      2|  Closing=true;
   56|       |
   57|       |#ifdef _WIN_ALL
   58|       |  ReleaseSemaphore(QueuedTasksCnt,ASIZE(TaskQueue),NULL);
   59|       |#elif defined(_UNIX)
   60|       |  // Threads still can access QueuedTasksCnt for a short time after WaitDone(),
   61|       |  // so lock is required. We would occassionally hang without it.
   62|      2|  pthread_mutex_lock(&QueuedTasksCntMutex);
   63|      2|  QueuedTasksCnt+=ASIZE(TaskQueue);
  ------------------
  |  |   10|      2|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
   64|      2|  pthread_mutex_unlock(&QueuedTasksCntMutex);
   65|       |
   66|      2|  pthread_cond_broadcast(&QueuedTasksCntCond);
   67|      2|#endif
   68|       |
   69|      2|  for(uint I=0;I<ThreadsCreatedCount;I++)
  ------------------
  |  Branch (69:16): [True: 0, False: 2]
  ------------------
   70|      0|  {
   71|       |#ifdef _WIN_ALL
   72|       |    // Waiting until the thread terminates.
   73|       |    CWaitForSingleObject(ThreadHandles[I]);
   74|       |#endif
   75|       |    // Close the thread handle. In Unix it results in pthread_join call,
   76|       |    // which also waits for thread termination.
   77|      0|    ThreadClose(ThreadHandles[I]);
   78|      0|  }
   79|       |
   80|      2|  CriticalSectionDelete(&CritSection);
   81|       |#ifdef _WIN_ALL
   82|       |  CloseHandle(QueuedTasksCnt);
   83|       |  CloseHandle(NoneActive);
   84|       |#elif defined(_UNIX)
   85|      2|  pthread_cond_destroy(&AnyActiveCond);
   86|      2|  pthread_mutex_destroy(&AnyActiveMutex);
   87|      2|  pthread_cond_destroy(&QueuedTasksCntCond);
   88|      2|  pthread_mutex_destroy(&QueuedTasksCntMutex);
   89|      2|#endif
   90|      2|}
_ZN10ThreadPool8WaitDoneEv:
  187|      2|{
  188|      2|  if (ActiveThreads==0)
  ------------------
  |  Branch (188:7): [True: 2, False: 0]
  ------------------
  189|      2|    return;
  190|       |#ifdef _WIN_ALL
  191|       |  ResetEvent(NoneActive);
  192|       |  ReleaseSemaphore(QueuedTasksCnt,ActiveThreads,NULL);
  193|       |  CWaitForSingleObject(NoneActive);
  194|       |#elif defined(_UNIX)
  195|      0|  AnyActive=true;
  196|       |
  197|       |  // Threads reset AnyActive before accessing QueuedTasksCnt and even
  198|       |  // preceding WaitDone() call does not guarantee that some slow thread
  199|       |  // is not accessing QueuedTasksCnt now. So lock is necessary.
  200|      0|  pthread_mutex_lock(&QueuedTasksCntMutex);
  201|      0|  QueuedTasksCnt+=ActiveThreads;
  202|      0|  pthread_mutex_unlock(&QueuedTasksCntMutex);
  203|       |
  204|      0|  pthread_cond_broadcast(&QueuedTasksCntCond);
  205|       |
  206|      0|  pthread_mutex_lock(&AnyActiveMutex);
  207|      0|  while (AnyActive)
  ------------------
  |  Branch (207:10): [True: 0, False: 0]
  ------------------
  208|      0|    cpthread_cond_wait(&AnyActiveCond,&AnyActiveMutex);
  209|      0|  pthread_mutex_unlock(&AnyActiveMutex);
  210|      0|#endif
  211|      0|}

_ZN7RarTime7SetUnixEl:
  171|      1|{
  172|      1|  if (sizeof(ut)>4)
  ------------------
  |  Branch (172:7): [Folded - Ignored]
  ------------------
  173|      1|    SetUnixNS(uint64(ut)*1000000000);
  174|      0|  else
  175|      0|  {
  176|       |    // Convert 32-bit and possibly signed time_t to uint32 first,
  177|       |    // uint64 cast is not enough. Otherwise sign can expand to 64 bits.
  178|      0|    SetUnixNS(uint64(uint32(ut))*1000000000);
  179|      0|  }
  180|      1|}
_ZN7RarTime9SetUnixNSEm:
  194|      7|{
  195|       |  // 11644473600000000000 - number of ns between 01-01-1601 and 01-01-1970.
  196|      7|  uint64 ushift=INT32TO64(0xA1997B0B,0x4C6A0000);
  ------------------
  |  |   19|      7|#define INT32TO64(high,low) ((((uint64)(high))<<32)+((uint64)low))
  ------------------
  197|      7|  itime=(ns+ushift)/(1000000000/TICKS_PER_SECOND);
  198|      7|}
_ZN7RarTime14SetCurrentTimeEv:
  306|      1|{
  307|       |#ifdef _WIN_ALL
  308|       |  FILETIME ft;
  309|       |  SYSTEMTIME st;
  310|       |  GetSystemTime(&st);
  311|       |  SystemTimeToFileTime(&st,&ft);
  312|       |  SetWinFT(&ft);
  313|       |#else
  314|      1|  time_t st;
  315|      1|  time(&st);
  316|      1|  SetUnix(st);
  317|      1|#endif
  318|      1|}

_ZN7RarTimeC2Ev:
   31|     34|    RarTime() {Reset();}
_ZN7RarTime5ResetEv:
   57|     39|    void Reset() {itime=0;}
_ZN7RarTime5IsSetEv:
   58|      6|    bool IsSet() {return itime!=0;}

_ZN10uiMsgStoreC2E14UIMESSAGE_CODE:
  119|      7|    {
  120|       |      // Init arrays in case a caller passes fewer parameters than expected.
  121|     63|      for (uint I=0;I<ASIZE(Str);I++)
  ------------------
  |  |   10|     63|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (121:21): [True: 56, False: 7]
  ------------------
  122|     56|        Str[I]=L"";
  123|      7|      memset(Num,0,sizeof(Num));
  124|       |
  125|      7|      NumSize=StrSize=0;
  126|      7|      this->Code=Code;
  127|      7|    }
_ZN10uiMsgStorelsEPKw:
  129|      9|    {
  130|      9|      if (StrSize<MAX_MSG)
  ------------------
  |  Branch (130:11): [True: 9, False: 0]
  ------------------
  131|      9|        Str[StrSize++]=s;
  132|      9|      return *this;
  133|      9|    }
_Z5uiMsgIPwEv14UIMESSAGE_CODET_:
  155|      5|{
  156|      5|  uiMsgStore Store(Code);
  157|      5|  Store<<a1;
  158|      5|  Store.Msg();
  159|      5|}
_Z5uiMsgIPwS0_Ev14UIMESSAGE_CODET_T0_:
  162|      2|{
  163|      2|  uiMsgStore Store(Code);
  164|      2|  Store<<a1<<a2;
  165|      2|  Store.Msg();
  166|      2|}

_Z21uiStartArchiveExtractbPKw:
   11|      1|{
   12|      1|}
_Z18uiStartFileExtractPKwbbb:
   16|      1|{
   17|      1|  return true;
   18|      1|}
_ZN10uiMsgStore3MsgEv:
   32|      7|{
   33|      7|}
_Z13uiGetPassword15UIPASSWORD_TYPEPKwP11SecPassword:
   37|      2|{
   38|      2|  return false;
   39|      2|}
_Z21uiIsGlobalPasswordSetv:
   43|      1|{
   44|      1|  return false;
   45|      1|}

_Z10WideToCharPKwPcm:
   21|      5|{
   22|      5|  bool RetCode=true;
   23|      5|  *Dest=0; // Set 'Dest' to zero just in case the conversion will fail.
   24|       |
   25|       |#ifdef _WIN_ALL
   26|       |  if (WideCharToMultiByte(CP_ACP,0,Src,-1,Dest,(int)DestSize,NULL,NULL)==0)
   27|       |    RetCode=false;
   28|       |
   29|       |// wcstombs is broken in Android NDK r9.
   30|       |#elif defined(_APPLE)
   31|       |  WideToUtf(Src,Dest,DestSize);
   32|       |
   33|       |#elif defined(MBFUNCTIONS)
   34|      5|  if (!WideToCharMap(Src,Dest,DestSize,RetCode))
  ------------------
  |  Branch (34:7): [True: 5, False: 0]
  ------------------
   35|      5|  {
   36|      5|    mbstate_t ps; // Use thread safe external state based functions.
   37|      5|    memset (&ps, 0, sizeof(ps));
   38|      5|    const wchar *SrcParam=Src; // wcsrtombs can change the pointer.
   39|       |
   40|       |    // Some implementations of wcsrtombs can cause memory analyzing tools
   41|       |    // like valgrind to report uninitialized data access. It happens because
   42|       |    // internally these implementations call SSE4 based wcslen function,
   43|       |    // which reads 16 bytes at once including those beyond of trailing 0.
   44|      5|    size_t ResultingSize=wcsrtombs(Dest,&SrcParam,DestSize,&ps);
   45|       |
   46|      5|    if (ResultingSize==(size_t)-1 && errno==EILSEQ)
  ------------------
  |  Branch (46:9): [True: 0, False: 5]
  |  Branch (46:38): [True: 0, False: 0]
  ------------------
   47|      0|    {
   48|       |      // Aborted on inconvertible character not zero terminating the result.
   49|       |      // EILSEQ helps to distinguish it from small output buffer abort.
   50|       |      // We want to convert as much as we can, so we clean the output buffer
   51|       |      // and repeat conversion.
   52|      0|      memset (&ps, 0, sizeof(ps));
   53|      0|      SrcParam=Src; // wcsrtombs can change the pointer.
   54|      0|      memset(Dest,0,DestSize);
   55|      0|      ResultingSize=wcsrtombs(Dest,&SrcParam,DestSize,&ps);
   56|      0|    }
   57|       |
   58|      5|    if (ResultingSize==(size_t)-1)
  ------------------
  |  Branch (58:9): [True: 0, False: 5]
  ------------------
   59|      0|      RetCode=false;
   60|      5|    if (ResultingSize==0 && *Src!=0)
  ------------------
  |  Branch (60:9): [True: 0, False: 5]
  |  Branch (60:29): [True: 0, False: 0]
  ------------------
   61|      0|      RetCode=false;
   62|      5|  }
   63|       |#else
   64|       |  for (int I=0;I<DestSize;I++)
   65|       |  {
   66|       |    Dest[I]=(char)Src[I];
   67|       |    if (Src[I]==0)
   68|       |      break;
   69|       |  }
   70|       |#endif
   71|      5|  if (DestSize>0)
  ------------------
  |  Branch (71:7): [True: 5, False: 0]
  ------------------
   72|      5|    Dest[DestSize-1]=0;
   73|       |
   74|       |  // We tried to return the empty string if conversion is failed,
   75|       |  // but it does not work well. WideCharToMultiByte returns 'failed' code
   76|       |  // and partially converted string even if we wanted to convert only a part
   77|       |  // of string and passed DestSize smaller than required for fully converted
   78|       |  // string. Such call is the valid behavior in RAR code and we do not expect
   79|       |  // the empty string in this case.
   80|       |
   81|      5|  return RetCode;
   82|      5|}
_Z9UtfToWidePKcPwm:
  325|      2|{
  326|      2|  bool Success=true;
  327|      2|  long dsize=(long)DestSize;
  328|      2|  dsize--;
  329|      5|  while (*Src!=0)
  ------------------
  |  Branch (329:10): [True: 3, False: 2]
  ------------------
  330|      3|  {
  331|      3|    uint c=byte(*(Src++)),d;
  332|      3|    if (c<0x80)
  ------------------
  |  Branch (332:9): [True: 3, False: 0]
  ------------------
  333|      3|      d=c;
  334|      0|    else
  335|      0|      if ((c>>5)==6)
  ------------------
  |  Branch (335:11): [True: 0, False: 0]
  ------------------
  336|      0|      {
  337|      0|        if ((*Src&0xc0)!=0x80)
  ------------------
  |  Branch (337:13): [True: 0, False: 0]
  ------------------
  338|      0|        {
  339|      0|          Success=false;
  340|      0|          break;
  341|      0|        }
  342|      0|        d=((c&0x1f)<<6)|(*Src&0x3f);
  343|      0|        Src++;
  344|      0|      }
  345|      0|      else
  346|      0|        if ((c>>4)==14)
  ------------------
  |  Branch (346:13): [True: 0, False: 0]
  ------------------
  347|      0|        {
  348|      0|          if ((Src[0]&0xc0)!=0x80 || (Src[1]&0xc0)!=0x80)
  ------------------
  |  Branch (348:15): [True: 0, False: 0]
  |  Branch (348:38): [True: 0, False: 0]
  ------------------
  349|      0|          {
  350|      0|            Success=false;
  351|      0|            break;
  352|      0|          }
  353|      0|          d=((c&0xf)<<12)|((Src[0]&0x3f)<<6)|(Src[1]&0x3f);
  354|      0|          Src+=2;
  355|      0|        }
  356|      0|        else
  357|      0|          if ((c>>3)==30)
  ------------------
  |  Branch (357:15): [True: 0, False: 0]
  ------------------
  358|      0|          {
  359|      0|            if ((Src[0]&0xc0)!=0x80 || (Src[1]&0xc0)!=0x80 || (Src[2]&0xc0)!=0x80)
  ------------------
  |  Branch (359:17): [True: 0, False: 0]
  |  Branch (359:40): [True: 0, False: 0]
  |  Branch (359:63): [True: 0, False: 0]
  ------------------
  360|      0|            {
  361|      0|              Success=false;
  362|      0|              break;
  363|      0|            }
  364|      0|            d=((c&7)<<18)|((Src[0]&0x3f)<<12)|((Src[1]&0x3f)<<6)|(Src[2]&0x3f);
  365|      0|            Src+=3;
  366|      0|          }
  367|      0|          else
  368|      0|          {
  369|      0|            Success=false;
  370|      0|            break;
  371|      0|          }
  372|      3|    if (--dsize<0)
  ------------------
  |  Branch (372:9): [True: 0, False: 3]
  ------------------
  373|      0|      break;
  374|      3|    if (d>0xffff)
  ------------------
  |  Branch (374:9): [True: 0, False: 3]
  ------------------
  375|      0|    {
  376|      0|      if (--dsize<0)
  ------------------
  |  Branch (376:11): [True: 0, False: 0]
  ------------------
  377|      0|        break;
  378|      0|      if (d>0x10ffff) // UTF-8 must end at 0x10ffff according to RFC 3629.
  ------------------
  |  Branch (378:11): [True: 0, False: 0]
  ------------------
  379|      0|      {
  380|      0|        Success=false;
  381|      0|        continue;
  382|      0|      }
  383|      0|      if (sizeof(*Dest)==2) // Use the surrogate pair.
  ------------------
  |  Branch (383:11): [Folded - Ignored]
  ------------------
  384|      0|      {
  385|      0|        *(Dest++)=((d-0x10000)>>10)+0xd800;
  386|      0|        *(Dest++)=(d&0x3ff)+0xdc00;
  387|      0|      }
  388|      0|      else
  389|      0|        *(Dest++)=d;
  390|      0|    }
  391|      3|    else
  392|      3|      *(Dest++)=d;
  393|      3|  }
  394|      2|  *Dest=0;
  395|      2|  return Success;
  396|      2|}
_Z8wcsicompPKwS0_:
  426|      1|{
  427|       |#ifdef _WIN_ALL
  428|       |  return CompareStringW(LOCALE_USER_DEFAULT,NORM_IGNORECASE|SORT_STRINGSORT,s1,-1,s2,-1)-2;
  429|       |#else
  430|      4|  while (true)
  ------------------
  |  Branch (430:10): [Folded - Ignored]
  ------------------
  431|      4|  {
  432|      4|    wchar u1 = towupper(*s1);
  433|      4|    wchar u2 = towupper(*s2);
  434|      4|    if (u1 != u2)
  ------------------
  |  Branch (434:9): [True: 0, False: 4]
  ------------------
  435|      0|      return u1 < u2 ? -1 : 1;
  ------------------
  |  Branch (435:14): [True: 0, False: 0]
  ------------------
  436|      4|    if (*s1==0)
  ------------------
  |  Branch (436:9): [True: 1, False: 3]
  ------------------
  437|      1|      break;
  438|      3|    s1++;
  439|      3|    s2++;
  440|      3|  }
  441|      1|  return 0;
  442|      1|#endif
  443|      1|}
_Z8wcsupperPw:
  507|      2|{
  508|       |#ifdef _WIN_ALL
  509|       |  // _wcsupr requires setlocale and we do not want to depend on setlocale
  510|       |  // in Windows. Also CharUpper involves less overhead.
  511|       |  CharUpper(s);
  512|       |#else
  513|      4|  for (wchar *c=s;*c!=0;c++)
  ------------------
  |  Branch (513:19): [True: 2, False: 2]
  ------------------
  514|      2|    *c=towupper(*c);
  515|      2|#endif
  516|      2|  return s;
  517|      2|}
_Z8toupperwi:
  524|      7|{
  525|       |#if defined(_WIN_ALL)
  526|       |  // CharUpper is more reliable than towupper in Windows, which seems to be
  527|       |  // C locale dependent even in Unicode version. For example, towupper failed
  528|       |  // to convert lowercase Russian characters. Use 0xffff mask to prevent crash
  529|       |  // if value larger than 0xffff is passed to this function.
  530|       |  return (int)(INT_PTR)CharUpper((wchar *)(INT_PTR)(ch&0xffff));
  531|       |#else
  532|      7|  return towupper(ch);
  533|      7|#endif
  534|      7|}
unicode.cpp:_ZL13WideToCharMapPKwPcmRb:
  135|      5|{
  136|       |  // String with inconvertible characters mapped to private use Unicode area
  137|       |  // must have the mark code somewhere.
  138|      5|  if (wcschr(Src,(wchar)MappedStringMark)==NULL)
  ------------------
  |  Branch (138:7): [True: 5, False: 0]
  ------------------
  139|      5|    return false;
  140|       |
  141|       |  // Seems to be that wcrtomb in some memory analyzing libraries
  142|       |  // can produce uninitilized output while reporting success on garbage input.
  143|       |  // So we clean the destination to calm analyzers.
  144|      0|  memset(Dest,0,DestSize);
  145|       |  
  146|      0|  Success=true;
  147|      0|  uint SrcPos=0,DestPos=0;
  148|      0|  while (Src[SrcPos]!=0 && DestPos<DestSize-MB_CUR_MAX)
  ------------------
  |  Branch (148:10): [True: 0, False: 0]
  |  Branch (148:28): [True: 0, False: 0]
  ------------------
  149|      0|  {
  150|      0|    if (uint(Src[SrcPos])==MappedStringMark)
  ------------------
  |  Branch (150:9): [True: 0, False: 0]
  ------------------
  151|      0|    {
  152|      0|      SrcPos++;
  153|      0|      continue;
  154|      0|    }
  155|       |    // For security reasons do not restore low ASCII codes, so mapping cannot
  156|       |    // be used to hide control codes like path separators.
  157|      0|    if (uint(Src[SrcPos])>=MapAreaStart+0x80 && uint(Src[SrcPos])<MapAreaStart+0x100)
  ------------------
  |  Branch (157:9): [True: 0, False: 0]
  |  Branch (157:49): [True: 0, False: 0]
  ------------------
  158|      0|      Dest[DestPos++]=char(uint(Src[SrcPos++])-MapAreaStart);
  159|      0|    else
  160|      0|    {
  161|      0|      mbstate_t ps;
  162|      0|      memset(&ps,0,sizeof(ps));
  163|      0|      if (wcrtomb(Dest+DestPos,Src[SrcPos],&ps)==(size_t)-1)
  ------------------
  |  Branch (163:11): [True: 0, False: 0]
  ------------------
  164|      0|      {
  165|      0|        Dest[DestPos]='_';
  166|      0|        Success=false;
  167|      0|      }
  168|      0|      SrcPos++;
  169|      0|      memset(&ps,0,sizeof(ps));
  170|      0|      int Length=mbrlen(Dest+DestPos,MB_CUR_MAX,&ps);
  171|      0|      DestPos+=Max(Length,1);
  ------------------
  |  |    5|      0|#define  Max(x,y) (((x)>(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (5:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  172|      0|    }
  173|      0|  }
  174|      0|  Dest[Min(DestPos,DestSize-1)]=0;
  ------------------
  |  |    4|      0|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  175|      0|  return true;
  176|      5|}

_ZN6UnpackC2EP11ComprDataIO:
   20|      2|{
   21|      2|  UnpIO=DataIO;
   22|      2|  Window=NULL;
   23|      2|  Fragmented=false;
   24|      2|  Suspended=false;
   25|      2|  UnpAllBuf=false;
   26|      2|  UnpSomeRead=false;
   27|      2|#ifdef RAR_SMP
   28|      2|  MaxUserThreads=1;
   29|      2|  UnpThreadPool=NULL;
   30|      2|  ReadBufMT=NULL;
   31|      2|  UnpThreadData=NULL;
   32|      2|#endif
   33|      2|  MaxWinSize=0;
   34|      2|  MaxWinMask=0;
   35|       |
   36|       |  // Perform initialization, which should be done only once for all files.
   37|       |  // It prevents crash if first DoUnpack call is later made with wrong
   38|       |  // (true) 'Solid' value.
   39|      2|  UnpInitData(false);
   40|      2|#ifndef SFX_MODULE
   41|       |  // RAR 1.5 decompression initialization
   42|      2|  UnpInitData15(false);
   43|      2|  InitHuff();
   44|      2|#endif
   45|      2|}
_ZN6UnpackD2Ev:
   49|      2|{
   50|      2|  InitFilters30(false);
   51|       |
   52|      2|  if (Window!=NULL)
  ------------------
  |  Branch (52:7): [True: 0, False: 2]
  ------------------
   53|      0|    free(Window);
   54|      2|#ifdef RAR_SMP
   55|      2|  delete UnpThreadPool;
   56|      2|  delete[] ReadBufMT;
   57|      2|  delete[] UnpThreadData;
   58|      2|#endif
   59|      2|}
_ZN6Unpack10SetThreadsEj:
   64|      2|{
   65|       |  // More than 8 threads are unlikely to provide noticeable gain
   66|       |  // for unpacking, but would use the additional memory.
   67|      2|  MaxUserThreads=Min(Threads,8);
  ------------------
  |  |    4|      2|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 0, False: 2]
  |  |  ------------------
  ------------------
   68|      2|  UnpThreadPool=new ThreadPool(MaxUserThreads);
   69|      2|}
_ZN6Unpack11UnpInitDataEb:
  194|      2|{
  195|      2|  if (!Solid)
  ------------------
  |  Branch (195:7): [True: 2, False: 0]
  ------------------
  196|      2|  {
  197|      2|    memset(OldDist,0,sizeof(OldDist));
  198|      2|    OldDistPtr=0;
  199|      2|    LastDist=LastLength=0;
  200|       |//    memset(Window,0,MaxWinSize);
  201|      2|    memset(&BlockTables,0,sizeof(BlockTables));
  202|      2|    UnpPtr=WrPtr=0;
  203|      2|    WriteBorder=Min(MaxWinSize,UNPACK_MAX_WRITE)&MaxWinMask;
  ------------------
  |  |    4|      2|#define  Min(x,y) (((x)<(y)) ? (x):(y))
  |  |  ------------------
  |  |  |  Branch (4:20): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  204|      2|  }
  205|       |  // Filters never share several solid files, so we can safely reset them
  206|       |  // even in solid archive.
  207|      2|  InitFilters();
  208|       |
  209|      2|  Inp.InitBitInput();
  210|      2|  WrittenFileSize=0;
  211|      2|  ReadTop=0;
  212|      2|  ReadBorder=0;
  213|       |
  214|      2|  memset(&BlockHeader,0,sizeof(BlockHeader));
  215|      2|  BlockHeader.BlockSize=-1;  // '-1' means not defined yet.
  216|      2|#ifndef SFX_MODULE
  217|      2|  UnpInitData20(Solid);
  218|      2|#endif
  219|      2|  UnpInitData30(Solid);
  220|      2|  UnpInitData50(Solid);
  221|      2|}

_ZN6Unpack13UnpInitData15Ei:
  428|      2|{
  429|      2|  if (!Solid)
  ------------------
  |  Branch (429:7): [True: 2, False: 0]
  ------------------
  430|      2|  {
  431|      2|    AvrPlcB=AvrLn1=AvrLn2=AvrLn3=NumHuf=Buf60=0;
  432|      2|    AvrPlc=0x3500;
  433|      2|    MaxDist3=0x2001;
  434|      2|    Nhfb=Nlzb=0x80;
  435|      2|  }
  436|      2|  FlagsCnt=0;
  437|      2|  FlagBuf=0;
  438|      2|  StMode=0;
  439|      2|  LCount=0;
  440|      2|  ReadTop=0;
  441|      2|}
_ZN6Unpack8InitHuffEv:
  445|      2|{
  446|    514|  for (unsigned int I=0;I<256;I++)
  ------------------
  |  Branch (446:25): [True: 512, False: 2]
  ------------------
  447|    512|  {
  448|    512|    ChSet[I]=ChSetB[I]=I<<8;
  449|    512|    ChSetA[I]=I;
  450|    512|    ChSetC[I]=((~I+1) & 0xff)<<8;
  451|    512|  }
  452|      2|  memset(NToPl,0,sizeof(NToPl));
  453|      2|  memset(NToPlB,0,sizeof(NToPlB));
  454|      2|  memset(NToPlC,0,sizeof(NToPlC));
  455|      2|  CorrHuff(ChSetB,NToPlB);
  456|      2|}
_ZN6Unpack8CorrHuffEPtPh:
  460|      2|{
  461|      2|  int I,J;
  462|     18|  for (I=7;I>=0;I--)
  ------------------
  |  Branch (462:12): [True: 16, False: 2]
  ------------------
  463|    528|    for (J=0;J<32;J++,CharSet++)
  ------------------
  |  Branch (463:14): [True: 512, False: 16]
  ------------------
  464|    512|      *CharSet=(*CharSet & ~0xff) | I;
  465|      2|  memset(NumToPlace,0,sizeof(NToPl));
  466|     16|  for (I=6;I>=0;I--)
  ------------------
  |  Branch (466:12): [True: 14, False: 2]
  ------------------
  467|     14|    NumToPlace[I]=(7-I)*32;
  468|      2|}

_ZN6Unpack13UnpInitData20Ei:
  272|      2|{
  273|      2|  if (!Solid)
  ------------------
  |  Branch (273:7): [True: 2, False: 0]
  ------------------
  274|      2|  {
  275|      2|    TablesRead2=false;
  276|      2|    UnpAudioBlock=false;
  277|      2|    UnpChannelDelta=0;
  278|      2|    UnpCurChannel=0;
  279|      2|    UnpChannels=1;
  280|       |
  281|      2|    memset(AudV,0,sizeof(AudV));
  282|      2|    memset(UnpOldTable20,0,sizeof(UnpOldTable20));
  283|      2|    memset(MD,0,sizeof(MD));
  284|      2|  }
  285|      2|}

_ZN6Unpack13UnpInitData30Eb:
  739|      2|{
  740|      2|  if (!Solid)
  ------------------
  |  Branch (740:7): [True: 2, False: 0]
  ------------------
  741|      2|  {
  742|      2|    TablesRead3=false;
  743|      2|    memset(UnpOldTable,0,sizeof(UnpOldTable));
  744|      2|    PPMEscChar=2;
  745|      2|    UnpBlockType=BLOCK_LZ;
  746|      2|  }
  747|      2|  InitFilters30(Solid);
  748|      2|}
_ZN6Unpack13InitFilters30Eb:
  752|      4|{
  753|      4|  if (!Solid)
  ------------------
  |  Branch (753:7): [True: 4, False: 0]
  ------------------
  754|      4|  {
  755|      4|    OldFilterLengths.SoftReset();
  756|      4|    LastFilter=0;
  757|       |
  758|      4|    for (size_t I=0;I<Filters30.Size();I++)
  ------------------
  |  Branch (758:21): [True: 0, False: 4]
  ------------------
  759|      0|      delete Filters30[I];
  760|      4|    Filters30.SoftReset();
  761|      4|  }
  762|      4|  for (size_t I=0;I<PrgStack.Size();I++)
  ------------------
  |  Branch (762:19): [True: 0, False: 4]
  ------------------
  763|      0|    delete PrgStack[I];
  764|      4|  PrgStack.SoftReset();
  765|      4|}

_ZN6Unpack13UnpInitData50Eb:
  529|      2|{
  530|      2|  if (!Solid)
  ------------------
  |  Branch (530:7): [True: 2, False: 0]
  ------------------
  531|      2|    TablesRead5=false;
  532|      2|}
_ZN6Unpack11InitFiltersEv:
  685|      2|{
  686|      2|  Filters.SoftReset();
  687|      2|}

_ZN16FragmentedWindowC2Ev:
    2|      2|{
    3|      2|  memset(Mem,0,sizeof(Mem));
    4|      2|  memset(MemSize,0,sizeof(MemSize));
    5|      2|}
_ZN16FragmentedWindowD2Ev:
    9|      2|{
   10|      2|  Reset();
   11|      2|}
_ZN16FragmentedWindow5ResetEv:
   15|      2|{
   16|     66|  for (uint I=0;I<ASIZE(Mem);I++)
  ------------------
  |  |   10|     66|#define  ASIZE(x) (sizeof(x)/sizeof(x[0]))
  ------------------
  |  Branch (16:17): [True: 64, False: 2]
  ------------------
   17|     64|    if (Mem[I]!=NULL)
  ------------------
  |  Branch (17:9): [True: 0, False: 64]
  ------------------
   18|      0|    {
   19|      0|      free(Mem[I]);
   20|      0|      Mem[I]=NULL;
   21|      0|    }
   22|      2|}

LLVMFuzzerTestOneInput:
   15|      2|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   16|       |  // unrar likes to create files in the current directory.
   17|       |  // So, the following few lines created and 'cd' to a directory named 'o'
   18|       |  // in the current working directory.
   19|      2|  std::error_code code, ok;
   20|      2|  fs::path original_path = fs::current_path(code);
   21|      2|  if (code != ok) return 0;
  ------------------
  |  Branch (21:7): [True: 0, False: 2]
  ------------------
   22|       |
   23|      2|  fs::path out_path = original_path / "o";
   24|      2|  bool created = fs::create_directory(out_path, code);
   25|      2|  if (code != ok) return 0;
  ------------------
  |  Branch (25:7): [True: 0, False: 2]
  ------------------
   26|       |
   27|      2|  fs::current_path(out_path, code);
   28|      2|  if (code != ok) return 0;
  ------------------
  |  Branch (28:7): [True: 0, False: 2]
  ------------------
   29|       |
   30|      2|  static const std::string filename = "temp.rar";
   31|      2|  std::ofstream file(filename,
   32|      2|                     std::ios::binary | std::ios::out | std::ios::trunc);
   33|      2|  if (!file.is_open()) {
  ------------------
  |  Branch (33:7): [True: 0, False: 2]
  ------------------
   34|      0|    return 0;
   35|      0|  }
   36|      2|  file.write(reinterpret_cast<const char *>(data), size);
   37|      2|  file.close();
   38|       |
   39|      2|  std::unique_ptr<CommandData> cmd_data(new CommandData);
   40|      2|  cmd_data->ParseArg(const_cast<wchar_t *>(L"-p"));
   41|      2|  cmd_data->ParseArg(const_cast<wchar_t *>(L"x"));
   42|      2|  cmd_data->ParseDone();
   43|      2|  std::wstring wide_filename(filename.begin(), filename.end());
   44|      2|  cmd_data->AddArcName(wide_filename.c_str());
   45|       |
   46|      2|  try {
   47|      2|    CmdExtract extractor(cmd_data.get());
   48|      2|    extractor.DoExtract();
   49|      2|  } catch (...) {
   50|      0|  }
   51|       |
   52|      2|  unlink(filename.c_str());
   53|       |
   54|       |  // 'cd' back to the original directory and delete 'o' along with
   55|       |  // all its contents.
   56|      2|  fs::current_path(original_path, code);
   57|      2|  if (code != ok) return 0;
  ------------------
  |  Branch (57:7): [True: 0, False: 2]
  ------------------
   58|      2|  fs::remove_all(out_path, code);
   59|      2|  if (code != ok) return 0;
  ------------------
  |  Branch (59:7): [True: 0, False: 2]
  ------------------
   60|      2|  return 0;
   61|      2|}

