[Git][wxwidgets/wxwidgets][master] 3 commits: Add annotations to WinMain() to avoid MSVC analyzer warnings

2 views
Skip to first unread message

Vadim Zeitlin (@_VZ_)

unread,
Apr 9, 2026, 8:38:53 PM (2 days ago) Apr 9
to wx-commi...@googlegroups.com

Vadim Zeitlin pushed to branch master at wxWidgets / wxWidgets

Commits:

  • 37d15603
    by Vadim Zeitlin at 2026-04-09T23:30:44+02:00
    Add annotations to WinMain() to avoid MSVC analyzer warnings
    
    Avoid MSVC code analysis warning
    
    C28251: Inconsistent annotation for 'WinMain': this instance has no annotations.
    
    by providing the same annotations as in the SDK header.
    
    Closes #18529.
    
    Closes #26322.
    
  • 21264e26
    by Vadim Zeitlin at 2026-04-10T02:22:08+02:00
    Fix wxWithImages::GetImageLogicalSize() in wxGTK and wxOSX
    
    Calling FromPhys() unconditionally on the image list size was wrong, we
    want to use the logical size of the bitmap contained in wxImageList
    which depends on its scale factor and is the same as its physical size
    on platforms using DPI-independent pixels such as wxGTK and wxOSX.
    
    This resulted in positioning the bitmaps incorrectly in wxListCtrl (and
    almost surely wxTreeCtrl too).
    
    Closes #26349.
    
  • b226c77e
    by Blake-Madden at 2026-04-10T02:22:08+02:00
    Use unique clip/gradient IDs across all wxSVGFileDC objects
    
    This is useful if you need to combine output SVGs as it avoids ID
    clashes.
    
    Closes #26366.
    

4 changed files:

Changes:

  • include/wx/dcsvg.h
    ... ... @@ -289,10 +289,10 @@ private:
    289 289
     
    
    290 290
         // Unique ID for every clipping graphics group: this is simply always
    
    291 291
         // incremented in each SetClippingRegion() call.
    
    292
    -    size_t m_clipUniqueId;
    
    292
    +    static size_t m_clipUniqueId;
    
    293 293
     
    
    294 294
         // Unique ID for every gradient.
    
    295
    -    size_t m_gradientUniqueId;
    
    295
    +    static size_t m_gradientUniqueId;
    
    296 296
     
    
    297 297
         wxDECLARE_ABSTRACT_CLASS(wxSVGFileDCImpl);
    
    298 298
         wxDECLARE_NO_COPY_CLASS(wxSVGFileDCImpl);
    

  • include/wx/msw/init.h
    ... ... @@ -46,11 +46,22 @@ extern WXDLLIMPEXP_CORE int
    46 46
                 wxCmdLineArgType pCmdLine = nullptr,
    
    47 47
                 int nCmdShow = SW_SHOWNORMAL);
    
    48 48
     
    
    49
    +#ifdef _In_
    
    50
    +    #define wxIN _In_
    
    51
    +#else
    
    52
    +    #define wxIN
    
    53
    +#endif
    
    54
    +#ifdef _In_opt_
    
    55
    +    #define wxIN_OPT _In_opt_
    
    56
    +#else
    
    57
    +    #define wxIN_OPT
    
    58
    +#endif
    
    59
    +
    
    49 60
     #define wxIMPLEMENT_WXWIN_MAIN                                              \
    
    50
    -    extern "C" int WINAPI WinMain(HINSTANCE hInstance,                      \
    
    51
    -                                  HINSTANCE hPrevInstance,                  \
    
    52
    -                                  wxCmdLineArgType lpCmdLine,               \
    
    53
    -                                  int nCmdShow)                             \
    
    61
    +    extern "C" int WINAPI WinMain(wxIN HINSTANCE hInstance,                 \
    
    62
    +                                  wxIN_OPT HINSTANCE hPrevInstance,         \
    
    63
    +                                  wxIN wxCmdLineArgType lpCmdLine,          \
    
    64
    +                                  wxIN int nCmdShow)                        \
    
    54 65
         {                                                                       \
    
    55 66
             wxDISABLE_DEBUG_SUPPORT();                                          \
    
    56 67
                                                                                 \
    

  • include/wx/withimages.h
    ... ... @@ -196,8 +196,7 @@ public:
    196 196
                 }
    
    197 197
                 else if ( m_imageList )
    
    198 198
                 {
    
    199
    -                // All images in the image list are of the same size.
    
    200
    -                size = window->FromPhys(m_imageList->GetSize());
    
    199
    +                size = m_imageList->GetBitmap(iconIndex).GetLogicalSize();
    
    201 200
                 }
    
    202 201
             }
    
    203 202
     
    

  • src/common/dcsvg.cpp
    ... ... @@ -519,6 +519,9 @@ bool wxSVGFileDC::Save()
    519 519
     
    
    520 520
     wxIMPLEMENT_ABSTRACT_CLASS(wxSVGFileDCImpl, wxDCImpl);
    
    521 521
     
    
    522
    +size_t wxSVGFileDCImpl::m_clipUniqueId = 0;
    
    523
    +size_t wxSVGFileDCImpl::m_gradientUniqueId = 0;
    
    524
    +
    
    522 525
     wxSVGFileDCImpl::wxSVGFileDCImpl(wxSVGFileDC* owner, const wxString& filename,
    
    523 526
                                      int width, int height, double dpi, const wxString& title)
    
    524 527
         : wxDCImpl(owner)
    
    ... ... @@ -537,11 +540,8 @@ void wxSVGFileDCImpl::Init(const wxString& filename, int width, int height,
    537 540
         m_writeError = false;
    
    538 541
         m_saved = false;
    
    539 542
     
    
    540
    -    m_clipUniqueId = 0;
    
    541 543
         m_clipNestingLevel = 0;
    
    542 544
     
    
    543
    -    m_gradientUniqueId = 0;
    
    544
    -
    
    545 545
         m_mm_to_pix_x = m_dpi / 25.4;
    
    546 546
         m_mm_to_pix_y = m_dpi / 25.4;
    
    547 547
     
    

Reply all
Reply to author
Forward
0 new messages