Skip to content
Permalink
Browse files
[Win] MSVC reports "DragImageCairoWin.cpp(142): error C2362: initiali…
…zation of 'cr' is skipped by 'goto exit'" with /std:c++20

https://bugs.webkit.org/show_bug.cgi?id=234505

Reviewed by Don Olmstead.

* platform/win/DragImageCairoWin.cpp:
(WebCore::scaleDragImage):
Reimplemented without goto statements.


Canonical link: https://commits.webkit.org/245424@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@287268 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
fujii committed Dec 20, 2021
1 parent 6ea3615 commit 97d24bfa7ea6a5de20602f976a5fab7f107c31d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
@@ -1,3 +1,14 @@
2021-12-20 Fujii Hironori <Hironori.Fujii@sony.com>

[Win] MSVC reports "DragImageCairoWin.cpp(142): error C2362: initialization of 'cr' is skipped by 'goto exit'" with /std:c++20
https://bugs.webkit.org/show_bug.cgi?id=234505

Reviewed by Don Olmstead.

* platform/win/DragImageCairoWin.cpp:
(WebCore::scaleDragImage):
Reimplemented without goto statements.

2021-12-14 Sergio Villar Senin <svillar@igalia.com>

[css-flexbox] Pre-layout orthogonal children to compute the preferred logical width
@@ -107,7 +107,6 @@ DragImageRef scaleDragImage(DragImageRef imageRef, FloatSize scale)
if (!imageRef)
return 0;

GDIObject<HBITMAP> hbmp;
auto image = adoptGDIObject(imageRef);

IntSize srcSize = dragImageSize(image.get());
@@ -116,12 +115,12 @@ DragImageRef scaleDragImage(DragImageRef imageRef, FloatSize scale)
HWndDC dc(0);
auto dstDC = adoptGDIObject(::CreateCompatibleDC(dc));
if (!dstDC)
goto exit;
return image.leak();

GraphicsContextCairo* targetContext;
hbmp = allocImage(dstDC.get(), dstSize, &targetContext);
GDIObject<HBITMAP> hbmp = allocImage(dstDC.get(), dstSize, &targetContext);
if (!hbmp)
goto exit;
return image.leak();

cairo_surface_t* srcImage = createCairoContextFromBitmap(image.get());

@@ -139,9 +138,6 @@ DragImageRef scaleDragImage(DragImageRef imageRef, FloatSize scale)
cairo_surface_destroy(srcImage);
deallocContext(targetContext);

exit:
if (!hbmp)
hbmp.swap(image);
return hbmp.leak();
}

0 comments on commit 97d24bf

Please sign in to comment.