Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\zstd\decompress.c Create Date:2022-07-28 07:07:55
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:ZSTD_decompressStream

Proto:size_t ZSTD_decompressStream(ZSTD_DStream *zds, ZSTD_outBuffer *output, ZSTD_inBuffer *input)

Type:size_t

Parameter:

TypeParameterName
ZSTD_DStream *zds
ZSTD_outBuffer *output
ZSTD_inBuffer *input
2300  istart = src + pos
2301  iend = src + size
2302  ip = istart
2303  ostart = dst + pos
2304  oend = dst + size
2305  op = ostart
2306  someMoreWork = 1
2308  When someMoreWork cycle
2310  Case stage == zdss_init
2314  Case stage == zdss_loadHeader
2318  If hSize != 0 Then
2319  toLoad = hSize - lhSize
2320  If toLoad > iend - ip Then
2328  lhSize = hSize
2329  ip += toLoad
2330  Break
2334  If frameContentSize && windowSize && oend - op >= frameContentSize Then
2361  windowSize = MAX(windowSize, 1U << ZSTD_WINDOWLOG_ABSOLUTEMIN)
2362  If windowSize > maxWindowSize Then Return -***************************************** Error codes handling(frameParameter_windowTooLarge)
2367  blockSize = -************************************** shared macros(maxWindowSize, Define for static allocation )
2368  neededOutSize = maxWindowSize + blockSize + ! ZSTD_wildcopy() :* custom version of memcpy(), can copy up to 7 bytes too many (8 bytes if length==0) * 2
2369  If inBuffSize < blockSize Then
2372  If outBuffSize < neededOutSize Then
2375  blockSize = blockSize
2377  stage = zdss_read
2381  Case stage == zdss_read
2382  neededInSize = -*************************************** Advanced Streaming Decompression API* Bufferless and synchronous
2383  If neededInSize == 0 Then
2384  stage = zdss_init
2385  someMoreWork = 0
2386  Break
2388  If iend - ip >= neededInSize Then
2394  ip += neededInSize
2395  If Not decodedSize && Not isSkipFrame Then Break
2398  stage = zdss_flush
2399  Break
2401  If ip == iend Then
2402  someMoreWork = 0
2403  Break
2405  stage = zdss_load
2410  Case stage == zdss_load
2411  neededInSize = -*************************************** Advanced Streaming Decompression API* Bufferless and synchronous
2412  toLoad = neededInSize - inPos
2414  If toLoad > inBuffSize - inPos Then Return -***************************************** Error codes handling(corruption_detected)
2416  loadedSize = Decompression *****
2417  ip += loadedSize
2418  inPos += loadedSize
2419  If loadedSize < toLoad Then
2420  someMoreWork = 0
2421  Break
2431  inPos = 0
2432  If Not decodedSize && Not isSkipFrame Then
2433  stage = zdss_read
2434  Break
2437  stage = zdss_flush
2443  Case stage == zdss_flush
2444  toFlushSize = outEnd - outStart
2445  flushedSize = Decompression *****
2446  op += flushedSize
2447  outStart += flushedSize
2448  If flushedSize == toFlushSize Then
2449  stage = zdss_read
2450  If outStart + blockSize > outBuffSize Then outStart = outEnd = 0
2452  Break
2455  someMoreWork = 0
2456  Break
2458  Default
2459  Return -***************************************** Error codes handling(GENERIC)
2464  pos += ip - istart
2465  pos += op - ostart
2467  nextSrcSizeHint = -*************************************** Advanced Streaming Decompression API* Bufferless and synchronous
2468  If Not nextSrcSizeHint Then
2469  If outEnd == outStart Then
2470  If hostageByte Then
2471  If pos >= size Then
2472  stage = zdss_read
2473  Return 1
2475  pos++
2477  Return 0
2479  If Not hostageByte Then
2480  pos--
2481  hostageByte = 1
2483  Return 1
2485  nextSrcSizeHint += ZSTD_blockHeaderSize * (ZSTD_nextInputType(dctx) == ZSTDnit_block)
2486  If inPos > nextSrcSizeHint Then Return -***************************************** Error codes handling(GENERIC)
2488  nextSrcSizeHint -= inPos
2489  Return nextSrcSizeHint