Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Joe Martin
OpenLDAP
Commits
ec32e900
Commit
ec32e900
authored
Dec 15, 2015
by
Howard Chu
Browse files
ITS#7992 cleanup
check for utf8_to_utf16 failures
parent
18caeaa7
Changes
1
Hide whitespace changes
Inline
Side-by-side
libraries/liblmdb/mdb.c
View file @
ec32e900
...
...
@@ -4470,7 +4470,9 @@ mdb_env_setup_locks(MDB_env *env, char *lpath, int mode, int *excl)
#ifdef _WIN32
wchar_t
*
wlpath
;
utf8_to_utf16
(
lpath
,
-
1
,
&
wlpath
,
NULL
);
rc
=
utf8_to_utf16
(
lpath
,
-
1
,
&
wlpath
,
NULL
);
if
(
rc
)
return
rc
;
env
->
me_lfd
=
CreateFileW
(
wlpath
,
GENERIC_READ
|
GENERIC_WRITE
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
OPEN_ALWAYS
,
FILE_ATTRIBUTE_NORMAL
,
NULL
);
...
...
@@ -4758,7 +4760,9 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
len
=
OPEN_ALWAYS
;
}
mode
=
FILE_ATTRIBUTE_NORMAL
;
utf8_to_utf16
(
dpath
,
-
1
,
&
wpath
,
NULL
);
rc
=
utf8_to_utf16
(
dpath
,
-
1
,
&
wpath
,
NULL
);
if
(
rc
)
goto
leave
;
env
->
me_fd
=
CreateFileW
(
wpath
,
oflags
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
len
,
mode
,
NULL
);
free
(
wpath
);
...
...
@@ -4790,7 +4794,9 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode
*/
#ifdef _WIN32
len
=
OPEN_EXISTING
;
utf8_to_utf16
(
dpath
,
-
1
,
&
wpath
,
NULL
);
rc
=
utf8_to_utf16
(
dpath
,
-
1
,
&
wpath
,
NULL
);
if
(
rc
)
goto
leave
;
env
->
me_mfd
=
CreateFileW
(
wpath
,
oflags
,
FILE_SHARE_READ
|
FILE_SHARE_WRITE
,
NULL
,
len
,
mode
|
FILE_FLAG_WRITE_THROUGH
,
NULL
);
...
...
@@ -9281,7 +9287,9 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags)
* already in the OS cache.
*/
#ifdef _WIN32
utf8_to_utf16
(
lpath
,
-
1
,
&
wpath
,
NULL
);
rc
=
utf8_to_utf16
(
lpath
,
-
1
,
&
wpath
,
NULL
);
if
(
rc
)
return
rc
;
newfd
=
CreateFileW
(
wpath
,
GENERIC_WRITE
,
0
,
NULL
,
CREATE_NEW
,
FILE_FLAG_NO_BUFFERING
|
FILE_FLAG_WRITE_THROUGH
,
NULL
);
free
(
wpath
);
...
...
@@ -10013,6 +10021,8 @@ static int utf8_to_utf16(const char *src, int srcsize, wchar_t **dst, int *dstsi
if
(
need
==
0
)
return
EINVAL
;
result
=
malloc
(
sizeof
(
wchar_t
)
*
need
);
if
(
!
result
)
return
ENOMEM
;
MultiByteToWideChar
(
CP_UTF8
,
0
,
src
,
srcsize
,
result
,
need
);
if
(
dstsize
)
*
dstsize
=
need
;
...
...
Write
Preview
Supports
Markdown
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