Skip to content

Commit df24ae0

Browse files
remove gratuitous ULL
1 parent 1120b5a commit df24ae0

1 file changed

Lines changed: 22 additions & 22 deletions

File tree

src/installer/gpt_writer.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ bool install_gpt_esp_rfs_whole_image(const char *devname, const char *esp_image_
4040

4141
/* The file on disk is gzip-compressed. Read ISIZE (last 4 bytes, little-endian)
4242
to discover the uncompressed size (mod 2^32). Our images are < 4 GiB. */
43-
if (img_ent->size < 18ULL) { /* minimal gzip with empty deflate is > this; also guards reads below */
43+
if (img_ent->size < 18) { /* minimal gzip with empty deflate is > this; also guards reads below */
4444
error_page("ESP gzip image too small or corrupt");
4545
}
4646
uint8_t isize_le[4];
47-
if (!fs_read_file(img_ent, (uint32_t)(img_ent->size - 4ULL), 4U, isize_le)) {
47+
if (!fs_read_file(img_ent, (uint32_t)(img_ent->size - 4ULL), 4, isize_le)) {
4848
error_page("failed to read gzip ISIZE: %s", fs_strerror(fs_get_error()));
4949
}
5050
uint64_t esp_bytes =
@@ -53,40 +53,40 @@ bool install_gpt_esp_rfs_whole_image(const char *devname, const char *esp_image_
5353
((uint64_t)isize_le[2] << 16) |
5454
((uint64_t)isize_le[3] << 24);
5555

56-
if (esp_bytes == 0ULL) {
56+
if (esp_bytes == 0) {
5757
error_page("ESP image uncompressed size is zero (corrupt gzip?)");
5858
}
59-
if (esp_bytes > 0xFFFFFFFFULL) {
59+
if (esp_bytes > 0xFFFFFFFF) {
6060
error_page("ESP image too large for single-file logic");
6161
}
6262

63-
const uint64_t esp_sectors = (esp_bytes + (uint64_t)sector_bytes - 1ULL) / (uint64_t)sector_bytes;
63+
const uint64_t esp_sectors = (esp_bytes + (uint64_t)sector_bytes - 1) / (uint64_t)sector_bytes;
6464

6565
/* --- GPT layout --- */
6666
const uint32_t ptes_bytes_total = GPT_PTE_COUNT * GPT_PTE_SIZE_BYTES;
67-
const uint64_t ptes_sectors = (ptes_bytes_total + sector_bytes - 1U) / sector_bytes;
67+
const uint64_t ptes_sectors = (ptes_bytes_total + sector_bytes - 1) / sector_bytes;
6868

69-
const uint64_t primary_header_lba = 1ULL;
70-
const uint64_t primary_ptes_lba = 2ULL;
71-
const uint64_t backup_ptes_lba = last_lba - ptes_sectors + 1ULL;
69+
const uint64_t primary_header_lba = 1;
70+
const uint64_t primary_ptes_lba = 2;
71+
const uint64_t backup_ptes_lba = last_lba - ptes_sectors + 1;
7272
const uint64_t backup_header_lba = last_lba;
7373

7474
uint64_t first_usable = primary_ptes_lba + ptes_sectors;
75-
if (first_usable < 34ULL) {
76-
first_usable = 34ULL;
75+
if (first_usable < 34) {
76+
first_usable = 34;
7777
}
7878
first_usable = align_up_u64(first_usable, ALIGN_1M_IN_LBAS);
7979

80-
const uint64_t last_usable = backup_ptes_lba - 1ULL;
80+
const uint64_t last_usable = backup_ptes_lba - 1;
8181

8282
const uint64_t esp_first_lba = first_usable;
83-
const uint64_t esp_last_lba = esp_first_lba + esp_sectors - 1ULL;
83+
const uint64_t esp_last_lba = esp_first_lba + esp_sectors - 1;
8484

8585
if (esp_last_lba >= last_usable) {
8686
error_page("disk too small for ESP (%lu sectors ESP, esp_last_lba=%lu last_usable=%lu)", esp_sectors, esp_last_lba, last_usable);
8787
}
8888

89-
uint64_t rfs_first_lba = align_up_u64(esp_last_lba + 1ULL, ALIGN_1M_IN_LBAS);
89+
uint64_t rfs_first_lba = align_up_u64(esp_last_lba + 1, ALIGN_1M_IN_LBAS);
9090
if (rfs_first_lba > last_usable) {
9191
error_page("no room for RFS after ESP");
9292
}
@@ -106,7 +106,7 @@ bool install_gpt_esp_rfs_whole_image(const char *devname, const char *esp_image_
106106
mbr[510] = 0x55;
107107
mbr[511] = 0xAA;
108108

109-
if (!write_lbas(devname, 0ULL, mbr, sizeof(mbr), sector_bytes)) {
109+
if (!write_lbas(devname, 0, mbr, sizeof(mbr), sector_bytes)) {
110110
error_page("write protective MBR failed");
111111
}
112112

@@ -187,9 +187,9 @@ bool install_gpt_esp_rfs_whole_image(const char *devname, const char *esp_image_
187187
uint32_t esp_buf_len = 0;
188188

189189
uint64_t out_lba = esp_first_lba;
190-
uint64_t out_bytes = 0ULL;
191-
uint64_t steps = 0ULL;
192-
uint64_t read_offset = 0ULL;
190+
uint64_t out_bytes = 0;
191+
uint64_t steps = 0;
192+
uint64_t read_offset = 0;
193193

194194
display_progress("Installing recovery/boot image (step 1 of 3)", 0);
195195

@@ -246,9 +246,9 @@ bool install_gpt_esp_rfs_whole_image(const char *devname, const char *esp_image_
246246
out_bytes += chunk_bytes;
247247
esp_buf_len = 0;
248248

249-
if (steps++ % 25ULL == 0ULL) {
249+
if (steps++ % 25 == 0) {
250250
/* Progress by uncompressed bytes; capped at 100% */
251-
uint64_t pct = (out_bytes >= esp_bytes) ? 100ULL : ((out_bytes * 100ULL) / esp_bytes);
251+
uint64_t pct = (out_bytes >= esp_bytes) ? 100 : ((out_bytes * 100) / esp_bytes);
252252
display_progress("Installing recovery/boot image (step 1 of 3)", pct);
253253
}
254254
}
@@ -262,10 +262,10 @@ bool install_gpt_esp_rfs_whole_image(const char *devname, const char *esp_image_
262262
}
263263

264264
/* Flush any remaining decompressed bytes (pad to sector boundary) */
265-
if (esp_buf_len > 0U) {
265+
if (esp_buf_len > 0) {
266266
/* Pad zeros up to next sector boundary for the final write */
267267
uint32_t pad = (uint32_t)(esp_buf_len % sector_bytes);
268-
if (pad != 0U) {
268+
if (pad != 0) {
269269
uint32_t to_add = sector_bytes - pad;
270270
memset(esp_buffer + esp_buf_len, 0, to_add);
271271
esp_buf_len += to_add;

0 commit comments

Comments
 (0)