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
80695cde
Commit
80695cde
authored
Jun 12, 2014
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Jun 12, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Return correct buffer size when returning DBCS characters.
parent
89a558fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
time.c
dlls/kernel32/tests/time.c
+16
-1
time.c
dlls/kernel32/time.c
+7
-6
No files found.
dlls/kernel32/tests/time.c
View file @
80695cde
...
...
@@ -667,7 +667,7 @@ static void test_GetCalendarInfo(void)
char
bufferA
[
20
];
WCHAR
bufferW
[
20
];
DWORD
val1
,
val2
;
int
ret
;
int
ret
,
ret2
;
if
(
!
pGetCalendarInfoA
||
!
pGetCalendarInfoW
)
{
...
...
@@ -716,6 +716,21 @@ static void test_GetCalendarInfo(void)
ret
=
pGetCalendarInfoW
(
0x0409
,
CAL_GREGORIAN
,
CAL_ITWODIGITYEARMAX
,
NULL
,
0
,
NULL
);
ok
(
ret
,
"GetCalendarInfoW failed err %u
\n
"
,
GetLastError
()
);
ok
(
ret
==
5
,
"wrong size %u
\n
"
,
ret
);
ret
=
pGetCalendarInfoA
(
LANG_SYSTEM_DEFAULT
,
CAL_GREGORIAN
,
CAL_SDAYNAME1
,
bufferA
,
sizeof
(
bufferA
),
NULL
);
ok
(
ret
,
"GetCalendarInfoA failed err %u
\n
"
,
GetLastError
()
);
ret2
=
pGetCalendarInfoA
(
LANG_SYSTEM_DEFAULT
,
CAL_GREGORIAN
,
CAL_SDAYNAME1
,
bufferA
,
0
,
NULL
);
ok
(
ret2
,
"GetCalendarInfoA failed err %u
\n
"
,
GetLastError
()
);
ok
(
ret
==
ret2
,
"got %d, expected %d
\n
"
,
ret2
,
ret
);
ret2
=
pGetCalendarInfoW
(
LANG_SYSTEM_DEFAULT
,
CAL_GREGORIAN
,
CAL_SDAYNAME1
,
bufferW
,
sizeof
(
bufferW
),
NULL
);
ok
(
ret2
,
"GetCalendarInfoW failed err %u
\n
"
,
GetLastError
()
);
ret2
=
WideCharToMultiByte
(
CP_ACP
,
0
,
bufferW
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
ok
(
ret
==
ret2
,
"got %d, expected %d
\n
"
,
ret
,
ret2
);
}
START_TEST
(
time
)
...
...
dlls/kernel32/time.c
View file @
80695cde
...
...
@@ -614,7 +614,7 @@ BOOL WINAPI GetProcessTimes( HANDLE hprocess, LPFILETIME lpCreationTime,
int
WINAPI
GetCalendarInfoA
(
LCID
lcid
,
CALID
Calendar
,
CALTYPE
CalType
,
LPSTR
lpCalData
,
int
cchData
,
LPDWORD
lpValue
)
{
int
ret
;
int
ret
,
cchDataW
=
cchData
;
LPWSTR
lpCalDataW
=
NULL
;
if
(
NLS_IsUnicodeOnlyLcid
(
lcid
))
...
...
@@ -623,13 +623,14 @@ int WINAPI GetCalendarInfoA(LCID lcid, CALID Calendar, CALTYPE CalType,
return
0
;
}
if
(
cchData
&&
!
(
lpCalDataW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cchData
*
sizeof
(
WCHAR
))))
return
0
;
if
(
!
cchData
&&
!
(
CalType
&
CAL_RETURN_NUMBER
))
cchDataW
=
GetCalendarInfoW
(
lcid
,
Calendar
,
CalType
,
NULL
,
0
,
NULL
);
if
(
!
(
lpCalDataW
=
HeapAlloc
(
GetProcessHeap
(),
0
,
cchDataW
*
sizeof
(
WCHAR
))))
return
0
;
ret
=
GetCalendarInfoW
(
lcid
,
Calendar
,
CalType
,
lpCalDataW
,
cchData
,
lpValue
);
ret
=
GetCalendarInfoW
(
lcid
,
Calendar
,
CalType
,
lpCalDataW
,
cchData
W
,
lpValue
);
if
(
ret
&&
lpCalDataW
&&
lpCalData
)
WideCharToMultiByte
(
CP_ACP
,
0
,
lpCalDataW
,
-
1
,
lpCalData
,
cchData
,
NULL
,
NULL
);
ret
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpCalDataW
,
-
1
,
lpCalData
,
cchData
,
NULL
,
NULL
);
else
if
(
CalType
&
CAL_RETURN_NUMBER
)
ret
*=
sizeof
(
WCHAR
);
HeapFree
(
GetProcessHeap
(),
0
,
lpCalDataW
);
...
...
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