Skip to content
This repository was archived by the owner on Oct 18, 2023. It is now read-only.

Commit 563e69c

Browse files
Merge pull request justadudewhohacks#422 from oyyd/fix-clang-warnings
fix compiler warnings
2 parents 069a26d + 5c247af commit 563e69c

File tree

8 files changed

+44
-45
lines changed

8 files changed

+44
-45
lines changed

cc/core/Mat.cc

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ NAN_METHOD(Mat::New) {
148148
FF_ARR rowArray = FF_ARR::Cast(info[0]);
149149
int type = info[1]->Int32Value();
150150

151-
int numCols = -1;
151+
long numCols = -1;
152152
for (uint i = 0; i < rowArray->Length(); i++) {
153153
if (!rowArray->Get(i)->IsArray()) {
154154
return Nan::ThrowError(Nan::New("Mat::New - Column should be an array, at column: " + std::to_string(i)).ToLocalChecked());
@@ -172,7 +172,7 @@ NAN_METHOD(Mat::New) {
172172
// TODO by Vec
173173
if (info[3]->IsArray()) {
174174
FF_ARR vec = FF_ARR::Cast(info[3]);
175-
if (mat.channels() != vec->Length()) {
175+
if (mat.channels() != (long)vec->Length()) {
176176
return Nan::ThrowError(FF_NEW_STRING(
177177
std::string("Mat::New - number of channels (") + std::to_string(mat.channels())
178178
+ std::string(") do not match fill vector length ") + std::to_string(vec->Length()))
@@ -274,7 +274,7 @@ NAN_METHOD(Mat::Set) {
274274
int cn = matSelf.channels();
275275
if (info[2]->IsArray()) {
276276
FF_ARR vec = FF_ARR::Cast(info[2]);
277-
FF_ASSERT_CHANNELS(cn, vec->Length(), "Mat::Set");
277+
FF_ASSERT_CHANNELS(cn, (long)vec->Length(), "Mat::Set");
278278
FF_MAT_APPLY_TYPED_OPERATOR(matSelf, vec, matSelf.type(), FF_MAT_SET, FF::matPut);
279279
}
280280
else if (FF_IS_INSTANCE(Vec2::constructor, info[2])) {
@@ -342,13 +342,13 @@ NAN_METHOD(Mat::Norm) {
342342
double norm;
343343

344344
// optional args
345-
bool hasOptArgsObj = FF_HAS_ARG(i) && info[i]->IsObject();
345+
bool hasOptArgsObj = FF_HAS_ARG((long)i) && info[i]->IsObject();
346346
FF_OBJ optArgs = hasOptArgsObj ? info[i]->ToObject() : FF_NEW_OBJ();
347347
FF_GET_UINT_IFDEF(optArgs, uint normType, "normType", cv::NORM_L2);
348348
FF_GET_INSTANCE_IFDEF(optArgs, cv::Mat mask, "mask", Mat::constructor, FF_UNWRAP_MAT_AND_GET, Mat, cv::noArray().getMat());
349349
if (!hasOptArgsObj) {
350-
FF_ARG_UINT_IFDEF(i, normType, normType);
351-
FF_ARG_INSTANCE_IFDEF(i + 1, mask, Mat::constructor, FF_UNWRAP_MAT_AND_GET, mask);
350+
FF_ARG_UINT_IFDEF((long)i, normType, normType);
351+
FF_ARG_INSTANCE_IFDEF((long)(i + 1), mask, Mat::constructor, FF_UNWRAP_MAT_AND_GET, mask);
352352
}
353353

354354
if (withSrc2) {
@@ -411,7 +411,7 @@ NAN_METHOD(Mat::Row) {
411411
row->Set(c, jsVec);
412412
}
413413
} else {
414-
return Nan::ThrowError(Nan::New("not implemented yet - mat type:" + mat.type()).ToLocalChecked());
414+
return Nan::ThrowError(Nan::New("not implemented yet - mat type:" + std::to_string(mat.type())).ToLocalChecked());
415415
}
416416
} catch(std::exception &e) {
417417
return Nan::ThrowError(e.what());

cc/core/MatBindings.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -866,10 +866,10 @@ namespace MatBindings {
866866
return (
867867
IntConverter::optArg(4, &borderType, info) ||
868868
(
869-
self.channels() == 1 && DoubleConverter::optArg(5, &v1, info) ||
870-
self.channels() == 2 && Vec2::Converter::optArg(5, &v2, info) ||
871-
self.channels() == 3 && Vec3::Converter::optArg(5, &v3, info) ||
872-
self.channels() == 4 && Vec4::Converter::optArg(5, &v4, info)
869+
(self.channels() == 1 && DoubleConverter::optArg(5, &v1, info)) ||
870+
(self.channels() == 2 && Vec2::Converter::optArg(5, &v2, info)) ||
871+
(self.channels() == 3 && Vec3::Converter::optArg(5, &v3, info)) ||
872+
(self.channels() == 4 && Vec4::Converter::optArg(5, &v4, info))
873873
)
874874
);
875875
}
@@ -883,10 +883,10 @@ namespace MatBindings {
883883
return (
884884
IntConverter::optProp(&borderType, "borderType", opts) ||
885885
(
886-
self.channels() == 1 && DoubleConverter::optProp(&v1, "value", opts) ||
887-
self.channels() == 2 && Vec2::Converter::optProp(&v2, "value", opts) ||
888-
self.channels() == 3 && Vec3::Converter::optProp(&v3, "value", opts) ||
889-
self.channels() == 4 && Vec4::Converter::optProp(&v4, "value", opts)
886+
(self.channels() == 1 && DoubleConverter::optProp(&v1, "value", opts)) ||
887+
(self.channels() == 2 && Vec2::Converter::optProp(&v2, "value", opts)) ||
888+
(self.channels() == 3 && Vec3::Converter::optProp(&v3, "value", opts)) ||
889+
(self.channels() == 4 && Vec4::Converter::optProp(&v4, "value", opts))
890890
)
891891
);
892892
}

cc/core/core.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ NAN_METHOD(Core::Partition) {
6464
v8::Local<v8::Function> cb = v8::Local<v8::Function>::Cast(info[1]);
6565
FF_VAL data0 = jsData->Get(0);
6666

67-
int numLabels;
67+
int numLabels = 0;
6868
std::vector<int> labels;
6969
if (FF_IS_INSTANCE(Point2::constructor, data0)) {
7070
std::vector<cv::Point2d> pts;

cc/modules/dnn/dnnBindings.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,76 +8,76 @@ namespace DnnBindings {
88
struct ReadNetFromTensorflowWorker : public CatchCvExceptionWorker {
99
public:
1010
std::string modelFile;
11-
11+
1212
cv::dnn::Net net;
13-
13+
1414
std::string executeCatchCvExceptionWorker() {
1515
net = cv::dnn::readNetFromTensorflow(modelFile);
1616
if (net.empty()) {
1717
return std::string("failed to load net: " + modelFile).data();
1818
}
1919
return "";
2020
}
21-
21+
2222
v8::Local<v8::Value> getReturnValue() {
2323
return Net::Converter::wrap(net);
2424
}
25-
25+
2626
bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
2727
return (
2828
StringConverter::arg(0, &modelFile, info)
2929
);
3030
}
3131
};
32-
32+
3333
struct ReadNetFromCaffeWorker : public CatchCvExceptionWorker {
3434
public:
3535
std::string prototxt;
3636
std::string modelFile = "";
37-
37+
3838
cv::dnn::Net net;
39-
39+
4040
std::string executeCatchCvExceptionWorker() {
4141
net = cv::dnn::readNetFromCaffe(prototxt, modelFile);
4242
if (net.empty()) {
4343
return std::string("failed to prototxt: " + prototxt + ", modelFile: " + modelFile).data();
4444
}
4545
return "";
4646
}
47-
47+
4848
v8::Local<v8::Value> getReturnValue() {
4949
return Net::Converter::wrap(net);
5050
}
51-
51+
5252
bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
5353
return (
5454
StringConverter::arg(0, &prototxt, info)
5555
);
5656
}
57-
57+
5858
bool unwrapOptionalArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
5959
return (
6060
StringConverter::optArg(1, &modelFile, info)
6161
);
6262
}
6363
};
64-
64+
6565
struct BlobFromImageWorker : public CatchCvExceptionWorker {
6666
public:
6767
bool isSingleImage;
6868
BlobFromImageWorker(bool isSingleImage = true) {
6969
this->isSingleImage = isSingleImage;
7070
}
71-
71+
7272
cv::Mat image;
7373
std::vector<cv::Mat> images;
7474
double scalefactor = 1.0;
7575
cv::Size2d size = cv::Size2d();
7676
cv::Vec3d mean = cv::Vec3d();
7777
bool swapRB = true;
78-
78+
7979
cv::Mat returnValue;
80-
80+
8181
std::string executeCatchCvExceptionWorker() {
8282
if (isSingleImage) {
8383
returnValue = cv::dnn::blobFromImage(image, scalefactor, size, mean, swapRB);
@@ -87,18 +87,18 @@ namespace DnnBindings {
8787
}
8888
return "";
8989
}
90-
90+
9191
v8::Local<v8::Value> getReturnValue() {
9292
return Mat::Converter::wrap(returnValue);
9393
}
94-
94+
9595
bool unwrapRequiredArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
9696
return (
97-
isSingleImage && Mat::Converter::arg(0, &image, info) ||
98-
!isSingleImage && ObjectArrayConverter<Mat, cv::Mat>::arg(0, &images, info)
97+
(isSingleImage && Mat::Converter::arg(0, &image, info)) ||
98+
(!isSingleImage && ObjectArrayConverter<Mat, cv::Mat>::arg(0, &images, info))
9999
);
100100
}
101-
101+
102102
bool unwrapOptionalArgs(Nan::NAN_METHOD_ARGS_TYPE info) {
103103
return (
104104
DoubleConverter::optArg(1, &scalefactor, info) ||
@@ -107,11 +107,11 @@ namespace DnnBindings {
107107
BoolConverter::optArg(4, &swapRB, info)
108108
);
109109
}
110-
110+
111111
bool hasOptArgsObject(Nan::NAN_METHOD_ARGS_TYPE info) {
112112
return FF_ARG_IS_OBJECT(1);
113113
}
114-
114+
115115
bool unwrapOptionalArgsFromOpts(Nan::NAN_METHOD_ARGS_TYPE info) {
116116
v8::Local<v8::Object> opts = info[1]->ToObject();
117117
return (
@@ -122,8 +122,8 @@ namespace DnnBindings {
122122
);
123123
}
124124
};
125-
125+
126126

127127
}
128128

129-
#endif
129+
#endif

cc/modules/face/LBPHFaceRecognizer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ NAN_METHOD(LBPHFaceRecognizer::New) {
7171
FF_RETURN(info.Holder());
7272
};
7373

74-
#endif HAVE_FACE
74+
#endif // HAVE_FACE

cc/modules/features2d/descriptorMatchingKnn.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ void DescriptorMatchingKnn::matchKnn(Nan::NAN_METHOD_ARGS_TYPE info, std::string
136136
#else
137137
void DescriptorMatchingKnn::matchKnn(Nan::NAN_METHOD_ARGS_TYPE info, int matcherType) {
138138
#endif
139-
MatchKnnWorker worker();
140139
FF::SyncBinding(
141140
std::make_shared<MatchKnnWorker>(cv::DescriptorMatcher::create(matcherType)),
142141
"MSERDetector::MatchKnn",
@@ -154,4 +153,4 @@ void DescriptorMatchingKnn::matchKnnAsync(Nan::NAN_METHOD_ARGS_TYPE info, int ma
154153
"MSERDetector::MatchKnnAsync",
155154
info
156155
);
157-
}
156+
}

cc/modules/imgproc/Contour.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ NAN_METHOD(Contour::MatchShapes) {
211211
FF_ARG_UINT(1, uint method);
212212

213213
// parameter not supported
214-
double parameter;
214+
double parameter = 0.0;
215215
double cmp = cv::matchShapes(
216216
FF_UNWRAP_CONTOUR_AND_GET(info.This()),
217217
contour2,

cc/modules/tracking/MultiTracker.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ NAN_METHOD(MultiTracker::Update) {
106106
FF_UNWRAP(info.This(), MultiTracker)->tracker.update(image, rects);
107107

108108
FF_ARR jsRects = FF_NEW_ARRAY(rects.size());
109-
for (int i = 0; i < rects.size(); i++) {
109+
for (unsigned long i = 0; i < rects.size(); i++) {
110110
FF_OBJ jsRect = FF_NEW_INSTANCE(Rect::constructor);
111111
FF_UNWRAP_RECT_AND_GET(jsRect) = rects.at(i);
112112
jsRects->Set(i, jsRect);
@@ -116,4 +116,4 @@ NAN_METHOD(MultiTracker::Update) {
116116

117117
#endif
118118

119-
#endif
119+
#endif

0 commit comments

Comments
 (0)