Lines Matching refs:sd

184 #define SZ_READ_BYTE(dest) SZ_READ_BYTE_SD(sd, dest)

185 #define SZ_READ_BYTE_2(dest) if (sd.Size == 0) return SZ_ERROR_ARCHIVE; sd.Size--; dest = *sd.Data++;
187 #define SKIP_DATA(sd, size) { sd->Size -= (size_t)(size); sd->Data += (size_t)(size); }
188 #define SKIP_DATA2(sd, size) { sd.Size -= (size_t)(size); sd.Data += (size_t)(size); }
190 #define SZ_READ_32(dest) if (sd.Size < 4) return SZ_ERROR_ARCHIVE; \
191 dest = GetUi32(sd.Data); SKIP_DATA2(sd, 4);
193 static MY_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value)
231 static MY_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value)
235 if (sd->Size == 0)
237 firstByte = *sd->Data;
241 sd->Data++;
242 sd->Size--;
245 RINOK(ReadNumber(sd, &value64));
254 #define ReadID(sd, value) ReadNumber(sd, value)
256 static SRes SkipData(CSzData *sd)
259 RINOK(ReadNumber(sd, &size));
260 if (size > sd->Size)
262 SKIP_DATA(sd, size);
266 static SRes WaitId(CSzData *sd, UInt32 id)
271 RINOK(ReadID(sd, &type));
276 RINOK(SkipData(sd));
280 static SRes RememberBitVector(CSzData *sd, UInt32 numItems, const Byte **v)
283 if (numBytes > sd->Size)
285 *v = sd->Data;
286 SKIP_DATA(sd, numBytes);
308 static MY_NO_INLINE SRes ReadBitVector(CSzData *sd, UInt32 numItems, Byte **v, ISzAlloc *alloc)
319 if (numBytes > sd->Size)
321 MY_ALLOC_AND_CPY(*v, numBytes, sd->Data, alloc);
322 SKIP_DATA(sd, numBytes);
339 CSzData sd;
343 sd = *sd2;
353 *sd2 = sd;
357 static SRes ReadBitUi32s(CSzData *sd, UInt32 numItems, CSzBitUi32s *crcs, ISzAlloc *alloc)
360 RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc));
361 return ReadUi32s(sd, numItems, crcs, alloc);
364 static SRes SkipBitUi32s(CSzData *sd, UInt32 numItems)
372 if (numBytes > sd->Size)
374 numDefined = CountDefinedBits(sd->Data, numItems);
375 SKIP_DATA(sd, numBytes);
377 if (numDefined > (sd->Size >> 2))
379 SKIP_DATA(sd, (size_t)numDefined * 4);
383 static SRes ReadPackInfo(CSzAr *p, CSzData *sd, ISzAlloc *alloc)
385 RINOK(SzReadNumber32(sd, &p->NumPackStreams));
387 RINOK(WaitId(sd, k7zIdSize));
397 RINOK(ReadNumber(sd, &packSize));
408 RINOK(ReadID(sd, &type));
414 RINOK(SkipBitUi32s(sd, p->NumPackStreams));
417 RINOK(SkipData(sd));
422 static SRes SzReadSwitch(CSzData *sd)
425 RINOK(SzReadByte(sd, &external));
432 SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd)
436 const Byte *dataStart = sd->Data;
443 RINOK(SzReadNumber32(sd, &numCoders));
461 if (idSize > sd->Size)
466 id = ((id << 8) | *sd->Data);
467 sd->Data++;
468 sd->Size--;
482 RINOK(SzReadNumber32(sd, &numStreams));
487 RINOK(SzReadNumber32(sd, &numStreams));
500 RINOK(SzReadNumber32(sd, &propsSize));
501 if (propsSize > sd->Size)
505 coder->PropsOffset = sd->Data - dataStart;
507 sd->Data += (size_t)propsSize;
508 sd->Size -= (size_t)propsSize;
550 RINOK(SzReadNumber32(sd, &bp->InIndex));
555 RINOK(SzReadNumber32(sd, &bp->OutIndex));
585 RINOK(SzReadNumber32(sd, &index));
601 CSzData sd;
602 sd = *sd2;
612 if (sd.Size == 0)
614 sd.Size--;
615 sd.Data++;
621 if (i > sd.Size)
623 SKIP_DATA2(sd, i);
625 *sd2 = sd;
640 CSzData sd;
655 sd = *sd2;
662 sd.Data = tempBufs[index].data;
663 sd.Size = tempBufs[index].size;
671 startBufPtr = sd.Data;
680 p->FoCodersOffsets[fo] = sd.Data - startBufPtr;
682 RINOK(SzReadNumber32(&sd, &numCoders));
698 if (idSize > sd.Size)
700 SKIP_DATA2(sd, idSize);
707 RINOK(SzReadNumber32(&sd, &coderInStreams));
708 RINOK(SzReadNumber32(&sd, &coderOutStreams));
718 RINOK(SzReadNumber32(&sd, &propsSize));
719 if (propsSize > sd.Size)
721 SKIP_DATA2(sd, propsSize);
751 RINOK(SzReadNumber32(&sd, &index));
756 RINOK(SzReadNumber32(&sd, &index));
768 RINOK(SzReadNumber32(&sd, &index));
800 size_t dataSize = sd.Data - startBufPtr;
808 if (sd.Size != 0)
810 sd = *sd2;
813 RINOK(WaitId(&sd, k7zIdCodersUnpackSize));
820 RINOK(ReadNumber(&sd, p->CoderUnpackSizes + i));
827 RINOK(ReadID(&sd, &type));
830 *sd2 = sd;
835 RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc));
838 RINOK(SkipData(&sd));
859 static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi)
869 RINOK(ReadID(sd, &type));
873 ssi->sdNumSubStreams.Data = sd->Data;
879 RINOK(SzReadNumber32(sd, &numStreams));
888 ssi->sdNumSubStreams.Size = sd->Data - ssi->sdNumSubStreams.Data;
893 RINOK(SkipData(sd));
908 ssi->sdSizes.Data = sd->Data;
909 RINOK(SkipNumbers(sd, numUnpackSizesInData));
910 ssi->sdSizes.Size = sd->Data - ssi->sdSizes.Data;
911 RINOK(ReadID(sd, &type));
920 ssi->sdCRCs.Data = sd->Data;
921 RINOK(SkipBitUi32s(sd, numSubDigests));
922 ssi->sdCRCs.Size = sd->Data - ssi->sdCRCs.Data;
926 RINOK(SkipData(sd));
928 RINOK(ReadID(sd, &type));
933 CSzData *sd,
946 RINOK(ReadID(sd, &type));
949 RINOK(ReadNumber(sd, dataOffset));
950 RINOK(ReadPackInfo(p, sd, alloc));
951 RINOK(ReadID(sd, &type));
955 RINOK(ReadUnpackInfo(p, sd, numFoldersMax, tempBufs, numTempBufs, alloc));
956 RINOK(ReadID(sd, &type));
960 RINOK(ReadSubStreamsInfo(p, sd, ssi));
961 RINOK(ReadID(sd, &type));
974 CSzData *sd,
985 RINOK(SzReadStreamsInfo(p, sd, numFoldersMax, NULL, 0, &dataStartPos, &ssi, allocTemp));
1048 CSzData sd;
1058 sd = *sd2;
1065 sd.Data = tempBufs[index].data;
1066 sd.Size = tempBufs[index].size;
1075 if (sd.Size < 8)
1077 vals[i].Low = GetUi32(sd.Data);
1078 vals[i].High = GetUi32(sd.Data + 4);
1079 SKIP_DATA2(sd, 8);
1085 *sd2 = sd;
1096 CSzData *sd,
1115 RINOK(ReadID(sd, &type));
1122 RINOK(ReadID(sd, &type2));
1125 RINOK(SkipData(sd));
1127 RINOK(ReadID(sd, &type));
1136 res = SzReadAndDecodePackedStreams(inStream, sd, tempBufs, NUM_ADDITIONAL_STREAMS_MAX,
1143 RINOK(ReadID(sd, &type));
1148 RINOK(SzReadStreamsInfo(&p->db, sd, (UInt32)1 << 30, tempBufs, *numTempBufs,
1151 RINOK(ReadID(sd, &type));
1169 RINOK(SzReadNumber32(sd, &numFiles));
1176 RINOK(ReadID(sd, &type));
1179 RINOK(ReadNumber(sd, &size));
1180 if (size > sd->Size)
1185 SKIP_DATA(sd, size);
1199 namesData = sd->Data;
1204 RINOK(SzReadNumber32(sd, &index));
1218 SKIP_DATA(sd, namesSize);
1224 RINOK(RememberBitVector(sd, numFiles, &emptyStreams));
1231 RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles));
1240 RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain));
1244 sdPtr = sd;
1248 RINOK(SzReadNumber32(sd, &index));
1262 RINOK(ReadBitVector(sd, numFiles, &p->Parents.Defs, allocMain));
1263 RINOK(SzReadSwitch(sd));
1264 RINOK(ReadUi32s(sd, numFiles, &p->Parents, allocMain));
1268 case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); break;
1269 case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); break;
1272 SKIP_DATA(sd, size);
1283 RINOK(ReadID(sd, &type));
1286 RINOK(SkipData(sd));
1473 CSzData *sd,
1486 res = SzReadHeader2(p, sd, inStream,
1495 if (sd->Size != 0)
1564 CSzData sd;
1566 sd.Data = buf.data;
1567 sd.Size = buf.size;
1569 res = ReadID(&sd, &type);
1578 res = SzReadAndDecodePackedStreams(inStream, &sd, &tempBuf, 1, p->startPosAfterHeader, &tempAr, allocTemp);
1590 sd.Data = buf.data;
1591 sd.Size = buf.size;
1592 res = ReadID(&sd, &type);
1606 sd2 = sd;
1612 res = SzReadHeader(p, &sd, inStream, allocMain, allocTemp);