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

Method ReadVMCodePPM

Libraries/unrar/unpack30.cpp:323–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321
322
323bool Unpack::ReadVMCodePPM()
324{
325 uint FirstByte=SafePPMDecodeChar();
326 if ((int)FirstByte==-1)
327 return false;
328 uint Length=(FirstByte & 7)+1;
329 if (Length==7)
330 {
331 int B1=SafePPMDecodeChar();
332 if (B1==-1)
333 return false;
334 Length=B1+7;
335 }
336 else
337 if (Length==8)
338 {
339 int B1=SafePPMDecodeChar();
340 if (B1==-1)
341 return false;
342 int B2=SafePPMDecodeChar();
343 if (B2==-1)
344 return false;
345 Length=B1*256+B2;
346 }
347 if (Length==0)
348 return false;
349 Array<byte> VMCode(Length);
350 for (uint I=0;I<Length;I++)
351 {
352 int Ch=SafePPMDecodeChar();
353 if (Ch==-1)
354 return false;
355 VMCode[I]=Ch;
356 }
357 return AddVMCode(FirstByte,&VMCode[0],Length);
358}
359
360
361bool Unpack::AddVMCode(uint FirstByte,byte *Code,uint CodeSize)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected