Lines Matching refs:sd
193 #define SZ_READ_BYTE(dest) SZ_READ_BYTE_SD(sd, dest)
196 if (sd.Size == 0) return SZ_ERROR_ARCHIVE; \
197 sd.Size--; dest = *sd.Data++;
199 #define SKIP_DATA(sd, size) { sd->Size -= (size_t)(size); sd->Data += (size_t)(size); }
200 #define SKIP_DATA2(sd, size) { sd.Size -= (size_t)(size); sd.Data += (size_t)(size); }
202 #define SZ_READ_32(dest) if (sd.Size < 4) return SZ_ERROR_ARCHIVE; \
203 dest = GetUi32(sd.Data); SKIP_DATA2(sd, 4);
205 static Z7_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value)
243 static Z7_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value)
247 if (sd->Size == 0)
249 firstByte = *sd->Data;
253 sd->Data++;
254 sd->Size--;
257 RINOK(ReadNumber(sd, &value64))
266 #define ReadID(sd, value) ReadNumber(sd, value)
268 static SRes SkipData(CSzData *sd)
271 RINOK(ReadNumber(sd, &size))
272 if (size > sd->Size)
274 SKIP_DATA(sd, size)
278 static SRes WaitId(CSzData *sd, UInt32 id)
283 RINOK(ReadID(sd, &type))
288 RINOK(SkipData(sd))
292 static SRes RememberBitVector(CSzData *sd, UInt32 numItems, const Byte **v)
295 if (numBytes > sd->Size)
297 *v = sd->Data;
298 SKIP_DATA(sd, numBytes)
320 static Z7_NO_INLINE SRes ReadBitVector(CSzData *sd, UInt32 numItems, Byte **v, ISzAllocPtr alloc)
331 if (numBytes > sd->Size)
333 MY_ALLOC_AND_CPY(*v, numBytes, sd->Data, alloc)
334 SKIP_DATA(sd, numBytes)
351 CSzData sd;
355 sd = *sd2;
365 *sd2 = sd;
369 static SRes ReadBitUi32s(CSzData *sd, UInt32 numItems, CSzBitUi32s *crcs, ISzAllocPtr alloc)
372 RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc))
373 return ReadUi32s(sd, numItems, crcs, alloc);
376 static SRes SkipBitUi32s(CSzData *sd, UInt32 numItems)
384 if (numBytes > sd->Size)
386 numDefined = CountDefinedBits(sd->Data, numItems);
387 SKIP_DATA(sd, numBytes)
389 if (numDefined > (sd->Size >> 2))
391 SKIP_DATA(sd, (size_t)numDefined * 4)
395 static SRes ReadPackInfo(CSzAr *p, CSzData *sd, ISzAllocPtr alloc)
397 RINOK(SzReadNumber32(sd, &p->NumPackStreams))
399 RINOK(WaitId(sd, k7zIdSize))
409 RINOK(ReadNumber(sd, &packSize))
420 RINOK(ReadID(sd, &type))
426 RINOK(SkipBitUi32s(sd, p->NumPackStreams))
429 RINOK(SkipData(sd))
434 static SRes SzReadSwitch(CSzData *sd)
437 RINOK(SzReadByte(sd, &external));
444 SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd)
448 const Byte *dataStart = sd->Data;
455 RINOK(SzReadNumber32(sd, &numCoders))
473 if (idSize > sd->Size)
478 id = ((id << 8) | *sd->Data);
479 sd->Data++;
480 sd->Size--;
494 RINOK(SzReadNumber32(sd, &numStreams))
499 RINOK(SzReadNumber32(sd, &numStreams))
512 RINOK(SzReadNumber32(sd, &propsSize))
513 if (propsSize > sd->Size)
517 coder->PropsOffset = (size_t)(sd->Data - dataStart);
519 sd->Data += (size_t)propsSize;
520 sd->Size -= (size_t)propsSize;
562 RINOK(SzReadNumber32(sd, &bp->InIndex))
567 RINOK(SzReadNumber32(sd, &bp->OutIndex))
597 RINOK(SzReadNumber32(sd, &index))
613 CSzData sd;
614 sd = *sd2;
624 if (sd.Size == 0)
626 sd.Size--;
627 sd.Data++;
633 if (i > sd.Size)
635 SKIP_DATA2(sd, i)
637 *sd2 = sd;
652 CSzData sd;
667 sd = *sd2;
674 sd.Data = tempBufs[index].data;
675 sd.Size = tempBufs[index].size;
683 startBufPtr = sd.Data;
692 p->FoCodersOffsets[fo] = (size_t)(sd.Data - startBufPtr);
694 RINOK(SzReadNumber32(&sd, &numCoders))
710 if (idSize > sd.Size)
712 SKIP_DATA2(sd, idSize)
719 RINOK(SzReadNumber32(&sd, &coderInStreams))
720 RINOK(SzReadNumber32(&sd, &coderOutStreams))
730 RINOK(SzReadNumber32(&sd, &propsSize))
731 if (propsSize > sd.Size)
733 SKIP_DATA2(sd, propsSize)
763 RINOK(SzReadNumber32(&sd, &index))
768 RINOK(SzReadNumber32(&sd, &index))
780 RINOK(SzReadNumber32(&sd, &index))
812 const size_t dataSize = (size_t)(sd.Data - startBufPtr);
820 if (sd.Size != 0)
822 sd = *sd2;
825 RINOK(WaitId(&sd, k7zIdCodersUnpackSize))
832 RINOK(ReadNumber(&sd, p->CoderUnpackSizes + i))
839 RINOK(ReadID(&sd, &type))
842 *sd2 = sd;
847 RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc))
850 RINOK(SkipData(&sd))
871 static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi)
881 RINOK(ReadID(sd, &type))
885 ssi->sdNumSubStreams.Data = sd->Data;
891 RINOK(SzReadNumber32(sd, &numStreams))
900 ssi->sdNumSubStreams.Size = (size_t)(sd->Data - ssi->sdNumSubStreams.Data);
905 RINOK(SkipData(sd))
920 ssi->sdSizes.Data = sd->Data;
921 RINOK(SkipNumbers(sd, numUnpackSizesInData))
922 ssi->sdSizes.Size = (size_t)(sd->Data - ssi->sdSizes.Data);
923 RINOK(ReadID(sd, &type))
932 ssi->sdCRCs.Data = sd->Data;
933 RINOK(SkipBitUi32s(sd, numSubDigests))
934 ssi->sdCRCs.Size = (size_t)(sd->Data - ssi->sdCRCs.Data);
938 RINOK(SkipData(sd))
940 RINOK(ReadID(sd, &type))
945 CSzData *sd,
958 RINOK(ReadID(sd, &type))
961 RINOK(ReadNumber(sd, dataOffset))
964 RINOK(ReadPackInfo(p, sd, alloc))
967 RINOK(ReadID(sd, &type))
971 RINOK(ReadUnpackInfo(p, sd, numFoldersMax, tempBufs, numTempBufs, alloc))
972 RINOK(ReadID(sd, &type))
976 RINOK(ReadSubStreamsInfo(p, sd, ssi))
977 RINOK(ReadID(sd, &type))
990 CSzData *sd,
1001 RINOK(SzReadStreamsInfo(p, sd, numFoldersMax, NULL, 0, &dataStartPos, &ssi, allocTemp))
1064 CSzData sd;
1074 sd = *sd2;
1081 sd.Data = tempBufs[index].data;
1082 sd.Size = tempBufs[index].size;
1091 if (sd.Size < 8)
1093 vals[i].Low = GetUi32(sd.Data);
1094 vals[i].High = GetUi32(sd.Data + 4);
1095 SKIP_DATA2(sd, 8)
1101 *sd2 = sd;
1112 CSzData *sd,
1131 RINOK(ReadID(sd, &type))
1138 RINOK(ReadID(sd, &type2))
1141 RINOK(SkipData(sd))
1143 RINOK(ReadID(sd, &type))
1154 res = SzReadAndDecodePackedStreams(inStream, sd, tempBufs, NUM_ADDITIONAL_STREAMS_MAX,
1161 RINOK(ReadID(sd, &type))
1166 RINOK(SzReadStreamsInfo(&p->db, sd, (UInt32)1 << 30, tempBufs, *numTempBufs,
1169 RINOK(ReadID(sd, &type))
1187 RINOK(SzReadNumber32(sd, &numFiles))
1194 RINOK(ReadID(sd, &type))
1197 RINOK(ReadNumber(sd, &size))
1198 if (size > sd->Size)
1203 SKIP_DATA(sd, size)
1217 namesData = sd->Data;
1222 RINOK(SzReadNumber32(sd, &index))
1236 SKIP_DATA(sd, namesSize)
1242 RINOK(RememberBitVector(sd, numFiles, &emptyStreams))
1249 RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles))
1258 RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain))
1262 sdPtr = sd;
1266 RINOK(SzReadNumber32(sd, &index))
1280 RINOK(ReadBitVector(sd, numFiles, &p->Parents.Defs, allocMain));
1281 RINOK(SzReadSwitch(sd));
1282 RINOK(ReadUi32s(sd, numFiles, &p->Parents, allocMain));
1286 case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)) break;
1287 case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)) break;
1290 SKIP_DATA(sd, size)
1301 RINOK(ReadID(sd, &type))
1304 RINOK(SkipData(sd))
1484 CSzData *sd,
1497 res = SzReadHeader2(p, sd, inStream,
1506 if (sd->Size != 0)
1577 CSzData sd;
1579 sd.Data = buf.data;
1580 sd.Size = buf.size;
1582 res = ReadID(&sd, &type);
1593 res = SzReadAndDecodePackedStreams(inStream, &sd, &tempBuf, 1, p->startPosAfterHeader, &tempAr, allocTemp);
1605 sd.Data = buf.data;
1606 sd.Size = buf.size;
1607 res = ReadID(&sd, &type);
1621 sd2 = sd;
1627 res = SzReadHeader(p, &sd, inStream, allocMain, allocTemp);