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
d62c9852
Commit
d62c9852
authored
Aug 19, 2013
by
Alexander Smorkalov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Invalid usage of cv::Ptr for arrays fixed.
parent
449b99a6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
33 deletions
+30
-33
inputoutput.cpp
modules/contrib/src/inputoutput.cpp
+18
-19
glob.cpp
modules/core/src/glob.cpp
+7
-8
system.cpp
modules/core/src/system.cpp
+5
-6
No files found.
modules/contrib/src/inputoutput.cpp
View file @
d62c9852
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
namespace
cv
namespace
cv
{
{
std
::
vector
<
std
::
string
>
Directory
::
GetListFiles
(
const
std
::
string
&
path
,
const
std
::
string
&
exten
,
bool
addPath
)
std
::
vector
<
std
::
string
>
Directory
::
GetListFiles
(
const
std
::
string
&
path
,
const
std
::
string
&
exten
,
bool
addPath
)
{
{
std
::
vector
<
std
::
string
>
list
;
std
::
vector
<
std
::
string
>
list
;
list
.
clear
();
list
.
clear
();
...
@@ -25,10 +25,9 @@ namespace cv
...
@@ -25,10 +25,9 @@ namespace cv
HANDLE
hFind
;
HANDLE
hFind
;
#ifdef HAVE_WINRT
#ifdef HAVE_WINRT
size_t
size
=
mbstowcs
(
NULL
,
path_f
.
c_str
(),
path_f
.
size
());
wchar_t
wpath
[
MAX_PATH
];
Ptr
<
wchar_t
>
wpath
=
new
wchar_t
[
size
+
1
];
size_t
copied
=
mbstowcs
(
wpath
,
path_f
.
c_str
(),
MAX_PATH
);
wpath
[
size
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
mbstowcs
(
wpath
,
path_f
.
c_str
(),
path_f
.
size
());
hFind
=
FindFirstFileExW
(
wpath
,
FindExInfoStandard
,
&
FindFileData
,
FindExSearchNameMatch
,
NULL
,
0
);
hFind
=
FindFirstFileExW
(
wpath
,
FindExInfoStandard
,
&
FindFileData
,
FindExSearchNameMatch
,
NULL
,
0
);
#else
#else
hFind
=
FindFirstFileA
((
LPCSTR
)
path_f
.
c_str
(),
&
FindFileData
);
hFind
=
FindFirstFileA
((
LPCSTR
)
path_f
.
c_str
(),
&
FindFileData
);
...
@@ -47,12 +46,12 @@ namespace cv
...
@@ -47,12 +46,12 @@ namespace cv
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_SYSTEM
||
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_SYSTEM
||
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_READONLY
)
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_READONLY
)
{
{
c
v
::
Ptr
<
char
>
fname
;
c
har
*
fname
;
#ifdef HAVE_WINRT
#ifdef HAVE_WINRT
size_t
asize
=
wcstombs
(
NULL
,
FindFileData
.
cFileName
,
0
)
;
char
fname_tmp
[
MAX_PATH
]
=
{
0
}
;
fname
=
new
char
[
asize
+
1
]
;
size_t
copied
=
wcstombs
(
fname_tmp
,
FindFileData
.
cFileName
,
MAX_PATH
)
;
fname
[
asize
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
))
;
wcstombs
(
fname
,
FindFileData
.
cFileName
,
asize
)
;
fname
=
fname_tmp
;
#else
#else
fname
=
FindFileData
.
cFileName
;
fname
=
FindFileData
.
cFileName
;
#endif
#endif
...
@@ -109,10 +108,10 @@ namespace cv
...
@@ -109,10 +108,10 @@ namespace cv
HANDLE
hFind
;
HANDLE
hFind
;
#ifdef HAVE_WINRT
#ifdef HAVE_WINRT
size_t
size
=
mbstowcs
(
NULL
,
path_f
.
c_str
(),
path_f
.
size
())
;
wchar_t
wpath
[
MAX_PATH
]
;
Ptr
<
wchar_t
>
wpath
=
new
wchar_t
[
size
+
1
]
;
size_t
copied
=
mbstowcs
(
wpath
,
path_f
.
c_str
(),
path_f
.
size
())
;
wpath
[
size
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
))
;
mbstowcs
(
wpath
,
path_f
.
c_str
(),
path_f
.
size
());
hFind
=
FindFirstFileExW
(
wpath
,
FindExInfoStandard
,
&
FindFileData
,
FindExSearchNameMatch
,
NULL
,
0
);
hFind
=
FindFirstFileExW
(
wpath
,
FindExInfoStandard
,
&
FindFileData
,
FindExSearchNameMatch
,
NULL
,
0
);
#else
#else
hFind
=
FindFirstFileA
((
LPCSTR
)
path_f
.
c_str
(),
&
FindFileData
);
hFind
=
FindFirstFileA
((
LPCSTR
)
path_f
.
c_str
(),
&
FindFileData
);
...
@@ -135,12 +134,12 @@ namespace cv
...
@@ -135,12 +134,12 @@ namespace cv
strcmp
(
FindFileData
.
cFileName
,
".."
)
!=
0
)
strcmp
(
FindFileData
.
cFileName
,
".."
)
!=
0
)
#endif
#endif
{
{
c
v
::
Ptr
<
char
>
fname
;
c
har
*
fname
;
#ifdef HAVE_WINRT
#ifdef HAVE_WINRT
size_t
asize
=
wcstombs
(
NULL
,
FindFileData
.
cFileName
,
0
)
;
char
fname_tmp
[
MAX_PATH
]
;
fname
=
new
char
[
asize
+
1
]
;
size_t
copied
=
wcstombs
(
fname
,
FindFileData
.
cFileName
,
MAX_PATH
)
;
fname
[
asize
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
))
;
wcstombs
(
fname
,
FindFileData
.
cFileName
,
asize
)
;
fname
=
fname_tmp
;
#else
#else
fname
=
FindFileData
.
cFileName
;
fname
=
FindFileData
.
cFileName
;
#endif
#endif
...
...
modules/core/src/glob.cpp
View file @
d62c9852
...
@@ -79,10 +79,9 @@ namespace
...
@@ -79,10 +79,9 @@ namespace
dir
->
ent
.
d_name
=
0
;
dir
->
ent
.
d_name
=
0
;
#ifdef HAVE_WINRT
#ifdef HAVE_WINRT
cv
::
String
full_path
=
cv
::
String
(
path
)
+
"
\\
*"
;
cv
::
String
full_path
=
cv
::
String
(
path
)
+
"
\\
*"
;
size_t
size
=
mbstowcs
(
NULL
,
full_path
.
c_str
(),
full_path
.
size
());
wchar_t
wfull_path
[
MAX_PATH
];
cv
::
Ptr
<
wchar_t
>
wfull_path
=
new
wchar_t
[
size
+
1
];
size_t
copied
=
mbstowcs
(
wfull_path
,
full_path
.
c_str
(),
MAX_PATH
);
wfull_path
[
size
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
mbstowcs
(
wfull_path
,
full_path
.
c_str
(),
full_path
.
size
());
dir
->
handle
=
::
FindFirstFileExW
(
wfull_path
,
FindExInfoStandard
,
dir
->
handle
=
::
FindFirstFileExW
(
wfull_path
,
FindExInfoStandard
,
&
dir
->
data
,
FindExSearchNameMatch
,
NULL
,
0
);
&
dir
->
data
,
FindExSearchNameMatch
,
NULL
,
0
);
#else
#else
...
@@ -106,6 +105,7 @@ namespace
...
@@ -106,6 +105,7 @@ namespace
return
0
;
return
0
;
}
}
size_t
asize
=
wcstombs
(
NULL
,
dir
->
data
.
cFileName
,
0
);
size_t
asize
=
wcstombs
(
NULL
,
dir
->
data
.
cFileName
,
0
);
CV_Assert
((
asize
!=
0
)
&&
(
asize
!=
(
size_t
)
-
1
));
char
*
aname
=
new
char
[
asize
+
1
];
char
*
aname
=
new
char
[
asize
+
1
];
aname
[
asize
]
=
0
;
aname
[
asize
]
=
0
;
wcstombs
(
aname
,
dir
->
data
.
cFileName
,
asize
);
wcstombs
(
aname
,
dir
->
data
.
cFileName
,
asize
);
...
@@ -146,10 +146,9 @@ static bool isDir(const cv::String& path, DIR* dir)
...
@@ -146,10 +146,9 @@ static bool isDir(const cv::String& path, DIR* dir)
{
{
WIN32_FILE_ATTRIBUTE_DATA
all_attrs
;
WIN32_FILE_ATTRIBUTE_DATA
all_attrs
;
#ifdef HAVE_WINRT
#ifdef HAVE_WINRT
size_t
size
=
mbstowcs
(
NULL
,
path
.
c_str
(),
path
.
size
());
wchar_t
wpath
[
MAX_PATH
];
cv
::
Ptr
<
wchar_t
>
wpath
=
new
wchar_t
[
size
+
1
];
size_t
copied
=
mbstowcs
(
wpath
,
path
.
c_str
(),
MAX_PATH
);
wpath
[
size
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
mbstowcs
(
wpath
,
path
.
c_str
(),
path
.
size
());
::
GetFileAttributesExW
(
wpath
,
GetFileExInfoStandard
,
&
all_attrs
);
::
GetFileAttributesExW
(
wpath
,
GetFileExInfoStandard
,
&
all_attrs
);
#else
#else
::
GetFileAttributesExA
(
path
.
c_str
(),
GetFileExInfoStandard
,
&
all_attrs
);
::
GetFileAttributesExA
(
path
.
c_str
(),
GetFileExInfoStandard
,
&
all_attrs
);
...
...
modules/core/src/system.cpp
View file @
d62c9852
...
@@ -411,15 +411,14 @@ string tempfile( const char* suffix )
...
@@ -411,15 +411,14 @@ string tempfile( const char* suffix )
temp_file
=
temp_dir
+
std
::
wstring
(
L"
\\
"
)
+
temp_file
;
temp_file
=
temp_dir
+
std
::
wstring
(
L"
\\
"
)
+
temp_file
;
DeleteFileW
(
temp_file
.
c_str
());
DeleteFileW
(
temp_file
.
c_str
());
size_t
asize
=
wcstombs
(
NULL
,
temp_file
.
c_str
(),
0
);
char
aname
[
MAX_PATH
];
Ptr
<
char
>
aname
=
new
char
[
asize
+
1
];
size_t
copied
=
wcstombs
(
aname
,
temp_file
.
c_str
(),
MAX_PATH
);
aname
[
asize
]
=
0
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
wcstombs
(
aname
,
temp_file
.
c_str
(),
asize
);
fname
=
std
::
string
(
aname
);
fname
=
std
::
string
(
aname
);
RoUninitialize
();
RoUninitialize
();
#else
#else
char
temp_dir2
[
MAX_PATH
+
1
]
=
{
0
};
char
temp_dir2
[
MAX_PATH
]
=
{
0
};
char
temp_file
[
MAX_PATH
+
1
]
=
{
0
};
char
temp_file
[
MAX_PATH
]
=
{
0
};
if
(
temp_dir
==
0
||
temp_dir
[
0
]
==
0
)
if
(
temp_dir
==
0
||
temp_dir
[
0
]
==
0
)
{
{
...
...
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