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
3f20b66a
Commit
3f20b66a
authored
May 15, 2017
by
Hans Leidekker
Committed by
Alexandre Julliard
May 15, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
webservices: Use a WS_BYTES structure to store XML buffer data.
Signed-off-by:
Hans Leidekker
<
hans@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
eaf2cd11
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
24 deletions
+23
-24
heap.c
dlls/webservices/heap.c
+5
-5
reader.c
dlls/webservices/reader.c
+2
-2
webservices_private.h
dlls/webservices/webservices_private.h
+1
-2
writer.c
dlls/webservices/writer.c
+15
-15
No files found.
dlls/webservices/heap.c
View file @
3f20b66a
...
...
@@ -320,21 +320,21 @@ struct xmlbuf *alloc_xmlbuf( WS_HEAP *heap )
struct
xmlbuf
*
ret
;
if
(
!
(
ret
=
ws_alloc
(
heap
,
sizeof
(
*
ret
)
)))
return
NULL
;
if
(
!
(
ret
->
ptr
=
ws_alloc
(
heap
,
XML_BUFFER_INITIAL_ALLOCATED_SIZE
)))
if
(
!
(
ret
->
bytes
.
bytes
=
ws_alloc
(
heap
,
XML_BUFFER_INITIAL_ALLOCATED_SIZE
)))
{
ws_free
(
heap
,
ret
,
sizeof
(
*
ret
)
);
return
NULL
;
}
ret
->
heap
=
heap
;
ret
->
size
_allocated
=
XML_BUFFER_INITIAL_ALLOCATED_SIZE
;
ret
->
size
=
0
;
ret
->
heap
=
heap
;
ret
->
size
=
XML_BUFFER_INITIAL_ALLOCATED_SIZE
;
ret
->
bytes
.
length
=
0
;
return
ret
;
}
void
free_xmlbuf
(
struct
xmlbuf
*
xmlbuf
)
{
if
(
!
xmlbuf
)
return
;
ws_free
(
xmlbuf
->
heap
,
xmlbuf
->
ptr
,
xmlbuf
->
size_allocated
);
ws_free
(
xmlbuf
->
heap
,
xmlbuf
->
bytes
.
bytes
,
xmlbuf
->
size
);
ws_free
(
xmlbuf
->
heap
,
xmlbuf
,
sizeof
(
*
xmlbuf
)
);
}
...
...
dlls/webservices/reader.c
View file @
3f20b66a
...
...
@@ -4662,12 +4662,12 @@ HRESULT WINAPI WsSetInputToBuffer( WS_XML_READER *handle, WS_XML_BUFFER *buffer,
if
((
hr
=
init_reader
(
reader
))
!=
S_OK
)
goto
done
;
charset
=
detect_charset
(
xmlbuf
->
ptr
,
xmlbuf
->
size
,
&
offset
);
charset
=
detect_charset
(
xmlbuf
->
bytes
.
bytes
,
xmlbuf
->
bytes
.
length
,
&
offset
);
hr
=
prop_set
(
reader
->
prop
,
reader
->
prop_count
,
WS_XML_READER_PROPERTY_CHARSET
,
&
charset
,
sizeof
(
charset
)
);
if
(
hr
!=
S_OK
)
goto
done
;
set_input_buffer
(
reader
,
xmlbuf
,
(
const
unsigned
char
*
)
xmlbuf
->
ptr
+
offset
,
xmlbuf
->
size
-
offset
);
set_input_buffer
(
reader
,
xmlbuf
,
xmlbuf
->
bytes
.
bytes
+
offset
,
xmlbuf
->
bytes
.
length
-
offset
);
if
(
!
(
node
=
alloc_node
(
WS_XML_NODE_TYPE_BOF
)))
hr
=
E_OUTOFMEMORY
;
else
read_insert_bof
(
reader
,
node
);
...
...
dlls/webservices/webservices_private.h
View file @
3f20b66a
...
...
@@ -21,8 +21,7 @@
struct
xmlbuf
{
WS_HEAP
*
heap
;
void
*
ptr
;
SIZE_T
size_allocated
;
WS_BYTES
bytes
;
SIZE_T
size
;
};
...
...
dlls/webservices/writer.c
View file @
3f20b66a
...
...
@@ -288,8 +288,8 @@ HRESULT WINAPI WsGetWriterProperty( WS_XML_WRITER *handle, WS_XML_WRITER_PROPERT
if
(
size
!=
sizeof
(
*
bytes
))
hr
=
E_INVALIDARG
;
else
{
bytes
->
bytes
=
writer
->
output_buf
->
ptr
;
bytes
->
length
=
writer
->
output_buf
->
size
;
bytes
->
bytes
=
writer
->
output_buf
->
bytes
.
bytes
;
bytes
->
length
=
writer
->
output_buf
->
bytes
.
length
;
}
break
;
}
...
...
@@ -310,7 +310,7 @@ static void set_output_buffer( struct writer *writer, struct xmlbuf *xmlbuf )
}
writer
->
output_buf
=
xmlbuf
;
writer
->
output_type
=
WS_XML_WRITER_OUTPUT_TYPE_BUFFER
;
writer
->
write_bufptr
=
xmlbuf
->
ptr
;
writer
->
write_bufptr
=
xmlbuf
->
bytes
.
bytes
;
writer
->
write_pos
=
0
;
}
...
...
@@ -441,16 +441,16 @@ static HRESULT write_grow_buffer( struct writer *writer, ULONG size )
SIZE_T
new_size
;
void
*
tmp
;
if
(
buf
->
size
_allocated
>=
writer
->
write_pos
+
size
)
if
(
buf
->
size
>=
writer
->
write_pos
+
size
)
{
buf
->
size
=
writer
->
write_pos
+
size
;
buf
->
bytes
.
length
=
writer
->
write_pos
+
size
;
return
S_OK
;
}
new_size
=
max
(
buf
->
size
_allocated
*
2
,
writer
->
write_pos
+
size
);
if
(
!
(
tmp
=
ws_realloc
(
buf
->
heap
,
buf
->
ptr
,
buf
->
size_allocated
,
new_size
)))
return
WS_E_QUOTA_EXCEEDED
;
writer
->
write_bufptr
=
buf
->
ptr
=
tmp
;
buf
->
size
_allocated
=
new_size
;
buf
->
size
=
writer
->
write_pos
+
size
;
new_size
=
max
(
buf
->
size
*
2
,
writer
->
write_pos
+
size
);
if
(
!
(
tmp
=
ws_realloc
(
buf
->
heap
,
buf
->
bytes
.
bytes
,
buf
->
size
,
new_size
)))
return
WS_E_QUOTA_EXCEEDED
;
writer
->
write_bufptr
=
buf
->
bytes
.
bytes
=
tmp
;
buf
->
size
=
new_size
;
buf
->
bytes
.
length
=
writer
->
write_pos
+
size
;
return
S_OK
;
}
...
...
@@ -2820,8 +2820,8 @@ HRESULT WINAPI WsWriteXmlBuffer( WS_XML_WRITER *handle, WS_XML_BUFFER *buffer, W
}
if
((
hr
=
write_flush
(
writer
))
!=
S_OK
)
goto
done
;
if
((
hr
=
write_grow_buffer
(
writer
,
xmlbuf
->
size
))
!=
S_OK
)
goto
done
;
write_bytes
(
writer
,
xmlbuf
->
ptr
,
xmlbuf
->
size
);
if
((
hr
=
write_grow_buffer
(
writer
,
xmlbuf
->
bytes
.
length
))
!=
S_OK
)
goto
done
;
write_bytes
(
writer
,
xmlbuf
->
bytes
.
bytes
,
xmlbuf
->
bytes
.
length
);
done:
LeaveCriticalSection
(
&
writer
->
cs
);
...
...
@@ -2869,12 +2869,12 @@ HRESULT WINAPI WsWriteXmlBufferToBytes( WS_XML_WRITER *handle, WS_XML_BUFFER *bu
if
(
hr
!=
S_OK
)
goto
done
;
}
if
(
!
(
buf
=
ws_alloc
(
heap
,
xmlbuf
->
size
)))
hr
=
WS_E_QUOTA_EXCEEDED
;
if
(
!
(
buf
=
ws_alloc
(
heap
,
xmlbuf
->
bytes
.
length
)))
hr
=
WS_E_QUOTA_EXCEEDED
;
else
{
memcpy
(
buf
,
xmlbuf
->
ptr
,
xmlbuf
->
size
);
memcpy
(
buf
,
xmlbuf
->
bytes
.
bytes
,
xmlbuf
->
bytes
.
length
);
*
bytes
=
buf
;
*
size
=
xmlbuf
->
size
;
*
size
=
xmlbuf
->
bytes
.
length
;
}
done:
...
...
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