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
e5816090
Commit
e5816090
authored
Oct 04, 2007
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 04, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Move common code to separated function.
parent
f56c1a60
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
22 deletions
+15
-22
htmlelem.c
dlls/mshtml/htmlelem.c
+15
-22
No files found.
dlls/mshtml/htmlelem.c
View file @
e5816090
...
@@ -56,6 +56,18 @@ static void elem_vector_add(elem_vector *buf, HTMLElement *elem)
...
@@ -56,6 +56,18 @@ static void elem_vector_add(elem_vector *buf, HTMLElement *elem)
buf
->
buf
[
buf
->
len
++
]
=
elem
;
buf
->
buf
[
buf
->
len
++
]
=
elem
;
}
}
static
void
elem_vector_normalize
(
elem_vector
*
buf
)
{
if
(
!
buf
->
len
)
{
mshtml_free
(
buf
->
buf
);
buf
->
buf
=
NULL
;
}
else
if
(
buf
->
size
>
buf
->
len
)
{
buf
->
buf
=
mshtml_realloc
(
buf
->
buf
,
buf
->
len
*
sizeof
(
HTMLElement
**
));
}
buf
->
size
=
buf
->
len
;
}
#define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
#define HTMLELEM_THIS(iface) DEFINE_THIS(HTMLElement, HTMLElement, iface)
#define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
#define HTMLELEM_NODE_THIS(iface) DEFINE_THIS2(HTMLElement, node, iface)
...
@@ -1119,15 +1131,7 @@ static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
...
@@ -1119,15 +1131,7 @@ static HRESULT WINAPI HTMLElement_get_all(IHTMLElement *iface, IDispatch **p)
buf
.
buf
=
mshtml_alloc
(
buf
.
size
*
sizeof
(
HTMLElement
**
));
buf
.
buf
=
mshtml_alloc
(
buf
.
size
*
sizeof
(
HTMLElement
**
));
create_all_list
(
This
->
node
.
doc
,
This
,
&
buf
);
create_all_list
(
This
->
node
.
doc
,
This
,
&
buf
);
elem_vector_normalize
(
&
buf
);
TRACE
(
"ret
\n
"
);
if
(
!
buf
.
len
)
{
mshtml_free
(
buf
.
buf
);
buf
.
buf
=
NULL
;
}
else
if
(
buf
.
size
>
buf
.
len
)
{
buf
.
buf
=
mshtml_realloc
(
buf
.
buf
,
buf
.
len
*
sizeof
(
HTMLElement
**
));
}
return
HTMLElementCollection_Create
((
IUnknown
*
)
HTMLELEM
(
This
),
buf
.
buf
,
buf
.
len
,
p
);
return
HTMLElementCollection_Create
((
IUnknown
*
)
HTMLELEM
(
This
),
buf
.
buf
,
buf
.
len
,
p
);
}
}
...
@@ -1520,12 +1524,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface,
...
@@ -1520,12 +1524,7 @@ static HRESULT WINAPI HTMLElementCollection_item(IHTMLElementCollection *iface,
ERR
(
"Invalid index. index=%d >= buf.len=%d
\n
"
,
V_I4
(
&
index
),
buf
.
len
);
ERR
(
"Invalid index. index=%d >= buf.len=%d
\n
"
,
V_I4
(
&
index
),
buf
.
len
);
return
E_INVALIDARG
;
return
E_INVALIDARG
;
}
}
if
(
!
buf
.
len
)
{
elem_vector_normalize
(
&
buf
);
mshtml_free
(
buf
.
buf
);
buf
.
buf
=
NULL
;
}
else
if
(
buf
.
size
>
buf
.
len
)
{
buf
.
buf
=
mshtml_realloc
(
buf
.
buf
,
buf
.
len
*
sizeof
(
HTMLElement
*
));
}
TRACE
(
"Returning %d element(s).
\n
"
,
buf
.
len
);
TRACE
(
"Returning %d element(s).
\n
"
,
buf
.
len
);
return
HTMLElementCollection_Create
(
This
->
ref_unk
,
buf
.
buf
,
buf
.
len
,
pdisp
);
return
HTMLElementCollection_Create
(
This
->
ref_unk
,
buf
.
buf
,
buf
.
len
,
pdisp
);
}
}
...
@@ -1567,16 +1566,10 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
...
@@ -1567,16 +1566,10 @@ static HRESULT WINAPI HTMLElementCollection_tags(IHTMLElementCollection *iface,
}
}
nsAString_Finish
(
&
tag_str
);
nsAString_Finish
(
&
tag_str
);
elem_vector_normalize
(
&
buf
);
TRACE
(
"fount %d tags
\n
"
,
buf
.
len
);
TRACE
(
"fount %d tags
\n
"
,
buf
.
len
);
if
(
!
buf
.
len
)
{
mshtml_free
(
buf
.
buf
);
buf
.
buf
=
NULL
;
}
else
if
(
buf
.
size
>
buf
.
len
)
{
buf
.
buf
=
mshtml_realloc
(
buf
.
buf
,
buf
.
len
*
sizeof
(
HTMLElement
*
));
}
return
HTMLElementCollection_Create
(
This
->
ref_unk
,
buf
.
buf
,
buf
.
len
,
pdisp
);
return
HTMLElementCollection_Create
(
This
->
ref_unk
,
buf
.
buf
,
buf
.
len
,
pdisp
);
}
}
...
...
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