C++20 fixes.
* Types on both sides of comparison operators should be the same. * Compound ops on volatiles are deprecated. * Math between disparate enums is deprecated. Insert casts. Bug: 1284275 Change-Id: I07224ceda28a728920912853c11f2110eea39eef Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3668334 Commit-Queue: Peter Kasting <pkasting@chromium.org> Reviewed-by: Nico Weber <thakis@chromium.org> Owners-Override: Nico Weber <thakis@chromium.org> Cr-Commit-Position: refs/heads/main@{#1007551}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8babf7f544
commit
331ba2ef83
base/mac
chrome/browser/renderer_host
components
content/browser/renderer_host
media
net/cert
printing
services/shape_detection
skia/ext
third_party/blink/renderer/platform/mac
@ -110,9 +110,13 @@ class ScopedTypeRef {
|
||||
object_ = object;
|
||||
}
|
||||
|
||||
bool operator==(const element_type& that) const { return object_ == that; }
|
||||
bool operator==(const ScopedTypeRef& that) const {
|
||||
return object_ == that.object_;
|
||||
}
|
||||
|
||||
bool operator!=(const element_type& that) const { return object_ != that; }
|
||||
bool operator!=(const ScopedTypeRef& that) const {
|
||||
return object_ != that.object_;
|
||||
}
|
||||
|
||||
operator element_type() const { return object_; }
|
||||
|
||||
|
@ -117,7 +117,7 @@ BOOL forceMagicMouse = NO;
|
||||
|
||||
- (void)rendererHandledWheelEvent:(const blink::WebMouseWheelEvent&)event
|
||||
consumed:(BOOL)consumed {
|
||||
if (event.phase != NSEventPhaseBegan)
|
||||
if (event.phase != blink::WebMouseWheelEvent::kPhaseBegan)
|
||||
return;
|
||||
_firstScrollUnconsumed = !consumed;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void BurnCPU() {
|
||||
[[maybe_unused]] volatile double number = 1;
|
||||
while (base::TimeTicks::Now() < (begin + busy_time)) {
|
||||
for (int i = 0; i < 10000; ++i)
|
||||
number *= base::RandDouble();
|
||||
number = number * base::RandDouble();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,10 @@ storage_monitor::ImageCaptureDeviceManager* g_image_capture_device_manager =
|
||||
|
||||
_deviceBrowser.reset([[ICDeviceBrowser alloc] init]);
|
||||
[_deviceBrowser setDelegate:self];
|
||||
[_deviceBrowser setBrowsedDeviceTypeMask:
|
||||
static_cast<ICDeviceTypeMask>(
|
||||
ICDeviceTypeMaskCamera | ICDeviceLocationTypeMaskLocal)];
|
||||
[_deviceBrowser
|
||||
setBrowsedDeviceTypeMask:ICDeviceTypeMask{
|
||||
ICDeviceTypeMaskCamera |
|
||||
UInt{ICDeviceLocationTypeMaskLocal}}];
|
||||
[_deviceBrowser start];
|
||||
}
|
||||
return self;
|
||||
|
@ -81,7 +81,7 @@
|
||||
[attrs setObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
|
||||
|
||||
if (item->has_text_direction_override) {
|
||||
[attrs setObject:@[ @(writingDirection | NSWritingDirectionOverride) ]
|
||||
[attrs setObject:@[ @(long{writingDirection} | NSWritingDirectionOverride) ]
|
||||
forKey:NSWritingDirectionAttributeName];
|
||||
}
|
||||
|
||||
|
@ -75,8 +75,8 @@ static bool SetStreamFormat(int channels,
|
||||
AudioStreamBasicDescription* format) {
|
||||
format->mSampleRate = sample_rate;
|
||||
format->mFormatID = kAudioFormatLinearPCM;
|
||||
format->mFormatFlags =
|
||||
kAudioFormatFlagsNativeFloatPacked | kLinearPCMFormatFlagIsNonInterleaved;
|
||||
format->mFormatFlags = AudioFormatFlags{kAudioFormatFlagsNativeFloatPacked} |
|
||||
kLinearPCMFormatFlagIsNonInterleaved;
|
||||
format->mBytesPerPacket = sizeof(Float32);
|
||||
format->mFramesPerPacket = 1;
|
||||
format->mBytesPerFrame = sizeof(Float32);
|
||||
|
@ -246,8 +246,8 @@ static void SetAntiFlickerInVideoControlInterface(
|
||||
// Create the control request and launch it to the device's control interface.
|
||||
// Note how the wIndex needs the interface number OR'ed in the lowest bits.
|
||||
IOUSBDevRequest command;
|
||||
command.bmRequestType =
|
||||
USBmakebmRequestType(kUSBOut, kUSBClass, kUSBInterface);
|
||||
command.bmRequestType = USBmakebmRequestType(UInt8{kUSBOut}, UInt8{kUSBClass},
|
||||
UInt8{kUSBInterface});
|
||||
command.bRequest = kVcRequestCodeSetCur;
|
||||
UInt8 interface_number;
|
||||
(*control_interface)
|
||||
@ -328,8 +328,8 @@ static IOUSBDevRequest CreateEmptyPanTiltZoomRequest(
|
||||
(*control_interface)
|
||||
->GetInterfaceNumber(control_interface, &interface_number);
|
||||
IOUSBDevRequest command;
|
||||
command.bmRequestType =
|
||||
USBmakebmRequestType(endpoint_direction, kUSBClass, kUSBInterface);
|
||||
command.bmRequestType = USBmakebmRequestType(
|
||||
endpoint_direction, UInt8{kUSBClass}, UInt8{kUSBInterface});
|
||||
command.bRequest = request_code;
|
||||
command.wIndex = (unit_id << 8) | interface_number;
|
||||
command.wValue = (control_selector << 8);
|
||||
|
@ -400,7 +400,8 @@ class AudioEncoder::AppleAacImpl final : public AudioEncoder::ImplBase {
|
||||
in_asbd.mSampleRate = sampling_rate;
|
||||
in_asbd.mFormatID = kAudioFormatLinearPCM;
|
||||
in_asbd.mFormatFlags =
|
||||
kAudioFormatFlagsNativeFloatPacked | kAudioFormatFlagIsNonInterleaved;
|
||||
AudioFormatFlags{kAudioFormatFlagsNativeFloatPacked} |
|
||||
kAudioFormatFlagIsNonInterleaved;
|
||||
in_asbd.mChannelsPerFrame = num_channels_;
|
||||
in_asbd.mBitsPerChannel = sizeof(float) * 8;
|
||||
in_asbd.mFramesPerPacket = 1;
|
||||
|
@ -76,7 +76,7 @@ SHA256HashValue CalculateFingerprint256(SecCertificateRef cert) {
|
||||
|
||||
OSStatus CreateSSLClientPolicy(SecPolicyRef* policy) {
|
||||
*policy = SecPolicyCreateSSL(false /* server */, nullptr);
|
||||
return *policy ? noErr : errSecNoPolicyModule;
|
||||
return *policy ? OSStatus{noErr} : errSecNoPolicyModule;
|
||||
}
|
||||
|
||||
OSStatus CreateSSLServerPolicy(const std::string& hostname,
|
||||
@ -89,12 +89,12 @@ OSStatus CreateSSLServerPolicy(const std::string& hostname,
|
||||
}
|
||||
|
||||
*policy = SecPolicyCreateSSL(true /* server */, hostname_cfstring.get());
|
||||
return *policy ? noErr : errSecNoPolicyModule;
|
||||
return *policy ? OSStatus{noErr} : errSecNoPolicyModule;
|
||||
}
|
||||
|
||||
OSStatus CreateBasicX509Policy(SecPolicyRef* policy) {
|
||||
*policy = SecPolicyCreateBasicX509();
|
||||
return *policy ? noErr : errSecNoPolicyModule;
|
||||
return *policy ? OSStatus{noErr} : errSecNoPolicyModule;
|
||||
}
|
||||
|
||||
OSStatus CreateRevocationPolicies(bool enable_revocation_checking,
|
||||
|
@ -83,7 +83,7 @@ void RenderedPdfSha1(const base::FilePath::StringType& pdf_filename,
|
||||
base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate(
|
||||
rendered_bitmap.data(), dest_size.width(), dest_size.height(),
|
||||
kBitsPerComponent, kStride, color_space,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little));
|
||||
uint32_t{kCGImageAlphaPremultipliedFirst} | kCGBitmapByteOrder32Little));
|
||||
|
||||
// Render using metafile and calculate the output hash.
|
||||
ASSERT_TRUE(pdf_cg->RenderPage(page_number, context,
|
||||
|
@ -58,7 +58,7 @@ TEST_F(TextDetectionImplMacTest, ScanOnce) {
|
||||
base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate(
|
||||
nullptr, width, height, 8 /* bitsPerComponent */,
|
||||
width * 4 /* rowBytes */, rgb_colorspace,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
|
||||
uint32_t{kCGImageAlphaPremultipliedFirst} | kCGBitmapByteOrder32Host));
|
||||
|
||||
// Draw a white background.
|
||||
CGContextSetRGBFillColor(context, 1.0, 1.0, 1.0, 1.0);
|
||||
|
@ -42,13 +42,8 @@ SkBitmap NSImageOrNSImageRepToSkBitmapWithColorSpace(
|
||||
&& SK_G32_SHIFT == (g) && SK_B32_SHIFT == (b))
|
||||
#if defined(SK_CPU_LENDIAN) && HAS_ARGB_SHIFTS(24, 16, 8, 0)
|
||||
base::ScopedCFTypeRef<CGContextRef> context(CGBitmapContextCreate(
|
||||
data,
|
||||
size.width,
|
||||
size.height,
|
||||
8,
|
||||
size.width * 4,
|
||||
color_space,
|
||||
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host));
|
||||
data, size.width, size.height, 8, size.width * 4, color_space,
|
||||
uint32_t{kCGImageAlphaPremultipliedFirst} | kCGBitmapByteOrder32Host));
|
||||
#else
|
||||
#error We require that Skia's and CoreGraphics's recommended \
|
||||
image memory layout match.
|
||||
|
@ -65,7 +65,7 @@ CGContextRef GraphicsContextCanvas::CgContext() {
|
||||
cg_context_ = CGBitmapContextCreate(
|
||||
offscreen_.getPixels(), offscreen_.width(), offscreen_.height(), 8,
|
||||
offscreen_.rowBytes(), color_space,
|
||||
kCGBitmapByteOrder32Host | kCGImageAlphaPremultipliedFirst);
|
||||
uint32_t{kCGBitmapByteOrder32Host} | kCGImageAlphaPremultipliedFirst);
|
||||
DCHECK(cg_context_);
|
||||
|
||||
SkMatrix matrix = canvas_->getTotalMatrix();
|
||||
|
Reference in New Issue
Block a user