mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
Merge pull request #18891 from keszybz/size_t-cast-removal
size_t cast removal
This commit is contained in:
commit
47f9f84ca9
@ -5,7 +5,7 @@
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#define AUDIT_SESSION_INVALID (UINT32_MAX)
|
||||
#define AUDIT_SESSION_INVALID UINT32_MAX
|
||||
|
||||
int audit_session_from_pid(pid_t pid, uint32_t *id);
|
||||
int audit_loginuid_from_pid(pid_t pid, uid_t *uid);
|
||||
|
@ -75,13 +75,13 @@ CGroupMask get_cpu_accounting_mask(void);
|
||||
bool cpu_accounting_is_cheap(void);
|
||||
|
||||
/* Special values for all weight knobs on unified hierarchy */
|
||||
#define CGROUP_WEIGHT_INVALID (UINT64_MAX)
|
||||
#define CGROUP_WEIGHT_INVALID UINT64_MAX
|
||||
#define CGROUP_WEIGHT_MIN UINT64_C(1)
|
||||
#define CGROUP_WEIGHT_MAX UINT64_C(10000)
|
||||
#define CGROUP_WEIGHT_DEFAULT UINT64_C(100)
|
||||
|
||||
#define CGROUP_LIMIT_MIN UINT64_C(0)
|
||||
#define CGROUP_LIMIT_MAX (UINT64_MAX)
|
||||
#define CGROUP_LIMIT_MAX UINT64_MAX
|
||||
|
||||
static inline bool CGROUP_WEIGHT_IS_OK(uint64_t x) {
|
||||
return
|
||||
@ -106,7 +106,7 @@ const char* cgroup_io_limit_type_to_string(CGroupIOLimitType t) _const_;
|
||||
CGroupIOLimitType cgroup_io_limit_type_from_string(const char *s) _pure_;
|
||||
|
||||
/* Special values for the cpu.shares attribute */
|
||||
#define CGROUP_CPU_SHARES_INVALID (UINT64_MAX)
|
||||
#define CGROUP_CPU_SHARES_INVALID UINT64_MAX
|
||||
#define CGROUP_CPU_SHARES_MIN UINT64_C(2)
|
||||
#define CGROUP_CPU_SHARES_MAX UINT64_C(262144)
|
||||
#define CGROUP_CPU_SHARES_DEFAULT UINT64_C(1024)
|
||||
@ -118,7 +118,7 @@ static inline bool CGROUP_CPU_SHARES_IS_OK(uint64_t x) {
|
||||
}
|
||||
|
||||
/* Special values for the blkio.weight attribute */
|
||||
#define CGROUP_BLKIO_WEIGHT_INVALID (UINT64_MAX)
|
||||
#define CGROUP_BLKIO_WEIGHT_INVALID UINT64_MAX
|
||||
#define CGROUP_BLKIO_WEIGHT_MIN UINT64_C(10)
|
||||
#define CGROUP_BLKIO_WEIGHT_MAX UINT64_C(1000)
|
||||
#define CGROUP_BLKIO_WEIGHT_DEFAULT UINT64_C(500)
|
||||
|
@ -71,7 +71,7 @@ char *strnappend(const char *s, const char *suffix, size_t b) {
|
||||
assert(suffix);
|
||||
|
||||
a = strlen(s);
|
||||
if (b > (SIZE_MAX) - a)
|
||||
if (b > SIZE_MAX - a)
|
||||
return NULL;
|
||||
|
||||
r = new(char, a+b+1);
|
||||
|
@ -161,8 +161,7 @@ static void *message_extend_fields(sd_bus_message *m, size_t align, size_t sz, b
|
||||
start = ALIGN_TO(old_size, align);
|
||||
new_size = start + sz;
|
||||
|
||||
if (new_size < start ||
|
||||
new_size > (size_t) (UINT32_MAX))
|
||||
if (new_size < start || new_size > UINT32_MAX)
|
||||
goto poison;
|
||||
|
||||
if (old_size == new_size)
|
||||
@ -1337,8 +1336,7 @@ static void *message_extend_body(
|
||||
added = padding + sz;
|
||||
|
||||
/* Check for 32bit overflows */
|
||||
if (end_body > (size_t) (UINT32_MAX) ||
|
||||
end_body < start_body) {
|
||||
if (end_body < start_body || end_body > UINT32_MAX) {
|
||||
m->poisoned = true;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -323,12 +323,8 @@ int manager_new(Manager **ret, Hashmap *interfaces, char **ignore,
|
||||
(void) sd_event_add_signal(m->event, NULL, SIGINT, NULL, NULL);
|
||||
|
||||
if (timeout > 0) {
|
||||
usec_t usec;
|
||||
|
||||
usec = usec_add(now(clock_boottime_or_monotonic()), timeout);
|
||||
|
||||
r = sd_event_add_time(m->event, NULL, clock_boottime_or_monotonic(), usec, 0, NULL, INT_TO_PTR(-ETIMEDOUT));
|
||||
if (r < 0)
|
||||
r = sd_event_add_time_relative(m->event, NULL, clock_boottime_or_monotonic(), timeout, 0, NULL, INT_TO_PTR(-ETIMEDOUT));
|
||||
if (r < 0 && r != -EOVERFLOW)
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -102,9 +102,9 @@ void table_set_cell_height_max(Table *t, size_t height);
|
||||
int table_set_empty_string(Table *t, const char *empty);
|
||||
int table_set_display_all(Table *t);
|
||||
int table_set_display_internal(Table *t, size_t first_column, ...);
|
||||
#define table_set_display(...) table_set_display_internal(__VA_ARGS__, (size_t) SIZE_MAX)
|
||||
#define table_set_display(...) table_set_display_internal(__VA_ARGS__, SIZE_MAX)
|
||||
int table_set_sort_internal(Table *t, size_t first_column, ...);
|
||||
#define table_set_sort(...) table_set_sort_internal(__VA_ARGS__, (size_t) SIZE_MAX)
|
||||
#define table_set_sort(...) table_set_sort_internal(__VA_ARGS__, SIZE_MAX)
|
||||
int table_set_reverse(Table *t, size_t column, bool b);
|
||||
int table_hide_column_from_display(Table *t, size_t column);
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
CLONE_NEWUSER| \
|
||||
CLONE_NEWUTS))
|
||||
|
||||
#define NAMESPACE_FLAGS_INITIAL (ULONG_MAX)
|
||||
#define NAMESPACE_FLAGS_INITIAL ULONG_MAX
|
||||
|
||||
int namespace_flags_from_string(const char *name, unsigned long *ret);
|
||||
int namespace_flags_to_string(unsigned long flags, char **ret);
|
||||
|
@ -81,7 +81,7 @@ enum {
|
||||
SD_LLDP_SYSTEM_CAPABILITIES_TPMR = 1 << 10,
|
||||
};
|
||||
|
||||
#define SD_LLDP_SYSTEM_CAPABILITIES_ALL (UINT16_MAX)
|
||||
#define SD_LLDP_SYSTEM_CAPABILITIES_ALL UINT16_MAX
|
||||
|
||||
#define SD_LLDP_SYSTEM_CAPABILITIES_ALL_ROUTERS \
|
||||
((uint16_t) \
|
||||
|
Loading…
Reference in New Issue
Block a user