if (entry->call)
Print(L"internal call yes\n");
- if (entry->tries_left != (UINTN) -1)
+ if (entry->tries_left != UINTN_MAX)
Print(L"counting boots yes\n"
"tries done %u\n"
"tries left %u\n"
CHAR16 *file,
CHAR16 *suffix) {
- UINTN left = (UINTN) -1, done = (UINTN) -1, factor = 1, i, next_left, next_done;
+ UINTN left = UINTN_MAX, done = UINTN_MAX, factor = 1, i, next_left, next_done;
_cleanup_freepool_ CHAR16 *prefix = NULL;
/*
switch (file[i]) {
case '+':
- if (left == (UINTN) -1) /* didn't read at least one digit for 'left'? */
+ if (left == UINTN_MAX) /* didn't read at least one digit for 'left'? */
return;
- if (done == (UINTN) -1) /* no 'done' counter? If so, it's equivalent to 0 */
+ if (done == UINTN_MAX) /* no 'done' counter? If so, it's equivalent to 0 */
done = 0;
goto good;
case '-':
- if (left == (UINTN) -1) /* didn't parse any digit yet? */
+ if (left == UINTN_MAX) /* didn't parse any digit yet? */
return;
- if (done != (UINTN) -1) /* already encountered a dash earlier? */
+ if (done != UINTN_MAX) /* already encountered a dash earlier? */
return;
/* So we encountered a dash. This means this counter is of the form +LEFT-DONE. Let's assign
* what we already parsed to 'done', and start fresh for the 'left' part. */
done = left;
- left = (UINTN) -1;
+ left = UINTN_MAX;
factor = 1;
break;
case '0'...'9': {
UINTN new_factor;
- if (left == (UINTN) -1)
+ if (left == UINTN_MAX)
left = file[i] - '0';
else {
UINTN new_left, digit;
digit = file[i] - '0';
- if (digit > (UINTN) -1 / factor) /* overflow check */
+ if (digit > UINTN_MAX / factor) /* overflow check */
return;
new_left = left + digit * factor;
if (new_left < left) /* overflow check */
return;
- if (new_left == (UINTN) -1) /* don't allow us to be confused */
+ if (new_left == UINTN_MAX) /* don't allow us to be confused */
return;
}
UINTN file_info_size, a, b;
EFI_STATUS r;
- if (entry->tries_left == (UINTN) -1)
+ if (entry->tries_left == UINTN_MAX)
return;
if (!entry->path || !entry->current_name || !entry->next_name)
entry = AllocatePool(sizeof(ConfigEntry));
*entry = (ConfigEntry) {
- .tries_done = (UINTN) -1,
- .tries_left = (UINTN) -1,
+ .tries_done = UINTN_MAX,
+ .tries_left = UINTN_MAX,
};
while ((line = line_get_key_value(content, (CHAR8 *)" \t", &pos, &key, &value))) {
if (r != 0)
return r;
- if (a->tries_left == (UINTN) -1 ||
- b->tries_left == (UINTN) -1)
+ if (a->tries_left == UINTN_MAX ||
+ b->tries_left == UINTN_MAX)
return 0;
/* If both items have boot counting, and otherwise are identical, put the entry with more tries left last */
.title = StrDuplicate(title),
.call = call,
.no_autoselect = TRUE,
- .tries_done = (UINTN) -1,
- .tries_left = (UINTN) -1,
+ .tries_done = UINTN_MAX,
+ .tries_left = UINTN_MAX,
};
config_add_entry(config, entry);
.loader = StrDuplicate(loader),
.id = StrDuplicate(id),
.key = key,
- .tries_done = (UINTN) -1,
- .tries_left = (UINTN) -1,
+ .tries_done = UINTN_MAX,
+ .tries_left = UINTN_MAX,
};
StrLwr(entry->id);
EFI_HANDLE *device) {
EFI_DEVICE_PATH *partition_path, *disk_path, *copy;
- UINT32 found_partition_number = (UINT32) -1;
- UINT64 found_partition_start = (UINT64) -1;
- UINT64 found_partition_size = (UINT64) -1;
+ UINT32 found_partition_number = UINT32_MAX;
+ UINT64 found_partition_start = UINT64_MAX;
+ UINT64 found_partition_size = UINT64_MAX;
UINT8 found_partition_signature[16] = {};
EFI_HANDLE new_device;
EFI_FILE *root_dir;
continue;
/* Calculate CRC check */
- c = ~crc32_exclude_offset((UINT32) -1,
+ c = ~crc32_exclude_offset(UINT32_MAX,
(const UINT8*) &gpt_header_buffer,
h->Header.HeaderSize,
OFFSETOF(EFI_PARTITION_TABLE_HEADER, Header.CRC32),
continue;
/* Calculate CRC of entries array, too */
- c = ~crc32((UINT32) -1, entries, sz);
+ c = ~crc32(UINT32_MAX, entries, sz);
if (c != h->PartitionEntryArrayCRC32)
continue;