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
41025d56
Commit
41025d56
authored
Feb 22, 2008
by
Mikołaj Zalewski
Committed by
Alexandre Julliard
Feb 25, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32: datetime: Support literals in apostrophes.
parent
a871830d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
23 deletions
+47
-23
datetime.c
dlls/comctl32/datetime.c
+34
-23
datetime.c
dlls/comctl32/tests/datetime.c
+13
-0
No files found.
dlls/comctl32/datetime.c
View file @
41025d56
...
...
@@ -133,8 +133,8 @@ extern int MONTHCAL_MonthLength(int month, int year);
static
BOOL
DATETIME_SendSimpleNotify
(
const
DATETIME_INFO
*
infoPtr
,
UINT
code
);
static
BOOL
DATETIME_SendDateTimeChangeNotify
(
const
DATETIME_INFO
*
infoPtr
);
extern
void
MONTHCAL_CopyTime
(
const
SYSTEMTIME
*
from
,
SYSTEMTIME
*
to
);
static
const
WCHAR
allowedformatchars
[]
=
{
'd'
,
'h'
,
'H'
,
'm'
,
'M'
,
's'
,
't'
,
'y'
,
'X'
,
'\''
,
0
};
static
const
int
maxrepetition
[]
=
{
4
,
2
,
2
,
2
,
4
,
2
,
2
,
4
,
-
1
,
-
1
};
static
const
WCHAR
allowedformatchars
[]
=
{
'd'
,
'h'
,
'H'
,
'm'
,
'M'
,
's'
,
't'
,
'y'
,
'X'
,
0
};
static
const
int
maxrepetition
[]
=
{
4
,
2
,
2
,
2
,
4
,
2
,
2
,
4
,
-
1
};
static
DWORD
...
...
@@ -205,6 +205,7 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
{
unsigned
int
i
;
int
j
,
k
,
len
;
BOOL
inside_literal
=
FALSE
;
/* inside '...' */
int
*
nrFields
=
&
infoPtr
->
nrFields
;
*
nrFields
=
0
;
...
...
@@ -214,27 +215,37 @@ DATETIME_UseFormat (DATETIME_INFO *infoPtr, LPCWSTR formattxt)
for
(
i
=
0
;
formattxt
[
i
];
i
++
)
{
TRACE
(
"
\n
%d %c:"
,
i
,
formattxt
[
i
]);
for
(
j
=
0
;
j
<
len
;
j
++
)
{
if
(
allowedformatchars
[
j
]
==
formattxt
[
i
])
{
TRACE
(
"%c[%d,%x]"
,
allowedformatchars
[
j
],
*
nrFields
,
infoPtr
->
fieldspec
[
*
nrFields
]);
if
((
*
nrFields
==
0
)
&&
(
infoPtr
->
fieldspec
[
*
nrFields
]
==
0
))
{
infoPtr
->
fieldspec
[
*
nrFields
]
=
(
j
<<
4
)
+
1
;
break
;
}
if
(
infoPtr
->
fieldspec
[
*
nrFields
]
>>
4
!=
j
)
{
(
*
nrFields
)
++
;
infoPtr
->
fieldspec
[
*
nrFields
]
=
(
j
<<
4
)
+
1
;
break
;
}
if
((
infoPtr
->
fieldspec
[
*
nrFields
]
&
0x0f
)
==
maxrepetition
[
j
])
{
(
*
nrFields
)
++
;
infoPtr
->
fieldspec
[
*
nrFields
]
=
(
j
<<
4
)
+
1
;
break
;
}
infoPtr
->
fieldspec
[
*
nrFields
]
++
;
break
;
}
/* if allowedformatchar */
}
/* for j */
if
(
!
inside_literal
)
{
for
(
j
=
0
;
j
<
len
;
j
++
)
{
if
(
allowedformatchars
[
j
]
==
formattxt
[
i
])
{
TRACE
(
"%c[%d,%x]"
,
allowedformatchars
[
j
],
*
nrFields
,
infoPtr
->
fieldspec
[
*
nrFields
]);
if
((
*
nrFields
==
0
)
&&
(
infoPtr
->
fieldspec
[
*
nrFields
]
==
0
))
{
infoPtr
->
fieldspec
[
*
nrFields
]
=
(
j
<<
4
)
+
1
;
break
;
}
if
(
infoPtr
->
fieldspec
[
*
nrFields
]
>>
4
!=
j
)
{
(
*
nrFields
)
++
;
infoPtr
->
fieldspec
[
*
nrFields
]
=
(
j
<<
4
)
+
1
;
break
;
}
if
((
infoPtr
->
fieldspec
[
*
nrFields
]
&
0x0f
)
==
maxrepetition
[
j
])
{
(
*
nrFields
)
++
;
infoPtr
->
fieldspec
[
*
nrFields
]
=
(
j
<<
4
)
+
1
;
break
;
}
infoPtr
->
fieldspec
[
*
nrFields
]
++
;
break
;
}
/* if allowedformatchar */
}
/* for j */
}
else
j
=
len
;
if
(
formattxt
[
i
]
==
'\''
)
{
inside_literal
=
!
inside_literal
;
continue
;
}
/* char is not a specifier: handle char like a string */
if
(
j
==
len
)
{
...
...
dlls/comctl32/tests/datetime.c
View file @
41025d56
...
...
@@ -193,6 +193,8 @@ static HWND create_datetime_control(DWORD style, DWORD exstyle)
static
void
test_dtm_set_format
(
HWND
hWndDateTime
)
{
CHAR
txt
[
256
];
SYSTEMTIME
systime
;
LRESULT
r
;
r
=
SendMessage
(
hWndDateTime
,
DTM_SETFORMAT
,
0
,
(
LPARAM
)
NULL
);
...
...
@@ -203,6 +205,17 @@ static void test_dtm_set_format(HWND hWndDateTime)
expect
(
1
,
r
);
ok_sequence
(
sequences
,
DATETIME_SEQ_INDEX
,
test_dtm_set_format_seq
,
"test_dtm_set_format"
,
FALSE
);
r
=
SendMessage
(
hWndDateTime
,
DTM_SETFORMAT
,
0
,
(
LPARAM
)
"'hh' hh"
);
expect
(
1
,
r
);
ZeroMemory
(
&
systime
,
sizeof
(
systime
));
systime
.
wYear
=
2000
;
systime
.
wMonth
=
systime
.
wDay
=
1
;
r
=
SendMessage
(
hWndDateTime
,
DTM_SETSYSTEMTIME
,
0
,
(
LPARAM
)
&
systime
);
expect
(
1
,
r
);
GetWindowText
(
hWndDateTime
,
txt
,
256
);
todo_wine
ok
(
strcmp
(
txt
,
"hh 12"
)
==
0
,
"String mismatch (
\"
%s
\"
vs
\"
hh 12
\"
)
\n
"
,
txt
);
flush_sequences
(
sequences
,
NUM_MSG_SEQUENCES
);
}
...
...
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