Download raw body.
Fix off_t type mismatches
This addresses a number of warnings produced when compiling Got on FreeBSD and fixes off_t type mismatches. * off_t is a signed type. * Depending on the platform, off_t can be "long" or "long long", so cast to long long for printf(). OK? There may be an underlying type mismatch if pack file offsets are uint64_t but are handled in off_t variables, which are int64_t. As long as they refer to non-sparse files, I don't execpt that to be a practical problem anytime soon. diff refs/heads/main refs/heads/local commit - 4fa16b393ac52eadd8159d265e31961b11a10a25 commit + 1cca2e8cf4f81ebeea26b66ae740e8376b8a6f6b blob - 0674100de40bf388b34dec547fb8529e9ba5096a blob + 904fe2806d161dfaee79db5f0f3c73e691d3f4dc --- lib/deltify.c +++ lib/deltify.c @@ -523,8 +523,8 @@ stretchblk_file_mem(uint8_t *basedata, off_t base_offs if (base_offset > basefile_size) { return got_error_fmt(GOT_ERR_RANGE, - "read beyond the size of delta base at offset %llu", - base_offset); + "read beyond the size of delta base at offset %lld", + (long long)base_offset); } while (buf_equal && *blocklen < (1 << 24) - 1) { @@ -559,8 +559,8 @@ stretchblk_mem_file(FILE *basefile, off_t base_offset0 if (fileoffset > filesize) { return got_error_fmt(GOT_ERR_RANGE, - "read beyond the size of deltify file at offset %llu", - fileoffset); + "read beyond the size of deltify file at offset %lld", + (long long)fileoffset); } if (fseeko(basefile, base_offset0 + block->offset + *blocklen, @@ -599,14 +599,14 @@ stretchblk_mem_mem(uint8_t *basedata, off_t base_offse if (base_offset > basefile_size) { return got_error_fmt(GOT_ERR_RANGE, - "read beyond the size of delta base at offset %llu", - base_offset); + "read beyond the size of delta base at offset %lld", + (long long)base_offset); } if (fileoffset > filesize) { return got_error_fmt(GOT_ERR_RANGE, - "read beyond the size of deltify file at offset %llu", - fileoffset); + "read beyond the size of deltify file at offset %lld", + (long long)fileoffset); } p = data + fileoffset; blob - 57864428e7494edbd3e3308f2be2e34368445bf9 blob + 7319d5ef83b73fc2ce80bffde945fc06670f947f --- lib/pack.c +++ lib/pack.c @@ -1135,7 +1135,7 @@ resolve_ref_delta(struct got_delta_chain *deltas, stru return got_error(GOT_ERR_NO_OBJ); base_offset = got_packidx_get_object_offset(packidx, idx); - if (base_offset == (uint64_t)-1) + if (base_offset == -1) return got_error(GOT_ERR_BAD_PACKIDX); if (base_offset >= pack->filesize) @@ -1238,7 +1238,7 @@ got_packfile_open_object(struct got_object **obj, stru *obj = NULL; offset = got_packidx_get_object_offset(packidx, idx); - if (offset == (uint64_t)-1) + if (offset == -1) return got_error(GOT_ERR_BAD_PACKIDX); err = got_pack_parse_object_type_and_size(&type, &size, &tslen, @@ -1816,7 +1816,7 @@ got_packfile_extract_raw_delta(uint8_t **delta_buf, si *result_size = 0; offset = got_packidx_get_object_offset(packidx, idx); - if (offset == (uint64_t)-1) + if (offset == -1) return got_error(GOT_ERR_BAD_PACKIDX); if (offset >= pack->filesize) @@ -1846,8 +1846,8 @@ got_packfile_extract_raw_delta(uint8_t **delta_buf, si break; default: return got_error_fmt(GOT_ERR_OBJ_TYPE, - "non-delta object type %d found at offset %llu", - type, offset); + "non-delta object type %d found at offset %lld", + type, (long long)offset); } if (tslen + delta_hdrlen < delta_hdrlen || -- Christian "naddy" Weisgerber naddy@mips.inka.de
Fix off_t type mismatches