Lines Matching refs:sz
305 static int pull_job_write_uncompressed(const void *p, size_t sz, void *userdata) { in pull_job_write_uncompressed() argument
312 assert(sz > 0); in pull_job_write_uncompressed()
314 if (j->written_uncompressed > UINT64_MAX - sz) in pull_job_write_uncompressed()
322 if (j->written_uncompressed + sz > j->uncompressed_max) { in pull_job_write_uncompressed()
324 … sz = j->uncompressed_max - j->written_uncompressed; /* since we have the data in memory in pull_job_write_uncompressed()
334 n = sparse_write(j->disk_fd, p, sz, 64); in pull_job_write_uncompressed()
337 if ((size_t) n < sz) in pull_job_write_uncompressed()
340 r = loop_write(j->disk_fd, p, sz, false); in pull_job_write_uncompressed()
347 if (!GREEDY_REALLOC(j->payload, j->payload_size + sz)) in pull_job_write_uncompressed()
350 memcpy(j->payload + j->payload_size, p, sz); in pull_job_write_uncompressed()
351 j->payload_size += sz; in pull_job_write_uncompressed()
354 j->written_uncompressed += sz; in pull_job_write_uncompressed()
363 static int pull_job_write_compressed(PullJob *j, void *p, size_t sz) { in pull_job_write_compressed() argument
369 if (sz <= 0) in pull_job_write_compressed()
372 if (j->written_compressed + sz < j->written_compressed) in pull_job_write_compressed()
375 if (j->written_compressed + sz > j->compressed_max) in pull_job_write_compressed()
379 j->written_compressed + sz > j->content_length) in pull_job_write_compressed()
385 r = EVP_DigestUpdate(j->checksum_ctx, p, sz); in pull_job_write_compressed()
390 gcry_md_write(j->checksum_ctx, p, sz); in pull_job_write_compressed()
394 r = import_uncompress(&j->compress, p, sz, pull_job_write_uncompressed, j); in pull_job_write_compressed()
398 j->written_compressed += sz; in pull_job_write_compressed()
484 size_t sz = size * nmemb; in pull_job_write_callback() local
495 if (!GREEDY_REALLOC(j->payload, j->payload_size + sz)) { in pull_job_write_callback()
500 memcpy(j->payload + j->payload_size, contents, sz); in pull_job_write_callback()
501 j->payload_size += sz; in pull_job_write_callback()
511 r = pull_job_write_compressed(j, contents, sz); in pull_job_write_callback()
526 return sz; in pull_job_write_callback()
545 size_t sz = size * nmemb; in pull_job_header_callback() local
570 r = curl_header_strdup(contents, sz, "ETag:", &etag); in pull_job_header_callback()
582 return sz; in pull_job_header_callback()
585 return sz; in pull_job_header_callback()
591 return sz; in pull_job_header_callback()
593 r = curl_header_strdup(contents, sz, "Content-Length:", &length); in pull_job_header_callback()
610 return sz; in pull_job_header_callback()
613 r = curl_header_strdup(contents, sz, "Last-Modified:", &last_modified); in pull_job_header_callback()
620 return sz; in pull_job_header_callback()
624 r = j->on_header(j, contents, sz); in pull_job_header_callback()
629 return sz; in pull_job_header_callback()