modeprint, modetest, proptest: cast __u64 to uint64_t

It seems that __u64 values are defined differently across systems. In
glibc it's defined as unsigned long, in Linux kernel headers
(int-ll64.h) as unsigned long long, and on FreeBSD as uint64_t so it
matches glibc. A temporal solution is to cast all __u64 values to
uint64_t to avoid warnings on Linux, but ideally we'd like a better fix
in the future.

See also: https://gitlab.freedesktop.org/mesa/drm/-/merge_requests/212
for discussion.

Signed-off-by: Eleni Maria Stea <elene.mst@gmail.com>
main
Eleni Maria Stea 2022-05-09 14:59:37 +03:00
parent c907d4ade1
commit 4caec56fb8
3 changed files with 3 additions and 3 deletions

View File

@ -113,7 +113,7 @@ static int printProperty(int fd, drmModeResPtr res, drmModePropertyPtr props, ui
} else { } else {
for (j = 0; j < props->count_enums; j++) { for (j = 0; j < props->count_enums; j++) {
printf("\t\t%" PRId64 " = %s\n", props->enums[j].value, props->enums[j].name); printf("\t\t%" PRId64" = %s\n", (uint64_t)props->enums[j].value, props->enums[j].name);
if (props->enums[j].value == value) if (props->enums[j].value == value)
name = props->enums[j].name; name = props->enums[j].name;
} }

View File

@ -376,7 +376,7 @@ static void dump_prop(struct device *dev, drmModePropertyPtr prop,
printf("\t\tenums:"); printf("\t\tenums:");
for (i = 0; i < prop->count_enums; i++) for (i = 0; i < prop->count_enums; i++)
printf(" %s=%"PRIu64, prop->enums[i].name, printf(" %s=%"PRIu64, prop->enums[i].name,
prop->enums[i].value); (uint64_t)prop->enums[i].value);
printf("\n"); printf("\n");
} else if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) { } else if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) {
printf("\t\tvalues:"); printf("\t\tvalues:");

View File

@ -127,7 +127,7 @@ dump_prop(uint32_t prop_id, uint64_t value)
printf("\t\tenums:"); printf("\t\tenums:");
for (i = 0; i < prop->count_enums; i++) for (i = 0; i < prop->count_enums; i++)
printf(" %s=%"PRIu64, prop->enums[i].name, printf(" %s=%"PRIu64, prop->enums[i].name,
prop->enums[i].value); (uint64_t)prop->enums[i].value);
printf("\n"); printf("\n");
} else if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) { } else if (drm_property_type_is(prop, DRM_MODE_PROP_BITMASK)) {
printf("\t\tvalues:"); printf("\t\tvalues:");