Lines Matching refs:sd

182 static SRes SzReadByte(CSzData *sd, Byte *b)  in SzReadByte()  argument
184 if (sd->Size == 0) in SzReadByte()
186 sd->Size--; in SzReadByte()
187 *b = *sd->Data++; in SzReadByte()
192 #define SZ_READ_BYTE(dest) SZ_READ_BYTE_SD(sd, dest)
193 #define SZ_READ_BYTE_2(dest) if (sd.Size == 0) return SZ_ERROR_ARCHIVE; sd.Size--; dest = *sd.Data+…
195 #define SKIP_DATA(sd, size) { sd->Size -= (size_t)(size); sd->Data += (size_t)(size); } argument
196 #define SKIP_DATA2(sd, size) { sd.Size -= (size_t)(size); sd.Data += (size_t)(size); } argument
198 #define SZ_READ_32(dest) if (sd.Size < 4) return SZ_ERROR_ARCHIVE; \
199 dest = GetUi32(sd.Data); SKIP_DATA2(sd, 4);
201 static MY_NO_INLINE SRes ReadNumber(CSzData *sd, UInt64 *value) in ReadNumber() argument
290 static MY_NO_INLINE SRes SzReadNumber32(CSzData *sd, UInt32 *value) in SzReadNumber32() argument
294 if (sd->Size == 0) in SzReadNumber32()
296 firstByte = *sd->Data; in SzReadNumber32()
300 sd->Data++; in SzReadNumber32()
301 sd->Size--; in SzReadNumber32()
304 RINOK(ReadNumber(sd, &value64)); in SzReadNumber32()
313 #define ReadID(sd, value) ReadNumber(sd, value) argument
315 static SRes SkipData(CSzData *sd) in SkipData() argument
318 RINOK(ReadNumber(sd, &size)); in SkipData()
319 if (size > sd->Size) in SkipData()
321 SKIP_DATA(sd, size); in SkipData()
325 static SRes WaitId(CSzData *sd, UInt64 id) in WaitId() argument
330 RINOK(ReadID(sd, &type)); in WaitId()
335 RINOK(SkipData(sd)); in WaitId()
339 static SRes RememberBitVector(CSzData *sd, UInt32 numItems, const Byte **v) in RememberBitVector() argument
342 if (numBytes > sd->Size) in RememberBitVector()
344 *v = sd->Data; in RememberBitVector()
345 SKIP_DATA(sd, numBytes); in RememberBitVector()
367 static MY_NO_INLINE SRes ReadBitVector(CSzData *sd, UInt32 numItems, Byte **v, ISzAlloc *alloc) in ReadBitVector() argument
373 RINOK(SzReadByte(sd, &allAreDefined)); in ReadBitVector()
376 if (numBytes > sd->Size) in ReadBitVector()
379 memcpy(*v, sd->Data, numBytes); in ReadBitVector()
380 SKIP_DATA(sd, numBytes); in ReadBitVector()
398 CSzData sd; in ReadUi32s() local
402 sd = *sd2; in ReadUi32s()
412 *sd2 = sd; in ReadUi32s()
416 static SRes ReadBitUi32s(CSzData *sd, UInt32 numItems, CSzBitUi32s *crcs, ISzAlloc *alloc) in ReadBitUi32s() argument
419 RINOK(ReadBitVector(sd, numItems, &crcs->Defs, alloc)); in ReadBitUi32s()
420 return ReadUi32s(sd, numItems, crcs, alloc); in ReadBitUi32s()
423 static SRes SkipBitUi32s(CSzData *sd, UInt32 numItems) in SkipBitUi32s() argument
427 RINOK(SzReadByte(sd, &allAreDefined)); in SkipBitUi32s()
431 if (numBytes > sd->Size) in SkipBitUi32s()
433 numDefined = CountDefinedBits(sd->Data, numItems); in SkipBitUi32s()
434 SKIP_DATA(sd, numBytes); in SkipBitUi32s()
436 if (numDefined > (sd->Size >> 2)) in SkipBitUi32s()
438 SKIP_DATA(sd, (size_t)numDefined * 4); in SkipBitUi32s()
442 static SRes ReadPackInfo(CSzAr *p, CSzData *sd, ISzAlloc *alloc) in ReadPackInfo() argument
444 RINOK(SzReadNumber32(sd, &p->NumPackStreams)); in ReadPackInfo()
446 RINOK(WaitId(sd, k7zIdSize)); in ReadPackInfo()
456 RINOK(ReadNumber(sd, &packSize)); in ReadPackInfo()
467 RINOK(ReadID(sd, &type)); in ReadPackInfo()
473 RINOK(SkipBitUi32s(sd, p->NumPackStreams)); in ReadPackInfo()
476 RINOK(SkipData(sd)); in ReadPackInfo()
491 SRes SzGetNextFolderItem(CSzFolder *f, CSzData *sd, CSzData *sdSizes) in SzGetNextFolderItem() argument
495 const Byte *dataStart = sd->Data; in SzGetNextFolderItem()
498 RINOK(SzReadNumber32(sd, &numCoders)); in SzGetNextFolderItem()
509 RINOK(SzReadByte(sd, &mainByte)); in SzGetNextFolderItem()
515 if (idSize > sd->Size) in SzGetNextFolderItem()
520 id = ((id << 8) | *sd->Data); in SzGetNextFolderItem()
521 sd->Data++; in SzGetNextFolderItem()
522 sd->Size--; in SzGetNextFolderItem()
536 RINOK(SzReadNumber32(sd, &numStreams)); in SzGetNextFolderItem()
540 RINOK(SzReadNumber32(sd, &numStreams)); in SzGetNextFolderItem()
548 RINOK(SzReadNumber32(sd, &propsSize)); in SzGetNextFolderItem()
551 if (propsSize > sd->Size) in SzGetNextFolderItem()
553 coder->PropsOffset = sd->Data - dataStart; in SzGetNextFolderItem()
555 sd->Data += (size_t)propsSize; in SzGetNextFolderItem()
556 sd->Size -= (size_t)propsSize; in SzGetNextFolderItem()
589 RINOK(SzReadNumber32(sd, &bp->InIndex)); in SzGetNextFolderItem()
593 RINOK(SzReadNumber32(sd, &bp->OutIndex)); in SzGetNextFolderItem()
620 RINOK(SzReadNumber32(sd, f->PackStreams + i)); in SzGetNextFolderItem()
633 CSzData sd; in SkipNumbers() local
634 sd = *sd2; in SkipNumbers()
644 if (sd.Size == 0) in SkipNumbers()
646 sd.Size--; in SkipNumbers()
647 sd.Data++; in SkipNumbers()
653 if (i > sd.Size) in SkipNumbers()
655 SKIP_DATA2(sd, i); in SkipNumbers()
657 *sd2 = sd; in SkipNumbers()
669 CSzData sd; in ReadUnpackInfo() local
684 sd = *sd2; in ReadUnpackInfo()
691 sd.Data = tempBufs[index].data; in ReadUnpackInfo()
692 sd.Size = tempBufs[index].size; in ReadUnpackInfo()
699 startBufPtr = sd.Data; in ReadUnpackInfo()
708 p->FoCodersOffsets[fo] = sd.Data - startBufPtr; in ReadUnpackInfo()
709 RINOK(SzReadNumber32(&sd, &numCoders)); in ReadUnpackInfo()
725 if (idSize > sd.Size) in ReadUnpackInfo()
727 SKIP_DATA2(sd, idSize); in ReadUnpackInfo()
733 RINOK(SzReadNumber32(&sd, &coderInStreams)); in ReadUnpackInfo()
734 RINOK(SzReadNumber32(&sd, &coderOutStreams)); in ReadUnpackInfo()
744 RINOK(SzReadNumber32(&sd, &propsSize)); in ReadUnpackInfo()
745 if (propsSize > sd.Size) in ReadUnpackInfo()
747 SKIP_DATA2(sd, propsSize); in ReadUnpackInfo()
773 RINOK(SzReadNumber32(&sd, &index)); in ReadUnpackInfo()
777 RINOK(SzReadNumber32(&sd, &index)); in ReadUnpackInfo()
789 RINOK(SzReadNumber32(&sd, &temp)); in ReadUnpackInfo()
818 size_t dataSize = sd.Data - startBufPtr; in ReadUnpackInfo()
827 if (sd.Size != 0) in ReadUnpackInfo()
829 sd = *sd2; in ReadUnpackInfo()
832 RINOK(WaitId(&sd, k7zIdCodersUnpackSize)); in ReadUnpackInfo()
836 size_t dataSize = sd.Size; in ReadUnpackInfo()
844 RINOK(SkipNumbers(&sd, numCodersOutStreams)); in ReadUnpackInfo()
845 dataSize -= sd.Size; in ReadUnpackInfo()
847 memcpy(p->UnpackSizesData, sd.Data - dataSize, dataSize); in ReadUnpackInfo()
861 RINOK(ReadID(&sd, &type)); in ReadUnpackInfo()
864 *sd2 = sd; in ReadUnpackInfo()
869 RINOK(ReadBitUi32s(&sd, numFolders, &p->FolderCRCs, alloc)); in ReadUnpackInfo()
872 RINOK(SkipData(&sd)); in ReadUnpackInfo()
887 static SRes ReadSubStreamsInfo(CSzAr *p, CSzData *sd, CSubStreamInfo *ssi) in ReadSubStreamsInfo() argument
898 RINOK(ReadID(sd, &type)); in ReadSubStreamsInfo()
901 ssi->sdNumSubStreams.Data = sd->Data; in ReadSubStreamsInfo()
907 RINOK(SzReadNumber32(sd, &numStreams)); in ReadSubStreamsInfo()
916 ssi->sdNumSubStreams.Size = sd->Data - ssi->sdNumSubStreams.Data; in ReadSubStreamsInfo()
921 RINOK(SkipData(sd)); in ReadSubStreamsInfo()
936 ssi->sdSizes.Data = sd->Data; in ReadSubStreamsInfo()
937 RINOK(SkipNumbers(sd, numUnpackSizesInData)); in ReadSubStreamsInfo()
938 ssi->sdSizes.Size = sd->Data - ssi->sdSizes.Data; in ReadSubStreamsInfo()
939 RINOK(ReadID(sd, &type)); in ReadSubStreamsInfo()
948 ssi->sdCRCs.Data = sd->Data; in ReadSubStreamsInfo()
949 RINOK(SkipBitUi32s(sd, numSubDigests)); in ReadSubStreamsInfo()
950 ssi->sdCRCs.Size = sd->Data - ssi->sdCRCs.Data; in ReadSubStreamsInfo()
954 RINOK(SkipData(sd)); in ReadSubStreamsInfo()
956 RINOK(ReadID(sd, &type)); in ReadSubStreamsInfo()
961 CSzData *sd, in SzReadStreamsInfo() argument
974 RINOK(ReadID(sd, &type)); in SzReadStreamsInfo()
977 RINOK(ReadNumber(sd, dataOffset)); in SzReadStreamsInfo()
978 RINOK(ReadPackInfo(p, sd, alloc)); in SzReadStreamsInfo()
979 RINOK(ReadID(sd, &type)); in SzReadStreamsInfo()
983 RINOK(ReadUnpackInfo(p, sd, numFoldersMax, tempBufs, numTempBufs, alloc)); in SzReadStreamsInfo()
984 RINOK(ReadID(sd, &type)); in SzReadStreamsInfo()
988 RINOK(ReadSubStreamsInfo(p, sd, ssi)); in SzReadStreamsInfo()
989 RINOK(ReadID(sd, &type)); in SzReadStreamsInfo()
1002 CSzData *sd, in SzReadAndDecodePackedStreams() argument
1014 RINOK(SzReadStreamsInfo(p, sd, numFoldersMax, NULL, 0, &dataStartPos, &ssi, allocTemp)); in SzReadAndDecodePackedStreams()
1098 CSzData sd; in ReadTime() local
1106 sd = *sd2; in ReadTime()
1113 sd.Data = tempBufs[index].data; in ReadTime()
1114 sd.Size = tempBufs[index].size; in ReadTime()
1122 if (sd.Size < 8) in ReadTime()
1124 vals[i].Low = GetUi32(sd.Data); in ReadTime()
1125 vals[i].High = GetUi32(sd.Data + 4); in ReadTime()
1126 SKIP_DATA2(sd, 8); in ReadTime()
1131 *sd2 = sd; in ReadTime()
1139 CSzData *sd, in SzReadHeader2() argument
1165 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1172 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1175 RINOK(SkipData(sd)); in SzReadHeader2()
1177 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1189 res = SzReadAndDecodePackedStreams(inStream, sd, tempBufs, NUM_ADDITIONAL_STREAMS_MAX, in SzReadHeader2()
1196 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1201 RINOK(SzReadStreamsInfo(&p->db, sd, (UInt32)1 << 30, tempBufs, *numTempBufs, in SzReadHeader2()
1204 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1215 RINOK(SzReadNumber32(sd, &numFiles)); in SzReadHeader2()
1222 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1225 RINOK(ReadNumber(sd, &size)); in SzReadHeader2()
1226 if (size > sd->Size) in SzReadHeader2()
1230 SKIP_DATA(sd, size); in SzReadHeader2()
1244 namesData = sd->Data; in SzReadHeader2()
1249 SzReadNumber32(sd, &index); in SzReadHeader2()
1264 SKIP_DATA(sd, namesSize); in SzReadHeader2()
1270 RINOK(RememberBitVector(sd, numFiles, &emptyStreams)); in SzReadHeader2()
1276 RINOK(RememberBitVector(sd, numEmptyStreams, &emptyFiles)); in SzReadHeader2()
1285 RINOK(ReadBitVector(sd, numFiles, &p->Attribs.Defs, allocMain)); in SzReadHeader2()
1289 sdPtr = sd; in SzReadHeader2()
1293 SzReadNumber32(sd, &index); in SzReadHeader2()
1313 …case k7zIdMTime: RINOK(ReadTime(&p->MTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); brea… in SzReadHeader2()
1314 …case k7zIdCTime: RINOK(ReadTime(&p->CTime, numFiles, sd, tempBufs, *numTempBufs, allocMain)); brea… in SzReadHeader2()
1317 SKIP_DATA(sd, size); in SzReadHeader2()
1328 RINOK(ReadID(sd, &type)); in SzReadHeader2()
1331 RINOK(SkipData(sd)); in SzReadHeader2()
1503 CSzData *sd, in SzReadHeader() argument
1521 res = SzReadHeader2(p, sd, in SzReadHeader()
1539 if (sd->Size != 0) in SzReadHeader()
1630 CSzData sd; in SzArEx_Open2() local
1632 sd.Data = buf.data; in SzArEx_Open2()
1633 sd.Size = buf.size; in SzArEx_Open2()
1634 res = ReadID(&sd, &type); in SzArEx_Open2()
1642 …res = SzReadAndDecodePackedStreams(inStream, &sd, &tempBuf, 1, p->startPosAfterHeader, &tempAr, al… in SzArEx_Open2()
1654 sd.Data = buf.data; in SzArEx_Open2()
1655 sd.Size = buf.size; in SzArEx_Open2()
1656 res = ReadID(&sd, &type); in SzArEx_Open2()
1669 sd2 = sd; in SzArEx_Open2()