diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2016-05-20 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:16:59 +0300 |
commit | bec3b479dcae1345a466ebe923989b0bd56fd5b6 (patch) | |
tree | 048b53858db838682f169140ba9887fdf819ab2e /CPP/7zip/Archive/Udf | |
parent | 66ac98bb02ac0fadd2a0e3266ea39279984580a3 (diff) |
16.0116.01
Diffstat (limited to 'CPP/7zip/Archive/Udf')
-rw-r--r-- | CPP/7zip/Archive/Udf/UdfIn.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/CPP/7zip/Archive/Udf/UdfIn.cpp b/CPP/7zip/Archive/Udf/UdfIn.cpp index 908f2356..d52db9f4 100644 --- a/CPP/7zip/Archive/Udf/UdfIn.cpp +++ b/CPP/7zip/Archive/Udf/UdfIn.cpp @@ -428,7 +428,7 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la if (lad.GetLen() != vol.BlockSize) return S_FALSE; - size_t size = lad.GetLen(); + const size_t size = lad.GetLen(); CByteBuffer buf(size); RINOK(Read(volIndex, lad, buf)); @@ -518,20 +518,20 @@ HRESULT CInArchive::ReadItem(int volIndex, int fsIndex, const CLongAllocDesc &la { if (!item.CheckChunkSizes() || !CheckItemExtents(volIndex, item)) return S_FALSE; - CByteBuffer buf; - RINOK(ReadFromFile(volIndex, item, buf)); + CByteBuffer buf2; + RINOK(ReadFromFile(volIndex, item, buf2)); item.Size = 0; item.Extents.ClearAndFree(); item.InlineData.Free(); - const Byte *p = buf; - size = buf.Size(); + const Byte *p2 = buf2; + const size_t size2 = buf2.Size(); size_t processedTotal = 0; - for (; processedTotal < size;) + for (; processedTotal < size2;) { size_t processedCur; CFileId fileId; - RINOK(fileId.Parse(p + processedTotal, size - processedTotal, processedCur)); + RINOK(fileId.Parse(p2 + processedTotal, size2 - processedTotal, processedCur)); if (!fileId.IsItLinkParent()) { CFile file; @@ -599,8 +599,8 @@ API_FUNC_IsArc IsArc_Udf(const Byte *p, size_t size) { if (SecLogSize < 8) return res; - UInt32 offset = (UInt32)256 << SecLogSize; - size_t bufSize = (UInt32)1 << SecLogSize; + const UInt32 offset = (UInt32)256 << SecLogSize; + const UInt32 bufSize = (UInt32)1 << SecLogSize; if (offset + bufSize > size) res = k_IsArc_Res_NEED_MORE; else @@ -660,7 +660,7 @@ HRESULT CInArchive::Open2() if (offset >= fileSize) continue; RINOK(_stream->Seek(offset, STREAM_SEEK_SET, NULL)); - size_t bufSize = (UInt32)1 << SecLogSize; + const size_t bufSize = (size_t)1 << SecLogSize; size_t readSize = bufSize; RINOK(ReadStream(_stream, buf, &readSize)); if (readSize == bufSize) @@ -686,8 +686,7 @@ HRESULT CInArchive::Open2() for (UInt32 location = 0; ; location++) { - size_t bufSize = (UInt32)1 << SecLogSize; - size_t pos = 0; + const size_t bufSize = (size_t)1 << SecLogSize; if (((UInt64)(location + 1) << SecLogSize) > extentVDS.Len) return S_FALSE; @@ -700,7 +699,10 @@ HRESULT CInArchive::Open2() CTag tag; - RINOK(tag.Parse(buf + pos, bufSize - pos)); + { + const size_t pos = 0; + RINOK(tag.Parse(buf + pos, bufSize - pos)); + } if (tag.Id == DESC_TYPE_Terminating) break; @@ -862,9 +864,9 @@ HRESULT CInArchive::Open2() { if (nextExtent.GetLen() < 512) return S_FALSE; - CByteBuffer buf(nextExtent.GetLen()); - RINOK(Read(volIndex, nextExtent, buf)); - const Byte *p = buf; + CByteBuffer buf2(nextExtent.GetLen()); + RINOK(Read(volIndex, nextExtent, buf2)); + const Byte *p = buf2; size_t size = nextExtent.GetLen(); CTag tag; |