1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

Merge pull request #23055 from seanm:sprintf2

* Replaced most remaining sprintf with snprintf
* Deprecated encodeFormat and introduced new method that takes the buffer length
* Also increased buffer size at call sites to be a little bigger, in case int is 64 bit
This commit is contained in:
Sean McBride
2023-04-18 02:22:59 -04:00
committed by GitHub
parent 8512deb3cc
commit 47bea69322
32 changed files with 82 additions and 71 deletions
+4 -4
View File
@@ -87,7 +87,7 @@ static bool sumTemplate(InputArray _src, UMat & result)
wgs2_aligned <<= 1;
wgs2_aligned >>= 1;
char cvt[40];
char cvt[50];
ocl::Kernel k("calcSum", ocl::imgproc::match_template_oclsrc,
format("-D CALC_SUM -D T=%s -D T1=%s -D WT=%s -D cn=%d -D convertToWT=%s -D WGS=%d -D WGS2_ALIGNED=%d",
ocl::typeToStr(type), ocl::typeToStr(depth), ocl::typeToStr(wtype), cn,
@@ -268,8 +268,8 @@ static bool matchTemplateNaive_CCORR(InputArray _image, InputArray _templ, Outpu
wtype1 = CV_MAKE_TYPE(wdepth, rated_cn);
}
char cvt[40];
char cvt1[40];
char cvt[50];
char cvt1[50];
const char* convertToWT1 = ocl::convertTypeStr(depth, wdepth, cn, cvt);
const char* convertToWT = ocl::convertTypeStr(depth, wdepth, rated_cn, cvt1);
@@ -349,7 +349,7 @@ static bool matchTemplateNaive_SQDIFF(InputArray _image, InputArray _templ, Outp
int type = _image.type(), depth = CV_MAT_DEPTH(type), cn = CV_MAT_CN(type);
int wdepth = CV_32F, wtype = CV_MAKE_TYPE(wdepth, cn);
char cvt[40];
char cvt[50];
ocl::Kernel k("matchTemplate_Naive_SQDIFF", ocl::imgproc::match_template_oclsrc,
format("-D SQDIFF -D T=%s -D T1=%s -D WT=%s -D convertToWT=%s -D cn=%d", ocl::typeToStr(type), ocl::typeToStr(depth),
ocl::typeToStr(wtype), ocl::convertTypeStr(depth, wdepth, cn, cvt), cn));