Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
113a50a8
Commit
113a50a8
authored
Nov 25, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Nov 26, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: Do ascii to integer conversion only once.
parent
40bbe3da
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
datetime.c
dlls/comctl32/datetime.c
+21
-19
No files found.
dlls/comctl32/datetime.c
View file @
113a50a8
...
...
@@ -954,30 +954,32 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
int
fieldNum
=
infoPtr
->
select
&
DTHT_DATEFIELD
;
if
(
vkCode
>=
'0'
&&
vkCode
<=
'9'
)
{
int
num
=
vkCode
-
'0'
;
/* this is a somewhat simplified version of what Windows does */
SYSTEMTIME
*
date
=
&
infoPtr
->
date
;
switch
(
infoPtr
->
fieldspec
[
fieldNum
])
{
case
ONEDIGITYEAR
:
case
TWODIGITYEAR
:
date
->
wYear
=
date
->
wYear
-
(
date
->
wYear
%
100
)
+
(
date
->
wYear
%
10
)
*
10
+
(
vkCode
-
'0'
)
;
(
date
->
wYear
%
10
)
*
10
+
num
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
INVALIDFULLYEAR
:
case
FULLYEAR
:
date
->
wYear
=
(
date
->
wYear
%
1000
)
*
10
+
(
vkCode
-
'0'
)
;
date
->
wYear
=
(
date
->
wYear
%
1000
)
*
10
+
num
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITMONTH
:
case
TWODIGITMONTH
:
if
((
date
->
wMonth
%
10
)
>
1
||
(
vkCode
-
'0'
)
>
2
)
date
->
wMonth
=
vkCode
-
'0'
;
if
((
date
->
wMonth
%
10
)
>
1
||
num
>
2
)
date
->
wMonth
=
num
;
else
date
->
wMonth
=
(
date
->
wMonth
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wMonth
=
(
date
->
wMonth
%
10
)
*
10
+
num
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
...
...
@@ -985,46 +987,46 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode, LPARAM keyData)
case
ONEDIGITDAY
:
case
TWODIGITDAY
:
/* probably better checking here would help */
if
((
date
->
wDay
%
10
)
>=
3
&&
(
vkCode
-
'0'
)
>
1
)
date
->
wDay
=
vkCode
-
'0'
;
if
((
date
->
wDay
%
10
)
>=
3
&&
num
>
1
)
date
->
wDay
=
num
;
else
date
->
wDay
=
(
date
->
wDay
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wDay
=
(
date
->
wDay
%
10
)
*
10
+
num
;
date
->
wDayOfWeek
=
DATETIME_CalculateDayOfWeek
(
date
->
wDay
,
date
->
wMonth
,
date
->
wYear
);
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGIT12HOUR
:
case
TWODIGIT12HOUR
:
if
((
date
->
wHour
%
10
)
>
1
||
(
vkCode
-
'0'
)
>
2
)
date
->
wHour
=
vkCode
-
'0'
;
if
((
date
->
wHour
%
10
)
>
1
||
num
>
2
)
date
->
wHour
=
num
;
else
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
num
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGIT24HOUR
:
case
TWODIGIT24HOUR
:
if
((
date
->
wHour
%
10
)
>
2
)
date
->
wHour
=
vkCode
-
'0'
;
else
if
((
date
->
wHour
%
10
)
==
2
&&
(
vkCode
-
'0'
)
>
3
)
date
->
wHour
=
vkCode
-
'0'
;
date
->
wHour
=
num
;
else
if
((
date
->
wHour
%
10
)
==
2
&&
num
>
3
)
date
->
wHour
=
num
;
else
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wHour
=
(
date
->
wHour
%
10
)
*
10
+
num
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITMINUTE
:
case
TWODIGITMINUTE
:
if
((
date
->
wMinute
%
10
)
>
5
)
date
->
wMinute
=
vkCode
-
'0'
;
date
->
wMinute
=
num
;
else
date
->
wMinute
=
(
date
->
wMinute
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wMinute
=
(
date
->
wMinute
%
10
)
*
10
+
num
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
case
ONEDIGITSECOND
:
case
TWODIGITSECOND
:
if
((
date
->
wSecond
%
10
)
>
5
)
date
->
wSecond
=
vkCode
-
'0'
;
date
->
wSecond
=
num
;
else
date
->
wSecond
=
(
date
->
wSecond
%
10
)
*
10
+
vkCode
-
'0'
;
date
->
wSecond
=
(
date
->
wSecond
%
10
)
*
10
+
num
;
DATETIME_SendDateTimeChangeNotify
(
infoPtr
);
break
;
}
...
...
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