darwin: fix build warnings (#4073)

This commit is contained in:
小明 2023-07-13 05:03:36 +08:00 committed by GitHub
parent a939d643dd
commit 1230fad8f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -209,7 +209,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
if (cpuspeed == 0) if (cpuspeed == 0)
/* If sysctl hw.cputype == CPU_TYPE_ARM64, the correct value is unavailable /* If sysctl hw.cputype == CPU_TYPE_ARM64, the correct value is unavailable
* from Apple, but we can hard-code it here to a plausible value. */ * from Apple, but we can hard-code it here to a plausible value. */
cpuspeed = 2400000000; cpuspeed = 2400000000U;
if (host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &numcpus, if (host_processor_info(mach_host_self(), PROCESSOR_CPU_LOAD_INFO, &numcpus,
(processor_info_array_t*)&info, (processor_info_array_t*)&info,
@ -235,7 +235,7 @@ int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
cpu_info->cpu_times.irq = 0; cpu_info->cpu_times.irq = 0;
cpu_info->model = uv__strdup(model); cpu_info->model = uv__strdup(model);
cpu_info->speed = cpuspeed/1000000; cpu_info->speed = (int)(cpuspeed / 1000000);
} }
vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type); vm_deallocate(mach_task_self(), (vm_address_t)info, msg_type);