The following issues were found

modules/gapi/test/streaming/gapi_streaming_tests.cpp
1 issues
syntax error
Error

Line: 132

                  cv::optional<size_t>     cap;
};

G_API_OP(Delay, <cv::GMat(cv::GMat, int)>, "org.opencv.test.delay") {
    static cv::GMatDesc outMeta(const cv::GMatDesc &in, int) { return in; }
};
GAPI_OCV_KERNEL(OCVDelay, Delay) {
    static void run(const cv::Mat &in, int ms, cv::Mat &out) {
        std::this_thread::sleep_for(std::chrono::milliseconds{ms});

            

Reported by Cppcheck.

modules/gapi/test/util/any_tests.cpp
1 issues
syntax error
Error

Line: 26

                 ASSERT_EQ(any_cast<int>(a), 7);
}

TEST(Any, any_cast_ref_throws_on_empty)
{
   using namespace util;
   any a;

   ASSERT_THROW(util::any_cast<int>(a), bad_any_cast);

            

Reported by Cppcheck.

modules/gapi/test/util/optional_tests.cpp
1 issues
syntax error
Error

Line: 22

                  EXPECT_FALSE(static_cast<bool>(o));
}

TEST(Optional, ValueCTor)
{
    util::optional<int> o(42);
    EXPECT_TRUE(o.has_value());
    EXPECT_TRUE(static_cast<bool>(o));
}

            

Reported by Cppcheck.

modules/gapi/test/util/variant_tests.cpp
1 issues
syntax error
Error

Line: 21

                  typedef util::variant<int, float>       TestVar2;
}

TEST(Variant, EmptyCTor)
{
    util::variant<int> vi;
    EXPECT_EQ(0,  util::get<int>(vi));

    util::variant<int, std::string> vis;

            

Reported by Cppcheck.

modules/highgui/src/window_w32.cpp
1 issues
Dangerous usage of c_str(). The c_str() return value is only valid until its string is deleted.
Error

Line: 2705 CWE codes: 664

                  if (!window)
        CV_Error_(Error::StsNullPtr, ("NULL window: '%p'", window_handle));

    return window->name.c_str();
}


CV_IMPL void
cvSetPreprocessFuncWin32_(const void* callback)

            

Reported by Cppcheck.

modules/highgui/src/window_winrt_bridge.cpp
1 issues
syntax error
Error

Line: 222

              
CvWindow::CvWindow(cv::String name, int flags) : name(name)
{
    this->page = (Page^)Windows::UI::Xaml::Markup::XamlReader::Load(const_cast<Platform::String^>(markupContent));
    this->sliderMap = new std::map<cv::String, CvTrackbar*>();

    sliderPanel = (Panel^)page->FindName("cvTrackbar");
    imageControl = (Image^)page->FindName("cvImage");
    buttonPanel = (Panel^)page->FindName("cvButton");

            

Reported by Cppcheck.

modules/imgcodecs/src/grfmt_jpeg.cpp
1 issues
There is an unknown macro here somewhere. Configuration is required. If METHODDEF is a macro then please configure it.
Error

Line: 113

              
/////////////////////// Error processing /////////////////////

METHODDEF(void)
stub(j_decompress_ptr)
{
}

METHODDEF(boolean)

            

Reported by Cppcheck.

modules/imgcodecs/test/test_grfmt.cpp
1 issues
syntax error
Error

Line: 141

              typedef tuple<string, Size> Ext_Size;
typedef testing::TestWithParam<Ext_Size> Imgcodecs_ExtSize;

TEST_P(Imgcodecs_ExtSize, write_imageseq)
{
    const string ext = get<0>(GetParam());
    const Size size = get<1>(GetParam());
    const Point2i center = Point2i(size.width / 2, size.height / 2);
    const int radius = std::min(size.height, size.width / 4);

            

Reported by Cppcheck.

modules/imgcodecs/test/test_jpeg.cpp
1 issues
syntax error
Error

Line: 99

              
//==================================================================================================

TEST(Imgcodecs_Jpeg, encode_empty)
{
    cv::Mat img;
    std::vector<uchar> jpegImg;
    ASSERT_THROW(cv::imencode(".jpg", img, jpegImg), cv::Exception);
}

            

Reported by Cppcheck.

modules/imgcodecs/test/test_png.cpp
1 issues
syntax error
Error

Line: 24

                  EXPECT_EQ(0, remove(dst_file.c_str()));
}

TEST(Imgcodecs_Png, encode)
{
    vector<uchar> buff;
    Mat img_gt = Mat::zeros(1000, 1000, CV_8U);
    vector<int> param;
    param.push_back(IMWRITE_PNG_COMPRESSION);

            

Reported by Cppcheck.