mirror of
https://github.com/opencv/opencv.git
synced 2026-07-29 23:33:05 +04:00
core: fix printf warnings by using c++11 format
This commit is contained in:
committed by
Maksim Shabunin
parent
4d23a5d92d
commit
d1c842cf29
@@ -237,11 +237,11 @@ static bool ocl_mixChannels(InputArrayOfArrays _src, InputOutputArrayOfArrays _d
|
||||
dstargs[i] = dst[dst_idx];
|
||||
dstargs[i].offset += dst_cnidx * esz;
|
||||
|
||||
declsrc += format("DECLARE_INPUT_MAT(%d)", i);
|
||||
decldst += format("DECLARE_OUTPUT_MAT(%d)", i);
|
||||
indexdecl += format("DECLARE_INDEX(%d)", i);
|
||||
declproc += format("PROCESS_ELEM(%d)", i);
|
||||
declcn += format(" -D scn%d=%d -D dcn%d=%d", i, src[src_idx].channels(), i, dst[dst_idx].channels());
|
||||
declsrc += format("DECLARE_INPUT_MAT(%zu)", i);
|
||||
decldst += format("DECLARE_OUTPUT_MAT(%zu)", i);
|
||||
indexdecl += format("DECLARE_INDEX(%zu)", i);
|
||||
declproc += format("PROCESS_ELEM(%zu)", i);
|
||||
declcn += format(" -D scn%zu=%d -D dcn%zu=%d", i, src[src_idx].channels(), i, dst[dst_idx].channels());
|
||||
}
|
||||
|
||||
ocl::Kernel k("mixChannels", ocl::core::mixchannels_oclsrc,
|
||||
|
||||
@@ -184,7 +184,7 @@ Mat LDA::subspaceProject(InputArray _W, InputArray _mean, InputArray _src) {
|
||||
}
|
||||
// make sure mean is correct if not empty
|
||||
if(!mean.empty() && (mean.total() != (size_t) d)) {
|
||||
String error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %d.", d, mean.total());
|
||||
String error_message = format("Wrong mean shape for the given data matrix. Expected %d, but was %zu.", d, mean.total());
|
||||
CV_Error(Error::StsBadArg, error_message);
|
||||
}
|
||||
// create temporary matrices
|
||||
@@ -222,7 +222,7 @@ Mat LDA::subspaceReconstruct(InputArray _W, InputArray _mean, InputArray _src)
|
||||
}
|
||||
// make sure mean is correct if not empty
|
||||
if(!mean.empty() && (mean.total() != (size_t) W.rows)) {
|
||||
String error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %d.", W.cols, mean.total());
|
||||
String error_message = format("Wrong mean shape for the given eigenvector matrix. Expected %d, but was %zu.", W.cols, mean.total());
|
||||
CV_Error(Error::StsBadArg, error_message);
|
||||
}
|
||||
// initialize temporary matrices
|
||||
@@ -1076,7 +1076,7 @@ void LDA::lda(InputArrayOfArrays _src, InputArray _lbls) {
|
||||
}
|
||||
// throw error if less labels, than samples
|
||||
if (labels.size() != static_cast<size_t>(N)) {
|
||||
String error_message = format("The number of samples must equal the number of labels. Given %d labels, %d samples. ", labels.size(), N);
|
||||
String error_message = format("The number of samples must equal the number of labels. Given %zu labels, %d samples. ", labels.size(), N);
|
||||
CV_Error(Error::StsBadArg, error_message);
|
||||
}
|
||||
// warn if within-classes scatter matrix becomes singular
|
||||
|
||||
@@ -892,7 +892,7 @@ static bool ocl_reduce(InputArray _src, OutputArray _dst,
|
||||
tileHeight = min(tileHeight, defDev.localMemSize() / buf_cols / CV_ELEM_SIZE(CV_MAKETYPE(wdepth, cn)) / maxItemInGroupCount);
|
||||
}
|
||||
char cvt[3][40];
|
||||
cv::String build_opt = format("-D OP_REDUCE_PRE -D BUF_COLS=%d -D TILE_HEIGHT=%d -D %s -D dim=1"
|
||||
cv::String build_opt = format("-D OP_REDUCE_PRE -D BUF_COLS=%d -D TILE_HEIGHT=%zu -D %s -D dim=1"
|
||||
" -D cn=%d -D ddepth=%d"
|
||||
" -D srcT=%s -D bufT=%s -D dstT=%s"
|
||||
" -D convertToWT=%s -D convertToBufT=%s -D convertToDT=%s%s",
|
||||
|
||||
@@ -3104,9 +3104,9 @@ bool Kernel::Impl::run(int dims, size_t globalsize[], size_t localsize[],
|
||||
if (retval != CL_SUCCESS)
|
||||
#endif
|
||||
{
|
||||
cv::String msg = cv::format("clEnqueueNDRangeKernel('%s', dims=%d, globalsize=%dx%dx%d, localsize=%s) sync=%s", name.c_str(), (int)dims,
|
||||
cv::String msg = cv::format("clEnqueueNDRangeKernel('%s', dims=%d, globalsize=%zux%zux%zu, localsize=%s) sync=%s", name.c_str(), (int)dims,
|
||||
globalsize[0], (dims > 1 ? globalsize[1] : 1), (dims > 2 ? globalsize[2] : 1),
|
||||
(localsize ? cv::format("%dx%dx%d", localsize[0], (dims > 1 ? localsize[1] : 1), (dims > 2 ? localsize[2] : 1)) : cv::String("NULL")).c_str(),
|
||||
(localsize ? cv::format("%zux%zux%zu", localsize[0], (dims > 1 ? localsize[1] : 1), (dims > 2 ? localsize[2] : 1)) : cv::String("NULL")).c_str(),
|
||||
sync ? "true" : "false"
|
||||
);
|
||||
if (retval != CL_SUCCESS)
|
||||
@@ -3317,7 +3317,7 @@ struct ProgramSource::Impl
|
||||
default:
|
||||
CV_Error(Error::StsInternal, "Internal error");
|
||||
}
|
||||
sourceHash_ = cv::format("%08llx", hash);
|
||||
sourceHash_ = cv::format("%08jx", hash);
|
||||
isHashUpdated = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user