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
ebb6c842
Commit
ebb6c842
authored
Aug 21, 2013
by
Roman Donchenko
Committed by
OpenCV Buildbot
Aug 21, 2013
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1295 from asmorkalov:winrt_ptr_usage_fix
parents
1a7c2eef
d62c9852
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 @
ebb6c842
...
...
@@ -11,7 +11,7 @@
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
;
list
.
clear
();
...
...
@@ -25,10 +25,9 @@ namespace cv
HANDLE
hFind
;
#ifdef HAVE_WINRT
size_t
size
=
mbstowcs
(
NULL
,
path_f
.
c_str
(),
path_f
.
size
());
Ptr
<
wchar_t
>
wpath
=
new
wchar_t
[
size
+
1
];
wpath
[
size
]
=
0
;
mbstowcs
(
wpath
,
path_f
.
c_str
(),
path_f
.
size
());
wchar_t
wpath
[
MAX_PATH
];
size_t
copied
=
mbstowcs
(
wpath
,
path_f
.
c_str
(),
MAX_PATH
);
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
hFind
=
FindFirstFileExW
(
wpath
,
FindExInfoStandard
,
&
FindFileData
,
FindExSearchNameMatch
,
NULL
,
0
);
#else
hFind
=
FindFirstFileA
((
LPCSTR
)
path_f
.
c_str
(),
&
FindFileData
);
...
...
@@ -47,12 +46,12 @@ namespace cv
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_SYSTEM
||
FindFileData
.
dwFileAttributes
==
FILE_ATTRIBUTE_READONLY
)
{
c
v
::
Ptr
<
char
>
fname
;
c
har
*
fname
;
#ifdef HAVE_WINRT
size_t
asize
=
wcstombs
(
NULL
,
FindFileData
.
cFileName
,
0
)
;
fname
=
new
char
[
asize
+
1
]
;
fname
[
asize
]
=
0
;
wcstombs
(
fname
,
FindFileData
.
cFileName
,
asize
)
;
char
fname_tmp
[
MAX_PATH
]
=
{
0
}
;
size_t
copied
=
wcstombs
(
fname_tmp
,
FindFileData
.
cFileName
,
MAX_PATH
)
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
))
;
fname
=
fname_tmp
;
#else
fname
=
FindFileData
.
cFileName
;
#endif
...
...
@@ -109,10 +108,10 @@ namespace cv
HANDLE
hFind
;
#ifdef HAVE_WINRT
size_t
size
=
mbstowcs
(
NULL
,
path_f
.
c_str
(),
path_f
.
size
())
;
Ptr
<
wchar_t
>
wpath
=
new
wchar_t
[
size
+
1
]
;
wpath
[
size
]
=
0
;
mbstowcs
(
wpath
,
path_f
.
c_str
(),
path_f
.
size
());
wchar_t
wpath
[
MAX_PATH
]
;
size_t
copied
=
mbstowcs
(
wpath
,
path_f
.
c_str
(),
path_f
.
size
())
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
))
;
hFind
=
FindFirstFileExW
(
wpath
,
FindExInfoStandard
,
&
FindFileData
,
FindExSearchNameMatch
,
NULL
,
0
);
#else
hFind
=
FindFirstFileA
((
LPCSTR
)
path_f
.
c_str
(),
&
FindFileData
);
...
...
@@ -135,12 +134,12 @@ namespace cv
strcmp
(
FindFileData
.
cFileName
,
".."
)
!=
0
)
#endif
{
c
v
::
Ptr
<
char
>
fname
;
c
har
*
fname
;
#ifdef HAVE_WINRT
size_t
asize
=
wcstombs
(
NULL
,
FindFileData
.
cFileName
,
0
)
;
fname
=
new
char
[
asize
+
1
]
;
fname
[
asize
]
=
0
;
wcstombs
(
fname
,
FindFileData
.
cFileName
,
asize
)
;
char
fname_tmp
[
MAX_PATH
]
;
size_t
copied
=
wcstombs
(
fname
,
FindFileData
.
cFileName
,
MAX_PATH
)
;
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
))
;
fname
=
fname_tmp
;
#else
fname
=
FindFileData
.
cFileName
;
#endif
...
...
modules/core/src/glob.cpp
View file @
ebb6c842
...
...
@@ -79,10 +79,9 @@ namespace
dir
->
ent
.
d_name
=
0
;
#ifdef HAVE_WINRT
cv
::
String
full_path
=
cv
::
String
(
path
)
+
"
\\
*"
;
size_t
size
=
mbstowcs
(
NULL
,
full_path
.
c_str
(),
full_path
.
size
());
cv
::
Ptr
<
wchar_t
>
wfull_path
=
new
wchar_t
[
size
+
1
];
wfull_path
[
size
]
=
0
;
mbstowcs
(
wfull_path
,
full_path
.
c_str
(),
full_path
.
size
());
wchar_t
wfull_path
[
MAX_PATH
];
size_t
copied
=
mbstowcs
(
wfull_path
,
full_path
.
c_str
(),
MAX_PATH
);
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
dir
->
handle
=
::
FindFirstFileExW
(
wfull_path
,
FindExInfoStandard
,
&
dir
->
data
,
FindExSearchNameMatch
,
NULL
,
0
);
#else
...
...
@@ -106,6 +105,7 @@ namespace
return
0
;
}
size_t
asize
=
wcstombs
(
NULL
,
dir
->
data
.
cFileName
,
0
);
CV_Assert
((
asize
!=
0
)
&&
(
asize
!=
(
size_t
)
-
1
));
char
*
aname
=
new
char
[
asize
+
1
];
aname
[
asize
]
=
0
;
wcstombs
(
aname
,
dir
->
data
.
cFileName
,
asize
);
...
...
@@ -146,10 +146,9 @@ static bool isDir(const cv::String& path, DIR* dir)
{
WIN32_FILE_ATTRIBUTE_DATA
all_attrs
;
#ifdef HAVE_WINRT
size_t
size
=
mbstowcs
(
NULL
,
path
.
c_str
(),
path
.
size
());
cv
::
Ptr
<
wchar_t
>
wpath
=
new
wchar_t
[
size
+
1
];
wpath
[
size
]
=
0
;
mbstowcs
(
wpath
,
path
.
c_str
(),
path
.
size
());
wchar_t
wpath
[
MAX_PATH
];
size_t
copied
=
mbstowcs
(
wpath
,
path
.
c_str
(),
MAX_PATH
);
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
::
GetFileAttributesExW
(
wpath
,
GetFileExInfoStandard
,
&
all_attrs
);
#else
::
GetFileAttributesExA
(
path
.
c_str
(),
GetFileExInfoStandard
,
&
all_attrs
);
...
...
modules/core/src/system.cpp
View file @
ebb6c842
...
...
@@ -411,15 +411,14 @@ string tempfile( const char* suffix )
temp_file
=
temp_dir
+
std
::
wstring
(
L"
\\
"
)
+
temp_file
;
DeleteFileW
(
temp_file
.
c_str
());
size_t
asize
=
wcstombs
(
NULL
,
temp_file
.
c_str
(),
0
);
Ptr
<
char
>
aname
=
new
char
[
asize
+
1
];
aname
[
asize
]
=
0
;
wcstombs
(
aname
,
temp_file
.
c_str
(),
asize
);
char
aname
[
MAX_PATH
];
size_t
copied
=
wcstombs
(
aname
,
temp_file
.
c_str
(),
MAX_PATH
);
CV_Assert
((
copied
!=
MAX_PATH
)
&&
(
copied
!=
(
size_t
)
-
1
));
fname
=
std
::
string
(
aname
);
RoUninitialize
();
#else
char
temp_dir2
[
MAX_PATH
+
1
]
=
{
0
};
char
temp_file
[
MAX_PATH
+
1
]
=
{
0
};
char
temp_dir2
[
MAX_PATH
]
=
{
0
};
char
temp_file
[
MAX_PATH
]
=
{
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