MCPcopy Create free account
hub / github.com/git/git / unpack_loose_header

Function unpack_loose_header

object-file.c:168–200  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168enum unpack_loose_header_result unpack_loose_header(git_zstream *stream,
169 unsigned char *map,
170 unsigned long mapsize,
171 void *buffer,
172 unsigned long bufsiz)
173{
174 int status;
175
176 /* Get the data stream */
177 memset(stream, 0, sizeof(*stream));
178 stream->next_in = map;
179 stream->avail_in = mapsize;
180 stream->next_out = buffer;
181 stream->avail_out = bufsiz;
182
183 git_inflate_init(stream);
184 obj_read_unlock();
185 status = git_inflate(stream, 0);
186 obj_read_lock();
187 if (status != Z_OK && status != Z_STREAM_END)
188 return ULHR_BAD;
189
190 /*
191 * Check if entire header is unpacked in the first iteration.
192 */
193 if (memchr(buffer, '\0', stream->next_out - (unsigned char *)buffer))
194 return ULHR_OK;
195
196 /*
197 * We have a header longer than MAX_HEADER_LEN.
198 */
199 return ULHR_TOO_LONG;
200}
201
202void *unpack_loose_rest(git_zstream *stream,
203 void *buffer, unsigned long size,

Callers 3

read_loose_objectFunction · 0.85

Calls 4

git_inflate_initFunction · 0.85
obj_read_unlockFunction · 0.85
git_inflateFunction · 0.85
obj_read_lockFunction · 0.85

Tested by

no test coverage detected