diff options
Diffstat (limited to 'CPP/7zip/Archive/RPM/RpmIn.cpp')
-rwxr-xr-x | CPP/7zip/Archive/RPM/RpmIn.cpp | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/CPP/7zip/Archive/RPM/RpmIn.cpp b/CPP/7zip/Archive/RPM/RpmIn.cpp deleted file mode 100755 index db7a6f63..00000000 --- a/CPP/7zip/Archive/RPM/RpmIn.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// Archive/RpmIn.cpp - -#include "StdAfx.h" - -#include "RpmIn.h" - -#include "RpmHeader.h" - -#include "Windows/Defs.h" -#include "Common/MyCom.h" - -#include "../../Common/StreamUtils.h" - -namespace NArchive { -namespace NRpm { - -static UInt16 GetUInt16(const char *data) -{ - return (UInt16)((Byte)data[1] | (((UInt16)(Byte)data[0]) << 8)); -} - -static UInt32 GetUInt32(const char *data) -{ - return - ((UInt32)(Byte)data[3]) | - (((UInt32)(Byte)data[2]) << 8) | - (((UInt32)(Byte)data[1]) << 16) | - (((UInt32)(Byte)data[0]) << 24); -} - -static HRESULT RedSigHeaderSig(IInStream *inStream, CSigHeaderSig &h) -{ - char dat[kCSigHeaderSigSize]; - char *cur = dat; - RINOK(ReadStream_FALSE(inStream, dat, kCSigHeaderSigSize)); - memmove(h.Magic, cur, 4); - cur += 4; - cur += 4; - h.IndexLen = GetUInt32(cur); - cur += 4; - h.DataLen = GetUInt32(cur); - return S_OK; -} - -HRESULT OpenArchive(IInStream *inStream) -{ - UInt64 pos; - char leadData[kLeadSize]; - char *cur = leadData; - CLead lead; - RINOK(ReadStream_FALSE(inStream, leadData, kLeadSize)); - memmove(lead.Magic, cur, 4); - cur += 4; - lead.Major = *cur++; - lead.Minor = *cur++; - lead.Type = GetUInt16(cur); - cur += 2; - lead.ArchNum = GetUInt16(cur); - cur += 2; - memmove(lead.Name, cur, sizeof(lead.Name)); - cur += sizeof(lead.Name); - lead.OSNum = GetUInt16(cur); - cur += 2; - lead.SignatureType = GetUInt16(cur); - cur += 2; - - if (!lead.MagicCheck() || lead.Major < 3) - return S_FALSE; - - CSigHeaderSig sigHeader, header; - if(lead.SignatureType == RPMSIG_NONE) - { - ; - } - else if(lead.SignatureType == RPMSIG_PGP262_1024) - { - UInt64 pos; - RINOK(inStream->Seek(256, STREAM_SEEK_CUR, &pos)); - } - else if(lead.SignatureType == RPMSIG_HEADERSIG) - { - RINOK(RedSigHeaderSig(inStream, sigHeader)); - if(!sigHeader.MagicCheck()) - return S_FALSE; - UInt32 len = sigHeader.GetLostHeaderLen(); - RINOK(inStream->Seek(len, STREAM_SEEK_CUR, &pos)); - if((pos % 8) != 0) - { - RINOK(inStream->Seek((pos / 8 + 1) * 8 - pos, - STREAM_SEEK_CUR, &pos)); - } - } - else - return S_FALSE; - - RINOK(RedSigHeaderSig(inStream, header)); - if(!header.MagicCheck()) - return S_FALSE; - int headerLen = header.GetLostHeaderLen(); - if(headerLen == -1) - return S_FALSE; - RINOK(inStream->Seek(headerLen, STREAM_SEEK_CUR, &pos)); - return S_OK; -} - -}} |