Lines Matching refs:sz
179 static int pull_job_write_uncompressed(const void *p, size_t sz, void *userdata) {
186 if (sz <= 0)
189 if (j->written_uncompressed + sz < j->written_uncompressed) {
194 if (j->written_uncompressed + sz > j->uncompressed_max) {
207 n = sparse_write(j->disk_fd, p, sz, 64);
209 n = write(j->disk_fd, p, sz);
212 if ((size_t) n < sz) {
218 if (!GREEDY_REALLOC(j->payload, j->payload_allocated, j->payload_size + sz))
221 memcpy(j->payload + j->payload_size, p, sz);
222 j->payload_size += sz;
225 j->written_uncompressed += sz;
226 j->written_since_last_grow += sz;
231 static int pull_job_write_compressed(PullJob *j, void *p, size_t sz) {
237 if (sz <= 0)
240 if (j->written_compressed + sz < j->written_compressed) {
245 if (j->written_compressed + sz > j->compressed_max) {
251 j->written_compressed + sz > j->content_length) {
257 gcry_md_write(j->checksum_context, p, sz);
259 r = import_uncompress(&j->compress, p, sz, pull_job_write_uncompressed, j);
263 j->written_compressed += sz;
341 size_t sz = size * nmemb;
352 if (!GREEDY_REALLOC(j->payload, j->payload_allocated, j->payload_size + sz)) {
357 memcpy(j->payload + j->payload_size, contents, sz);
358 j->payload_size += sz;
368 r = pull_job_write_compressed(j, contents, sz);
383 return sz;
392 size_t sz = size * nmemb;
407 r = curl_header_strdup(contents, sz, "ETag:", &etag);
420 return sz;
423 return sz;
426 r = curl_header_strdup(contents, sz, "Content-Length:", &length);
446 return sz;
449 r = curl_header_strdup(contents, sz, "Last-Modified:", &last_modified);
456 return sz;
460 r = j->on_header(j, contents, sz);
465 return sz;