tree-wide: use UINT64_MAX or friends

This commit is contained in:
Yu Watanabe
2021-03-05 07:10:13 +09:00
parent ef1e0b9a46
commit f5fbe71d95
150 changed files with 530 additions and 528 deletions
+1 -1
View File
@@ -95,7 +95,7 @@ int raw_export_new(
.input_fd = -1,
.on_finished = on_finished,
.userdata = userdata,
.last_percent = (unsigned) -1,
.last_percent = UINT_MAX,
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
};
+4 -4
View File
@@ -97,8 +97,8 @@ int tar_export_new(
.tar_fd = -1,
.on_finished = on_finished,
.userdata = userdata,
.quota_referenced = (uint64_t) -1,
.last_percent = (unsigned) -1,
.quota_referenced = UINT64_MAX,
.last_percent = UINT_MAX,
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
};
@@ -120,7 +120,7 @@ static void tar_export_report_progress(TarExport *e) {
assert(e);
/* Do we have any quota info? If not, we don't know anything about the progress */
if (e->quota_referenced == (uint64_t) -1)
if (e->quota_referenced == UINT64_MAX)
return;
if (e->written_uncompressed >= e->quota_referenced)
@@ -281,7 +281,7 @@ int tar_export_start(TarExport *e, const char *path, int fd, ImportCompressType
if (r < 0)
return r;
e->quota_referenced = (uint64_t) -1;
e->quota_referenced = UINT64_MAX;
if (btrfs_might_be_subvol(&e->st)) {
BtrfsQuotaInfo q;
+1 -1
View File
@@ -104,7 +104,7 @@ int raw_import_new(
.output_fd = -1,
.on_finished = on_finished,
.userdata = userdata,
.last_percent = (unsigned) -1,
.last_percent = UINT_MAX,
.image_root = TAKE_PTR(root),
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
};
+1 -1
View File
@@ -113,7 +113,7 @@ int tar_import_new(
.tar_fd = -1,
.on_finished = on_finished,
.userdata = userdata,
.last_percent = (unsigned) -1,
.last_percent = UINT_MAX,
.image_root = TAKE_PTR(root),
.progress_ratelimit = { 100 * USEC_PER_MSEC, 1 },
};
+2 -2
View File
@@ -161,7 +161,7 @@ static int transfer_new(Manager *m, Transfer **ret) {
.stdin_fd = -1,
.stdout_fd = -1,
.verify = _IMPORT_VERIFY_INVALID,
.progress_percent= (unsigned) -1,
.progress_percent= UINT_MAX,
};
id = m->current_transfer_id + 1;
@@ -186,7 +186,7 @@ static int transfer_new(Manager *m, Transfer **ret) {
static double transfer_percent_as_double(Transfer *t) {
assert(t);
if (t->progress_percent == (unsigned) -1)
if (t->progress_percent == UINT_MAX)
return -DBL_MAX;
return (double) t->progress_percent / 100.0;
+4 -4
View File
@@ -176,7 +176,7 @@ void pull_job_curl_on_finished(CurlGlue *g, CURL *curl, CURLcode result) {
goto finish;
}
if (j->content_length != (uint64_t) -1 &&
if (j->content_length != UINT64_MAX &&
j->content_length != j->written_compressed) {
log_error("Download truncated.");
r = -EIO;
@@ -293,7 +293,7 @@ static int pull_job_write_compressed(PullJob *j, void *p, size_t sz) {
if (j->written_compressed + sz > j->compressed_max)
return log_error_errno(SYNTHETIC_ERRNO(EFBIG), "File overly large, refusing.");
if (j->content_length != (uint64_t) -1 &&
if (j->content_length != UINT64_MAX &&
j->written_compressed + sz > j->content_length)
return log_error_errno(SYNTHETIC_ERRNO(EFBIG),
"Content length incorrect.");
@@ -502,7 +502,7 @@ static size_t pull_job_header_callback(void *contents, size_t size, size_t nmemb
if (r > 0) {
(void) safe_atou64(length, &j->content_length);
if (j->content_length != (uint64_t) -1) {
if (j->content_length != UINT64_MAX) {
char bytes[FORMAT_BYTES_MAX];
if (j->content_length > j->compressed_max) {
@@ -604,7 +604,7 @@ int pull_job_new(PullJob **ret, const char *url, CurlGlue *glue, void *userdata)
.disk_fd = -1,
.userdata = userdata,
.glue = glue,
.content_length = (uint64_t) -1,
.content_length = UINT64_MAX,
.start_usec = now(CLOCK_MONOTONIC),
.compressed_max = 64LLU * 1024LLU * 1024LLU * 1024LLU, /* 64GB safety limit */
.uncompressed_max = 64LLU * 1024LLU * 1024LLU * 1024LLU, /* 64GB safety limit */
+1 -1
View File
@@ -364,7 +364,7 @@ static int raw_pull_make_local_copy(RawPull *i) {
* since it reduces fragmentation caused by not allowing in-place writes. */
(void) import_set_nocow_and_log(dfd, tp);
r = copy_bytes(i->raw_job->disk_fd, dfd, (uint64_t) -1, COPY_REFLINK);
r = copy_bytes(i->raw_job->disk_fd, dfd, UINT64_MAX, COPY_REFLINK);
if (r < 0) {
(void) unlink(tp);
return log_error_errno(r, "Failed to make writable copy of image: %m");