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
39f485ac
Commit
39f485ac
authored
Jan 25, 2010
by
Erich Hoover
Committed by
Alexandre Julliard
Jan 26, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hhctrl.ocx: Find node attributes in a case-insensitive way.
parent
ee720f05
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
10 deletions
+36
-10
content.c
dlls/hhctrl.ocx/content.c
+36
-10
No files found.
dlls/hhctrl.ocx/content.c
View file @
39f485ac
...
...
@@ -151,31 +151,57 @@ static BOOL next_node(stream_t *stream, strbuf_t *buf)
return
TRUE
;
}
/*
* Find the value of a named HTML attribute.
*
* Note: Attribute names are case insensitive, so it is necessary to
* put both the node text and the attribute name in the same case
* before attempting a string search.
*/
static
const
char
*
get_attr
(
const
char
*
node
,
const
char
*
name
,
int
*
len
)
{
const
char
*
ptr
,
*
ptr2
;
int
name_len
,
node_len
;
char
name_buf
[
32
];
int
nlen
;
char
*
node_buf
;
int
i
;
nlen
=
strlen
(
name
);
memcpy
(
name_buf
,
name
,
nlen
);
name_buf
[
nlen
++
]
=
'='
;
name_buf
[
nlen
++
]
=
'\"'
;
name_buf
[
nlen
]
=
0
;
ptr
=
strstr
(
node
,
name_buf
);
/* Create a lower case copy of the node */
node_len
=
strlen
(
node
)
+
1
;
node_buf
=
heap_alloc
(
node_len
*
sizeof
(
char
));
if
(
!
node_buf
)
return
NULL
;
memcpy
(
node_buf
,
node
,
node_len
);
for
(
i
=
0
;
i
<
node_len
;
i
++
)
node_buf
[
i
]
=
tolower
(
node_buf
[
i
]);
/* Create a lower case copy of the attribute name (search string) */
name_len
=
strlen
(
name
);
memcpy
(
name_buf
,
name
,
name_len
);
for
(
i
=
0
;
i
<
name_len
;
i
++
)
name_buf
[
i
]
=
tolower
(
name_buf
[
i
]);
name_buf
[
name_len
++
]
=
'='
;
name_buf
[
name_len
++
]
=
'\"'
;
name_buf
[
name_len
]
=
0
;
ptr
=
strstr
(
node_buf
,
name_buf
);
if
(
!
ptr
)
{
WARN
(
"name not found
\n
"
);
heap_free
(
name_buf
);
return
NULL
;
}
ptr
+=
nlen
;
ptr
+=
n
ame_
len
;
ptr2
=
strchr
(
ptr
,
'\"'
);
if
(
!
ptr2
)
{
heap_free
(
name_buf
);
return
NULL
;
}
*
len
=
ptr2
-
ptr
;
return
ptr
;
heap_free
(
name_buf
);
/* Return the pointer offset within the original string */
return
node
+
(
ptr
-
node_buf
);
}
static
void
parse_obj_node_param
(
ContentItem
*
item
,
ContentItem
*
hhc_root
,
const
char
*
text
)
...
...
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