Skip to content

Commit

Permalink
refactor: use kCGErrorSuccess
Browse files Browse the repository at this point in the history
  • Loading branch information
mattjbray committed Aug 13, 2024
1 parent 174fd4b commit d80fec5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions core-graphics/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#![allow(non_upper_case_globals)]

use core_graphics_types::base::kCGErrorSuccess;
use libc;
use std::ops::Deref;
use std::ptr;
Expand Down Expand Up @@ -149,7 +150,7 @@ impl CGDisplay {
let result = unsafe {
CGGetDisplaysWithPoint(point, 0, ptr::null_mut(), &mut matching_display_count)
};
if result == 0 {
if result == kCGErrorSuccess {
Ok(matching_display_count)
} else {
Err(result)
Expand Down Expand Up @@ -177,7 +178,7 @@ impl CGDisplay {
)
};

if result == 0 {
if result == kCGErrorSuccess {
Ok((displays, matching_display_count))
} else {
Err(result)
Expand All @@ -191,7 +192,7 @@ impl CGDisplay {
let mut matching_display_count: u32 = 0;
let result =
unsafe { CGGetDisplaysWithRect(rect, 0, ptr::null_mut(), &mut matching_display_count) };
if result == 0 {
if result == kCGErrorSuccess {
Ok(matching_display_count)
} else {
Err(result)
Expand All @@ -218,7 +219,7 @@ impl CGDisplay {
)
};

if result == 0 {
if result == kCGErrorSuccess {
Ok((displays, matching_display_count))
} else {
Err(result)
Expand Down

0 comments on commit d80fec5

Please sign in to comment.