Mac: Fix implicit type cast errors with Xcode 14.1

This commit is contained in:
Marshall Greenblatt 2023-01-04 14:23:52 -05:00
parent 3af3eab3e4
commit 7ba45a0451
5 changed files with 19 additions and 17 deletions

View File

@ -194,7 +194,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
}
browser->GetHost()->SendMouseClickEvent(mouseEvent, type, isUp,
[event clickCount]);
static_cast<int>([event clickCount]));
}
- (void)mouseDown:(NSEvent*)event {
@ -362,7 +362,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
CefTouchEvent touch_event;
// NSTouch.identity is unique during the life of the touch
touch_event.id = touch.identity.hash;
touch_event.id = static_cast<int>(touch.identity.hash);
touch_event.type = [self getTouchPhase:phase];
NSPoint scaled_pos = [touch normalizedPosition];
@ -479,10 +479,10 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
CGEventRef cgEvent = [event CGEvent];
DCHECK(cgEvent);
int deltaX =
CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2);
int deltaY =
CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1);
int deltaX = static_cast<int>(
CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis2));
int deltaY = static_cast<int>(
CGEventGetIntegerValueField(cgEvent, kCGScrollWheelEventPointDeltaAxis1));
CefMouseEvent mouseEvent;
[self getMouseEvent:mouseEvent forEvent:event];
@ -654,7 +654,7 @@ NSPoint ConvertPointFromWindowToScreen(NSWindow* window, NSPoint point) {
mouseEvent.x = client::DeviceToLogical(point.x, device_scale_factor);
mouseEvent.y = client::DeviceToLogical(point.y, device_scale_factor);
mouseEvent.modifiers = [NSEvent modifierFlags];
mouseEvent.modifiers = static_cast<uint32>([NSEvent modifierFlags]);
}
- (int)getModifiersForEvent:(NSEvent*)event {

View File

@ -30,7 +30,7 @@ cef_color_t CefColorFromNSColor(NSColor* color) {
// third_party/WebKit/Source/WebKit/mac/WebView/WebHTMLView.mm
void ExtractUnderlines(NSAttributedString* string,
std::vector<CefCompositionUnderline>* underlines) {
int length = [[string string] length];
int length = static_cast<int>([[string string] length]);
int i = 0;
while (i < length) {
NSRange range;
@ -52,7 +52,7 @@ void ExtractUnderlines(NSAttributedString* string,
[style intValue] > 1};
underlines->push_back(line);
}
i = range.location + range.length;
i = static_cast<int>(range.location + range.length);
}
}
@ -131,7 +131,7 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
BOOL isAttributedString = [aString isKindOfClass:[NSAttributedString class]];
NSString* im_text = isAttributedString ? [aString string] : aString;
int length = [im_text length];
int length = static_cast<int>([im_text length]);
// |markedRange_| will get set in a callback from ImeSetComposition().
selectedRange_ = newSelRange;
@ -157,9 +157,10 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
static_cast<int>(replacementRange.location),
static_cast<int>(NSMaxRange(replacementRange))};
} else if (!handlingKeyDown_) {
CefRange replacement_range(replacementRange.location,
NSMaxRange(replacementRange));
CefRange selection_range(newSelRange.location, NSMaxRange(newSelRange));
CefRange replacement_range(static_cast<int>(replacementRange.location),
static_cast<int>(NSMaxRange(replacementRange)));
CefRange selection_range(static_cast<int>(newSelRange.location),
static_cast<int>(NSMaxRange(newSelRange)));
browser_->GetHost()->ImeSetComposition(markedText_, underlines_,
replacement_range, selection_range);
@ -316,7 +317,8 @@ extern NSString* NSTextInputReplacementRangeAttributeName;
// |selectedRange_| is the range being selected inside the marked text.
browser_->GetHost()->ImeSetComposition(
markedText_, underlines_, setMarkedTextReplacementRange_,
CefRange(selectedRange_.location, NSMaxRange(selectedRange_)));
CefRange(static_cast<int>(selectedRange_.location),
static_cast<int>(NSMaxRange(selectedRange_))));
} else if (oldHasMarkedText_ && !hasMarkedText_ && !textInserted) {
// There was no marked text or inserted text. Complete or cancel the
// composition.

View File

@ -47,7 +47,7 @@ class V8Handler : public CefV8Handler {
// Execute the test.
int64 delta = kPerfTests[i].test(kPerfTests[i].iterations);
retval = CefV8Value::CreateInt(delta);
retval = CefV8Value::CreateInt(static_cast<int32>(delta));
found = true;
break;
}

View File

@ -1171,7 +1171,7 @@ class MultiQueryMultiHandlerTestHandler : public SingleLoadTestHandler,
private:
MultiQueryMultiHandlerTestHandler* test_handler_;
const int index_;
int query_id_;
int64 query_id_;
};
MultiQueryMultiHandlerTestHandler(bool synchronous,

View File

@ -63,7 +63,7 @@ void sleep(int64 ms) {
#if defined(OS_WIN)
Sleep(ms);
#elif defined(OS_POSIX)
usleep(ms * 1000);
usleep(static_cast<useconds_t>(ms * 1000));
#else
#error Unsupported platform
#endif