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

Function ListFileAttr

Libraries/unrar/list.cpp:432–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

430*/
431
432void ListFileAttr(uint A,HOST_SYSTEM_TYPE HostType,wchar *AttrStr,size_t AttrSize)
433{
434 switch(HostType)
435 {
436 case HSYS_WINDOWS:
437 swprintf(AttrStr,AttrSize,L"%c%c%c%c%c%c%c",
438 (A & 0x2000)!=0 ? 'I' : '.', // Not content indexed.
439 (A & 0x0800)!=0 ? 'C' : '.', // Compressed.
440 (A & 0x0020)!=0 ? 'A' : '.', // Archive.
441 (A & 0x0010)!=0 ? 'D' : '.', // Directory.
442 (A & 0x0004)!=0 ? 'S' : '.', // System.
443 (A & 0x0002)!=0 ? 'H' : '.', // Hidden.
444 (A & 0x0001)!=0 ? 'R' : '.'); // Read-only.
445 break;
446 case HSYS_UNIX:
447 switch (A & 0xF000)
448 {
449 case 0x4000:
450 AttrStr[0]='d';
451 break;
452 case 0xA000:
453 AttrStr[0]='l';
454 break;
455 default:
456 AttrStr[0]='-';
457 break;
458 }
459 swprintf(AttrStr+1,AttrSize-1,L"%c%c%c%c%c%c%c%c%c",
460 (A & 0x0100) ? 'r' : '-',
461 (A & 0x0080) ? 'w' : '-',
462 (A & 0x0040) ? ((A & 0x0800)!=0 ? 's':'x'):((A & 0x0800)!=0 ? 'S':'-'),
463 (A & 0x0020) ? 'r' : '-',
464 (A & 0x0010) ? 'w' : '-',
465 (A & 0x0008) ? ((A & 0x0400)!=0 ? 's':'x'):((A & 0x0400)!=0 ? 'S':'-'),
466 (A & 0x0004) ? 'r' : '-',
467 (A & 0x0002) ? 'w' : '-',
468 (A & 0x0001) ? ((A & 0x200)!=0 ? 't' : 'x') : '-');
469 break;
470 case HSYS_UNKNOWN:
471 wcsncpyz(AttrStr,L"?",AttrSize);
472 break;
473 }
474}

Callers 1

ListFileHeaderFunction · 0.85

Calls 1

wcsncpyzFunction · 0.85

Tested by

no test coverage detected