Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
7fd1cfc5
Commit
7fd1cfc5
authored
Apr 10, 2012
by
Andrey Kamaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed warnings about unused return value of fread
parent
5f02bbd0
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
29 deletions
+44
-29
cvhaartraining.cpp
apps/haartraining/cvhaartraining.cpp
+15
-10
cvsamples.cpp
apps/haartraining/cvsamples.cpp
+5
-4
imagestorage.cpp
apps/traincascade/imagestorage.cpp
+4
-2
test_features2d.cpp
modules/features2d/test/test_features2d.cpp
+7
-5
test_features2d.cpp
modules/nonfree/test/test_features2d.cpp
+7
-5
haar.cpp
modules/objdetect/src/haar.cpp
+2
-1
lsvmparser.cpp
modules/objdetect/src/lsvmparser.cpp
+4
-2
No files found.
apps/haartraining/cvhaartraining.cpp
View file @
7fd1cfc5
...
...
@@ -1854,9 +1854,11 @@ int icvGetHaarTraininDataFromVecCallback( CvMat* img, void* userdata )
assert
(
img
->
rows
*
img
->
cols
==
((
CvVecFile
*
)
userdata
)
->
vecsize
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
((
CvVecFile
*
)
userdata
)
->
input
);
fread
(
((
CvVecFile
*
)
userdata
)
->
vector
,
sizeof
(
short
),
size_t
elements_read
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
((
CvVecFile
*
)
userdata
)
->
input
);
CV_Assert
(
elements_read
==
1
);
elements_read
=
fread
(
((
CvVecFile
*
)
userdata
)
->
vector
,
sizeof
(
short
),
((
CvVecFile
*
)
userdata
)
->
vecsize
,
((
CvVecFile
*
)
userdata
)
->
input
);
CV_Assert
(
elements_read
==
(
size_t
)((
CvVecFile
*
)
userdata
)
->
vecsize
);
if
(
feof
(
((
CvVecFile
*
)
userdata
)
->
input
)
||
(((
CvVecFile
*
)
userdata
)
->
last
)
++
>=
((
CvVecFile
*
)
userdata
)
->
count
)
...
...
@@ -1919,10 +1921,12 @@ int icvGetHaarTrainingDataFromVec( CvHaarTrainingData* data, int first, int coun
if
(
file
.
input
!=
NULL
)
{
fread
(
&
file
.
count
,
sizeof
(
file
.
count
),
1
,
file
.
input
);
fread
(
&
file
.
vecsize
,
sizeof
(
file
.
vecsize
),
1
,
file
.
input
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
size_t
elements_read1
=
fread
(
&
file
.
count
,
sizeof
(
file
.
count
),
1
,
file
.
input
);
size_t
elements_read2
=
fread
(
&
file
.
vecsize
,
sizeof
(
file
.
vecsize
),
1
,
file
.
input
);
size_t
elements_read3
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
size_t
elements_read4
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
CV_Assert
(
elements_read1
==
1
&&
elements_read2
==
1
&&
elements_read3
==
1
&&
elements_read4
==
1
);
if
(
!
feof
(
file
.
input
)
)
{
if
(
file
.
vecsize
!=
data
->
winsize
.
width
*
data
->
winsize
.
height
)
...
...
@@ -1970,10 +1974,11 @@ int icvGetHaarTrainingDataFromBG( CvHaarTrainingData* data, int first, int count
if
(
file
.
input
!=
NULL
)
{
fread
(
&
file
.
count
,
sizeof
(
file
.
count
),
1
,
file
.
input
);
fread
(
&
file
.
vecsize
,
sizeof
(
file
.
vecsize
),
1
,
file
.
input
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
size_t
elements_read1
=
fread
(
&
file
.
count
,
sizeof
(
file
.
count
),
1
,
file
.
input
);
size_t
elements_read2
=
fread
(
&
file
.
vecsize
,
sizeof
(
file
.
vecsize
),
1
,
file
.
input
);
size_t
elements_read3
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
size_t
elements_read4
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
CV_Assert
(
elements_read1
==
1
&&
elements_read2
==
1
&&
elements_read3
==
1
&&
elements_read4
==
1
);
if
(
!
feof
(
file
.
input
)
)
{
if
(
file
.
vecsize
!=
data
->
winsize
.
width
*
data
->
winsize
.
height
)
...
...
apps/haartraining/cvsamples.cpp
View file @
7fd1cfc5
...
...
@@ -884,10 +884,11 @@ void cvShowVecSamples( const char* filename, int winwidth, int winheight,
if
(
file
.
input
!=
NULL
)
{
fread
(
&
file
.
count
,
sizeof
(
file
.
count
),
1
,
file
.
input
);
fread
(
&
file
.
vecsize
,
sizeof
(
file
.
vecsize
),
1
,
file
.
input
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
size_t
elements_read1
=
fread
(
&
file
.
count
,
sizeof
(
file
.
count
),
1
,
file
.
input
);
size_t
elements_read2
=
fread
(
&
file
.
vecsize
,
sizeof
(
file
.
vecsize
),
1
,
file
.
input
);
size_t
elements_read3
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
size_t
elements_read4
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
.
input
);
CV_Assert
(
elements_read1
==
1
&&
elements_read2
==
1
&&
elements_read3
==
1
&&
elements_read4
==
1
);
if
(
file
.
vecsize
!=
winwidth
*
winheight
)
{
...
...
apps/traincascade/imagestorage.cpp
View file @
7fd1cfc5
...
...
@@ -150,8 +150,10 @@ bool CvCascadeImageReader::PosReader::get( Mat &_img )
{
CV_Assert
(
_img
.
rows
*
_img
.
cols
==
vecSize
);
uchar
tmp
=
0
;
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
);
fread
(
vec
,
sizeof
(
vec
[
0
]
),
vecSize
,
file
);
size_t
elements_read
=
fread
(
&
tmp
,
sizeof
(
tmp
),
1
,
file
);
CV_Assert
(
elements_read
==
1
);
elements_read
=
fread
(
vec
,
sizeof
(
vec
[
0
]
),
vecSize
,
file
);
CV_Assert
(
elements_read
==
(
size_t
)(
vecSize
));
if
(
feof
(
file
)
||
last
++
>=
count
)
return
false
;
...
...
modules/features2d/test/test_features2d.cpp
View file @
7fd1cfc5
...
...
@@ -269,13 +269,15 @@ static Mat readMatFromBin( const string& filename )
if
(
f
)
{
int
rows
,
cols
,
type
,
dataSize
;
fread
(
(
void
*
)
&
rows
,
sizeof
(
int
),
1
,
f
);
fread
(
(
void
*
)
&
cols
,
sizeof
(
int
),
1
,
f
);
fread
(
(
void
*
)
&
type
,
sizeof
(
int
),
1
,
f
);
fread
(
(
void
*
)
&
dataSize
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read1
=
fread
(
(
void
*
)
&
rows
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read2
=
fread
(
(
void
*
)
&
cols
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read3
=
fread
(
(
void
*
)
&
type
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read4
=
fread
(
(
void
*
)
&
dataSize
,
sizeof
(
int
),
1
,
f
);
CV_Assert
(
elements_read1
==
1
&&
elements_read2
==
1
&&
elements_read3
==
1
&&
elements_read4
==
1
);
uchar
*
data
=
(
uchar
*
)
cvAlloc
(
dataSize
);
fread
(
(
void
*
)
data
,
1
,
dataSize
,
f
);
size_t
elements_read
=
fread
(
(
void
*
)
data
,
1
,
dataSize
,
f
);
CV_Assert
(
elements_read
==
(
size_t
)(
dataSize
));
fclose
(
f
);
return
Mat
(
rows
,
cols
,
type
,
data
);
...
...
modules/nonfree/test/test_features2d.cpp
View file @
7fd1cfc5
...
...
@@ -268,13 +268,15 @@ static Mat readMatFromBin( const string& filename )
if
(
f
)
{
int
rows
,
cols
,
type
,
dataSize
;
fread
(
(
void
*
)
&
rows
,
sizeof
(
int
),
1
,
f
);
fread
(
(
void
*
)
&
cols
,
sizeof
(
int
),
1
,
f
);
fread
(
(
void
*
)
&
type
,
sizeof
(
int
),
1
,
f
);
fread
(
(
void
*
)
&
dataSize
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read1
=
fread
(
(
void
*
)
&
rows
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read2
=
fread
(
(
void
*
)
&
cols
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read3
=
fread
(
(
void
*
)
&
type
,
sizeof
(
int
),
1
,
f
);
size_t
elements_read4
=
fread
(
(
void
*
)
&
dataSize
,
sizeof
(
int
),
1
,
f
);
CV_Assert
(
elements_read1
==
1
&&
elements_read2
==
1
&&
elements_read3
==
1
&&
elements_read4
==
1
);
uchar
*
data
=
(
uchar
*
)
cvAlloc
(
dataSize
);
fread
(
(
void
*
)
data
,
1
,
dataSize
,
f
);
size_t
elements_read
=
fread
(
(
void
*
)
data
,
1
,
dataSize
,
f
);
CV_Assert
(
elements_read
==
(
size_t
)(
dataSize
));
fclose
(
f
);
return
Mat
(
rows
,
cols
,
type
,
data
);
...
...
modules/objdetect/src/haar.cpp
View file @
7fd1cfc5
...
...
@@ -1500,7 +1500,8 @@ cvLoadHaarClassifierCascade( const char* directory, CvSize orig_window_size )
fseek
(
f
,
0
,
SEEK_END
);
size
=
ftell
(
f
);
fseek
(
f
,
0
,
SEEK_SET
);
fread
(
ptr
,
1
,
size
,
f
);
size_t
elements_read
=
fread
(
ptr
,
1
,
size
,
f
);
CV_Assert
(
elements_read
==
(
size_t
)(
size
));
fclose
(
f
);
input_cascade
[
i
]
=
ptr
;
ptr
+=
size
;
...
...
modules/objdetect/src/lsvmparser.cpp
View file @
7fd1cfc5
...
...
@@ -244,7 +244,8 @@ void parserRFilter (FILE * xmlf, int p, CvLSVMFilterObject * model, float *b){
}
if
(
tagVal
==
WEIGHTS
){
data
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
p
*
sizeX
*
sizeY
);
fread
(
data
,
sizeof
(
double
),
p
*
sizeX
*
sizeY
,
xmlf
);
size_t
elements_read
=
fread
(
data
,
sizeof
(
double
),
p
*
sizeX
*
sizeY
,
xmlf
);
CV_Assert
(
elements_read
==
(
size_t
)(
p
*
sizeX
*
sizeY
));
model
->
H
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
p
*
sizeX
*
sizeY
);
for
(
ii
=
0
;
ii
<
p
*
sizeX
*
sizeY
;
ii
++
){
model
->
H
[
ii
]
=
(
float
)
data
[
ii
];
...
...
@@ -502,7 +503,8 @@ void parserPFilter (FILE * xmlf, int p, int /*N_path*/, CvLSVMFilterObject * mo
}
if
(
tagVal
==
WEIGHTS
){
data
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
p
*
sizeX
*
sizeY
);
fread
(
data
,
sizeof
(
double
),
p
*
sizeX
*
sizeY
,
xmlf
);
size_t
elements_read
=
fread
(
data
,
sizeof
(
double
),
p
*
sizeX
*
sizeY
,
xmlf
);
CV_Assert
(
elements_read
==
(
size_t
)(
p
*
sizeX
*
sizeY
));
model
->
H
=
(
float
*
)
malloc
(
sizeof
(
float
)
*
p
*
sizeX
*
sizeY
);
for
(
ii
=
0
;
ii
<
p
*
sizeX
*
sizeY
;
ii
++
){
model
->
H
[
ii
]
=
(
float
)
data
[
ii
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment