Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2e191309
Commit
2e191309
authored
Jun 30, 2009
by
Detlef Riekenberg
Committed by
Alexandre Julliard
Jul 01, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shlwapi: Last parameter in SHUnicodeToAnsiCP is an int.
parent
1daf40a8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
38 deletions
+40
-38
shlwapi.spec
dlls/shlwapi/shlwapi.spec
+1
-1
string.c
dlls/shlwapi/string.c
+39
-37
No files found.
dlls/shlwapi/shlwapi.spec
View file @
2e191309
...
...
@@ -215,7 +215,7 @@
215 stdcall -noname SHAnsiToUnicode(str ptr long)
216 stdcall -noname SHAnsiToUnicodeCP(long str ptr long)
217 stdcall -noname SHUnicodeToAnsi(wstr ptr ptr)
218 stdcall -noname SHUnicodeToAnsiCP(long wstr ptr
ptr
)
218 stdcall -noname SHUnicodeToAnsiCP(long wstr ptr
long
)
219 stdcall -noname QISearch(long long long long)
220 stdcall -noname SHSetDefaultDialogFont(ptr long)
221 stdcall -noname SHRemoveDefaultDialogFont(ptr)
...
...
dlls/shlwapi/string.c
View file @
2e191309
...
...
@@ -2477,20 +2477,24 @@ DWORD WINAPI SHAnsiToUnicode(LPCSTR lpSrcStr, LPWSTR lpDstStr, int iLen)
* CodePage [I] Code page to use for the conversion
* lpSrcStr [I] Source Unicode string to convert
* lpDstStr [O] Destination for converted Ascii string
*
lpiLen [I/O] Input length of lpDstStr/destination for length of
lpDstStr
*
dstlen [I] Length of buffer at
lpDstStr
*
* RETURNS
* Success: The number of characters that result from the conversion.
* Failure: 0.
* Success: The length in bytes of the result at lpDstStr (including the terminator)
* Failure: When using CP_UTF8, CP_UTF7 or 0xc350 as codePage, 0 is returned and
* the result is not nul-terminated.
* When using a different codepage, the length in bytes of the truncated
* result at lpDstStr (including the terminator) is returned and
* lpDstStr is always nul-terminated.
*
*/
INT
WINAPI
SHUnicodeToAnsiCP
(
UINT
CodePage
,
LPCWSTR
lpSrcStr
,
LPSTR
lpDstStr
,
LPINT
lpiLen
)
DWORD
WINAPI
SHUnicodeToAnsiCP
(
UINT
CodePage
,
LPCWSTR
lpSrcStr
,
LPSTR
lpDstStr
,
int
dstlen
)
{
static
const
WCHAR
emptyW
[]
=
{
'\0'
};
int
len
,
reqLen
;
LPSTR
mem
;
if
(
!
lpDstStr
||
!
lpiL
en
)
if
(
!
lpDstStr
||
!
dstl
en
)
return
0
;
if
(
!
lpSrcStr
)
...
...
@@ -2509,41 +2513,41 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
case
CP_UTF8
:
{
DWORD
dwMode
=
0
;
INT
nWideCharCount
=
len
-
1
;
if
(
ConvertINetUnicodeToMultiByte
(
&
dwMode
,
CodePage
,
lpSrcStr
,
&
nWideCharCount
,
lpDstStr
,
lpiLen
)
==
S_OK
)
return
0
;
INT
lenW
=
len
-
1
;
INT
needed
=
dstlen
-
1
;
HRESULT
hr
;
if
(
nWideCharCount
<
len
-
1
)
/* try the user supplied buffer first */
hr
=
ConvertINetUnicodeToMultiByte
(
&
dwMode
,
CodePage
,
lpSrcStr
,
&
lenW
,
lpDstStr
,
&
needed
);
if
(
hr
==
S_OK
)
{
mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
*
lpiLen
)
;
if
(
!
mem
)
return
0
;
lpDstStr
[
needed
]
=
'\0'
;
return
needed
+
1
;
}
*
lpiLen
=
0
;
/* user buffer too small. exclude termination and copy as much as possible */
lenW
=
len
;
hr
=
ConvertINetUnicodeToMultiByte
(
&
dwMode
,
CodePage
,
lpSrcStr
,
&
lenW
,
NULL
,
&
needed
);
needed
++
;
mem
=
HeapAlloc
(
GetProcessHeap
(),
0
,
needed
);
if
(
!
mem
)
return
0
;
if
(
ConvertINetUnicodeToMultiByte
(
&
dwMode
,
CodePage
,
lpSrcStr
,
&
len
,
mem
,
lpiLen
)
!=
S_OK
)
{
SHTruncateString
(
mem
,
*
lpiLen
);
lstrcpynA
(
lpDstStr
,
mem
,
*
lpiLen
+
1
);
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
return
*
lpiLen
+
1
;
}
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
return
*
lpiLen
;
hr
=
ConvertINetUnicodeToMultiByte
(
&
dwMode
,
CodePage
,
lpSrcStr
,
&
len
,
mem
,
&
needed
);
if
(
hr
==
S_OK
)
{
reqLen
=
SHTruncateString
(
mem
,
dstlen
);
if
(
reqLen
>
0
)
memcpy
(
lpDstStr
,
mem
,
reqLen
-
1
);
}
lpDstStr
[
*
lpiLen
]
=
'\0'
;
return
*
lpiLen
;
HeapFree
(
GetProcessHeap
(),
0
,
mem
)
;
return
0
;
}
default:
break
;
}
reqLen
=
WideCharToMultiByte
(
CodePage
,
0
,
lpSrcStr
,
len
,
lpDstStr
,
*
lpiL
en
,
NULL
,
NULL
);
/* try the user supplied buffer first */
reqLen
=
WideCharToMultiByte
(
CodePage
,
0
,
lpSrcStr
,
len
,
lpDstStr
,
dstl
en
,
NULL
,
NULL
);
if
(
!
reqLen
&&
GetLastError
()
==
ERROR_INSUFFICIENT_BUFFER
)
{
...
...
@@ -2556,12 +2560,12 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
reqLen
=
WideCharToMultiByte
(
CodePage
,
0
,
lpSrcStr
,
len
,
mem
,
reqLen
,
NULL
,
NULL
);
reqLen
=
SHTruncateString
(
mem
,
*
lpiLen
);
reqLen
=
SHTruncateString
(
mem
,
dstlen
-
1
);
reqLen
++
;
lstrcpynA
(
lpDstStr
,
mem
,
*
lpiLen
);
lstrcpynA
(
lpDstStr
,
mem
,
reqLen
);
HeapFree
(
GetProcessHeap
(),
0
,
mem
);
lpDstStr
[
reqLen
-
1
]
=
'\0'
;
}
}
}
...
...
@@ -2586,9 +2590,7 @@ INT WINAPI SHUnicodeToAnsiCP(UINT CodePage, LPCWSTR lpSrcStr, LPSTR lpDstStr,
*/
INT
WINAPI
SHUnicodeToAnsi
(
LPCWSTR
lpSrcStr
,
LPSTR
lpDstStr
,
INT
iLen
)
{
INT
myint
=
iLen
;
return
SHUnicodeToAnsiCP
(
CP_ACP
,
lpSrcStr
,
lpDstStr
,
&
myint
);
return
SHUnicodeToAnsiCP
(
CP_ACP
,
lpSrcStr
,
lpDstStr
,
iLen
);
}
/*************************************************************************
...
...
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