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

Method IsSignature

Libraries/unrar/archive.cpp:99–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

97
98
99RARFORMAT Archive::IsSignature(const byte *D,size_t Size)
100{
101 RARFORMAT Type=RARFMT_NONE;
102 if (Size>=1 && D[0]==0x52)
103#ifndef SFX_MODULE
104 if (Size>=4 && D[1]==0x45 && D[2]==0x7e && D[3]==0x5e)
105 Type=RARFMT14;
106 else
107#endif
108 if (Size>=7 && D[1]==0x61 && D[2]==0x72 && D[3]==0x21 && D[4]==0x1a && D[5]==0x07)
109 {
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 if (D[6]==0)
114 Type=RARFMT15;
115 else
116 if (D[6]==1)
117 Type=RARFMT50;
118 else
119 if (D[6]>1 && D[6]<5)
120 Type=RARFMT_FUTURE;
121 }
122 return Type;
123}
124
125
126bool Archive::IsArchive(bool EnableBroken)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected