Commit a1deff5
committed
decompressionobj: refactor decompress()
The loop termination logic and handling of `unused_data` was a bit
convoluted. The logic was subtle enough that it warrants documenting,
which I did in the CFFI backend.
We now only set `unused_data` after a frame is decoded. I'm not sure
if this actually changed meaningful behavior. But that is the semantic
intent of the attribute and we should have the logic mirror that.
We also change a loop termination condition to avoid a
`Zstd_decompressStream()` on input input in the case of a partially
filled output buffer. I believe this is safe per the zstd API docs.
One change here is we now append chunks before testing `zresult == 0`.
If chunk append raises, this could change behavior so we no longer mark
the decompressor as finalized. I believe the behavior was sufficiently
undefined to not explicitly document in the changelog. Hopefully
Hyrum's Law doesn't manifest.1 parent 30bf0bf commit a1deff5
File tree
4 files changed
+40
-26
lines changed- c-ext
- docs
- rust-ext/src
- zstandard
4 files changed
+40
-26
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | 72 | | |
77 | 73 | | |
78 | 74 | | |
| |||
93 | 89 | | |
94 | 90 | | |
95 | 91 | | |
96 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
97 | 95 | | |
98 | 96 | | |
99 | 97 | | |
100 | 98 | | |
101 | 99 | | |
102 | 100 | | |
103 | | - | |
104 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
105 | 107 | | |
106 | 108 | | |
107 | 109 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
94 | 98 | | |
95 | 99 | | |
96 | 100 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | 65 | | |
71 | 66 | | |
72 | 67 | | |
73 | 68 | | |
74 | 69 | | |
75 | 70 | | |
76 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
77 | 75 | | |
78 | 76 | | |
79 | 77 | | |
80 | 78 | | |
81 | 79 | | |
82 | 80 | | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
83 | 86 | | |
84 | | - | |
85 | | - | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2974 | 2974 | | |
2975 | 2975 | | |
2976 | 2976 | | |
2977 | | - | |
2978 | | - | |
2979 | | - | |
2980 | | - | |
| 2977 | + | |
2981 | 2978 | | |
2982 | 2979 | | |
2983 | 2980 | | |
2984 | | - | |
2985 | | - | |
2986 | | - | |
2987 | | - | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
| 2984 | + | |
| 2985 | + | |
| 2986 | + | |
2988 | 2987 | | |
2989 | | - | |
2990 | 2988 | | |
2991 | 2989 | | |
2992 | | - | |
| 2990 | + | |
| 2991 | + | |
| 2992 | + | |
| 2993 | + | |
| 2994 | + | |
| 2995 | + | |
| 2996 | + | |
| 2997 | + | |
| 2998 | + | |
| 2999 | + | |
2993 | 3000 | | |
2994 | 3001 | | |
2995 | 3002 | | |
| |||
0 commit comments