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
ff67da43
Commit
ff67da43
authored
Apr 18, 2005
by
Ferenc Wagner
Committed by
Alexandre Julliard
Apr 18, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enforce valid tag syntax during input.
parent
05413fcc
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
15 deletions
+37
-15
gui.c
programs/winetest/gui.c
+22
-6
main.c
programs/winetest/main.c
+1
-1
util.c
programs/winetest/util.c
+11
-6
winetest.h
programs/winetest/winetest.h
+2
-1
winetest.rc
programs/winetest/winetest.rc
+1
-1
No files found.
programs/winetest/gui.c
View file @
ff67da43
...
@@ -41,6 +41,8 @@ double progressScale;
...
@@ -41,6 +41,8 @@ double progressScale;
*/
*/
int
progressGroup
;
int
progressGroup
;
WNDPROC
DefEditProc
;
char
*
char
*
renderString
(
va_list
ap
)
renderString
(
va_list
ap
)
{
{
...
@@ -319,21 +321,35 @@ guiAsk (va_list ap)
...
@@ -319,21 +321,35 @@ guiAsk (va_list ap)
}
}
BOOL
CALLBACK
BOOL
CALLBACK
EditTagProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
switch
(
msg
)
{
case
WM_CHAR
:
if
(
wParam
==
8
)
break
;
/* backspace is OK */
if
(
GetWindowTextLengthA
(
hwnd
)
==
MAXTAGLEN
||
!
goodtagchar
(
wParam
))
return
TRUE
;
break
;
}
return
CallWindowProcA
(
DefEditProc
,
hwnd
,
msg
,
wParam
,
lParam
);
}
BOOL
CALLBACK
AskTagProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
AskTagProc
(
HWND
hwnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
{
int
len
;
int
len
;
switch
(
msg
)
{
switch
(
msg
)
{
case
WM_INITDIALOG
:
DefEditProc
=
(
WNDPROC
)
SetWindowLongPtr
(
GetDlgItem
(
hwnd
,
IDC_TAG
),
GWLP_WNDPROC
,
(
LONG_PTR
)
EditTagProc
);
return
TRUE
;
case
WM_COMMAND
:
case
WM_COMMAND
:
switch
(
LOWORD
(
wParam
))
{
switch
(
LOWORD
(
wParam
))
{
case
IDOK
:
case
IDOK
:
len
=
GetWindowTextLengthA
(
GetDlgItem
(
hwnd
,
IDC_TAG
));
len
=
GetWindowTextLengthA
(
GetDlgItem
(
hwnd
,
IDC_TAG
));
if
(
len
<=
MAXTAGLEN
)
{
tag
=
xmalloc
(
len
+
1
);
tag
=
xmalloc
(
len
+
1
);
GetDlgItemTextA
(
hwnd
,
IDC_TAG
,
tag
,
len
+
1
);
GetDlgItemTextA
(
hwnd
,
IDC_TAG
,
tag
,
len
+
1
);
EndDialog
(
hwnd
,
IDOK
);
if
(
!
badtagchar
(
tag
))
EndDialog
(
hwnd
,
IDOK
);
else
free
(
tag
);
}
return
TRUE
;
return
TRUE
;
case
IDABORT
:
case
IDABORT
:
EndDialog
(
hwnd
,
IDABORT
);
EndDialog
(
hwnd
,
IDABORT
);
...
...
programs/winetest/main.c
View file @
ff67da43
...
@@ -601,7 +601,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
...
@@ -601,7 +601,7 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst,
if
(
strlen
(
tag
)
>
MAXTAGLEN
)
if
(
strlen
(
tag
)
>
MAXTAGLEN
)
report
(
R_FATAL
,
"tag is too long (maximum %d characters)"
,
report
(
R_FATAL
,
"tag is too long (maximum %d characters)"
,
MAXTAGLEN
);
MAXTAGLEN
);
cp
=
badtagchar
(
tag
);
cp
=
find
badtagchar
(
tag
);
if
(
cp
)
{
if
(
cp
)
{
report
(
R_ERROR
,
"invalid char in tag: %c"
,
*
cp
);
report
(
R_ERROR
,
"invalid char in tag: %c"
,
*
cp
);
usage
();
usage
();
...
...
programs/winetest/util.c
View file @
ff67da43
...
@@ -104,15 +104,20 @@ void xprintf (const char *fmt, ...)
...
@@ -104,15 +104,20 @@ void xprintf (const char *fmt, ...)
free
(
buffer
);
free
(
buffer
);
}
}
int
goodtagchar
(
char
c
)
{
return
((
'a'
<=
c
&&
c
<=
'z'
)
||
(
'A'
<=
c
&&
c
<=
'Z'
)
||
(
'0'
<=
c
&&
c
<=
'9'
)
||
c
==
'-'
||
c
==
'.'
);
}
const
char
*
const
char
*
badtagchar
(
const
char
*
tag
)
find
badtagchar
(
const
char
*
tag
)
{
{
while
(
*
tag
)
while
(
*
tag
)
if
((
'a'
<=*
tag
&&
*
tag
<=
'z'
)
||
if
(
goodtagchar
(
*
tag
))
tag
++
;
(
'A'
<=*
tag
&&
*
tag
<=
'Z'
)
||
(
'0'
<=*
tag
&&
*
tag
<=
'9'
)
||
*
tag
==
'-'
||
*
tag
==
'.'
)
tag
++
;
else
return
tag
;
else
return
tag
;
return
NULL
;
return
NULL
;
}
}
programs/winetest/winetest.h
View file @
ff67da43
...
@@ -33,7 +33,8 @@ void *xrealloc (void *op, size_t len);
...
@@ -33,7 +33,8 @@ void *xrealloc (void *op, size_t len);
void
xprintf
(
const
char
*
fmt
,
...);
void
xprintf
(
const
char
*
fmt
,
...);
char
*
vstrmake
(
size_t
*
lenp
,
va_list
ap
);
char
*
vstrmake
(
size_t
*
lenp
,
va_list
ap
);
char
*
strmake
(
size_t
*
lenp
,
...);
char
*
strmake
(
size_t
*
lenp
,
...);
const
char
*
badtagchar
(
const
char
*
tag
);
int
goodtagchar
(
char
c
);
const
char
*
findbadtagchar
(
const
char
*
tag
);
int
send_file
(
const
char
*
name
);
int
send_file
(
const
char
*
name
);
...
...
programs/winetest/winetest.rc
View file @
ff67da43
...
@@ -29,7 +29,7 @@ CAPTION "No tag supplied"
...
@@ -29,7 +29,7 @@ CAPTION "No tag supplied"
BEGIN
BEGIN
CTEXT "Please supply a tag for your report. You can use letters, digits, dashes and periods."
CTEXT "Please supply a tag for your report. You can use letters, digits, dashes and periods."
IDC_STATIC, 10, 5, 130, 30
IDC_STATIC, 10, 5, 130, 30
EDITTEXT IDC_TAG, 35, 30, 80, 10
EDITTEXT IDC_TAG, 35, 30, 80, 10
, ES_AUTOHSCROLL
DEFPUSHBUTTON "Start", IDOK, 25, 45, 40, 14
DEFPUSHBUTTON "Start", IDOK, 25, 45, 40, 14
PUSHBUTTON "Abort", IDABORT, 85, 45, 40, 14
PUSHBUTTON "Abort", IDABORT, 85, 45, 40, 14
END
END
...
...
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