Commit 105d1677 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Use CRT allocation functions.

parent b072f01e
......@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
......@@ -24,7 +25,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -53,7 +53,7 @@ static struct error *alloc_error(void)
struct error *ret;
ULONG size = sizeof(*ret) + prop_size( error_props, count );
if (!(ret = heap_alloc_zero( size ))) return NULL;
if (!(ret = calloc( 1, size ))) return NULL;
ret->magic = ERROR_MAGIC;
InitializeCriticalSection( &ret->cs );
......@@ -68,7 +68,7 @@ static void free_error( struct error *error )
{
error->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &error->cs );
heap_free( error );
free( error );
}
/**************************************************************************
......
......@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
......@@ -24,7 +25,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -181,7 +181,7 @@ static struct heap *alloc_heap(void)
struct heap *ret;
ULONG size = sizeof(*ret) + prop_size( heap_props, count );
if (!(ret = heap_alloc_zero( size ))) return NULL;
if (!(ret = calloc( 1, size ))) return NULL;
ret->magic = HEAP_MAGIC;
InitializeCriticalSection( &ret->cs );
......@@ -247,7 +247,7 @@ void WINAPI WsFreeHeap( WS_HEAP *handle )
heap->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &heap->cs );
heap_free( heap );
free( heap );
}
/**************************************************************************
......
......@@ -24,7 +24,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
#include "sock.h"
......@@ -128,18 +127,18 @@ static struct listener *alloc_listener(void)
struct listener *ret;
ULONG size = sizeof(*ret) + prop_size( listener_props, count );
if (!(ret = heap_alloc_zero( size ))) return NULL;
if (!(ret = calloc( 1, size ))) return NULL;
ret->magic = LISTENER_MAGIC;
if (!(ret->wait = CreateEventW( NULL, FALSE, FALSE, NULL )))
{
heap_free( ret );
free( ret );
return NULL;
}
if (!(ret->cancel = CreateEventW( NULL, FALSE, FALSE, NULL )))
{
CloseHandle( ret->wait );
heap_free( ret );
free( ret );
return NULL;
}
InitializeCriticalSection( &ret->cs );
......@@ -181,7 +180,7 @@ static void free_listener( struct listener *listener )
listener->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &listener->cs );
heap_free( listener );
free( listener );
}
static HRESULT create_listener( WS_CHANNEL_TYPE type, WS_CHANNEL_BINDING binding,
......@@ -327,7 +326,7 @@ HRESULT parse_url( const WS_STRING *str, WS_URL_SCHEME_TYPE *scheme, WCHAR **hos
if (url->host.length == 1 && (url->host.chars[0] == '+' || url->host.chars[0] == '*')) *host = NULL;
else
{
if (!(*host = heap_alloc( (url->host.length + 1) * sizeof(WCHAR) )))
if (!(*host = malloc( (url->host.length + 1) * sizeof(WCHAR) )))
{
WsFreeHeap( heap );
return E_OUTOFMEMORY;
......@@ -355,14 +354,14 @@ static HRESULT open_listener_tcp( struct listener *listener, const WS_STRING *ur
if ((hr = parse_url( url, &scheme, &host, &port )) != S_OK) return hr;
if (scheme != WS_URL_NETTCP_SCHEME_TYPE)
{
heap_free( host );
free( host );
return WS_E_INVALID_ENDPOINT_URL;
}
winsock_init();
hr = resolve_hostname( host, port, addr, &addr_len, AI_PASSIVE );
heap_free( host );
free( host );
if (hr != S_OK) return hr;
if ((listener->u.tcp.socket = socket( addr->sa_family, SOCK_STREAM, 0 )) == -1)
......@@ -406,14 +405,14 @@ static HRESULT open_listener_udp( struct listener *listener, const WS_STRING *ur
if ((hr = parse_url( url, &scheme, &host, &port )) != S_OK) return hr;
if (scheme != WS_URL_SOAPUDP_SCHEME_TYPE)
{
heap_free( host );
free( host );
return WS_E_INVALID_ENDPOINT_URL;
}
winsock_init();
hr = resolve_hostname( host, port, addr, &addr_len, AI_PASSIVE );
heap_free( host );
free( host );
if (hr != S_OK) return hr;
if ((listener->u.udp.socket = socket( addr->sa_family, SOCK_DGRAM, 0 )) == -1)
......
......@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
......@@ -25,7 +26,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -94,10 +94,10 @@ static struct msg *alloc_msg(void)
struct msg *ret;
ULONG size = sizeof(*ret) + prop_size( msg_props, count );
if (!(ret = heap_alloc_zero( size ))) return NULL;
if (!(ret->header = heap_alloc( HEADER_ARRAY_SIZE * sizeof(struct header *) )))
if (!(ret = calloc( 1, size ))) return NULL;
if (!(ret->header = malloc( HEADER_ARRAY_SIZE * sizeof(struct header *) )))
{
heap_free( ret );
free( ret );
return NULL;
}
ret->magic = MSG_MAGIC;
......@@ -114,10 +114,10 @@ static struct msg *alloc_msg(void)
static void free_header( struct header *header )
{
heap_free( header->name.bytes );
heap_free( header->ns.bytes );
free( header->name.bytes );
free( header->ns.bytes );
if (header->mapped) free_xml_string( header->u.text );
heap_free( header );
free( header );
}
static void reset_msg( struct msg *msg )
......@@ -129,7 +129,7 @@ static void reset_msg( struct msg *msg )
UuidCreate( &msg->id );
memset( &msg->id_req, 0, sizeof(msg->id_req) );
msg->is_addressed = FALSE;
heap_free( msg->addr.chars );
free( msg->addr.chars );
msg->addr.chars = NULL;
msg->addr.length = 0;
......@@ -159,11 +159,11 @@ static void free_msg( struct msg *msg )
WsFreeWriter( msg->writer );
WsFreeReader( msg->reader );
WsFreeHeap( msg->heap );
heap_free( msg->header );
free( msg->header );
msg->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &msg->cs );
heap_free( msg );
free( msg );
}
#define HEAP_MAX_SIZE (1 << 16)
......@@ -454,7 +454,7 @@ HRESULT WINAPI WsAddressMessage( WS_MESSAGE *handle, const WS_ENDPOINT_ADDRESS *
if (msg->state < WS_MESSAGE_STATE_INITIALIZED || msg->is_addressed) hr = WS_E_INVALID_OPERATION;
else if (addr && addr->url.length)
{
if (!(msg->addr.chars = heap_alloc( addr->url.length * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
if (!(msg->addr.chars = malloc( addr->url.length * sizeof(WCHAR) ))) hr = E_OUTOFMEMORY;
else
{
memcpy( msg->addr.chars, addr->url.chars, addr->url.length * sizeof(WCHAR) );
......@@ -1101,8 +1101,7 @@ static HRESULT grow_header_array( struct msg *msg, ULONG size )
{
struct header **tmp;
if (size <= msg->header_size) return S_OK;
if (!(tmp = heap_realloc( msg->header, 2 * msg->header_size * sizeof(struct header *) )))
return E_OUTOFMEMORY;
if (!(tmp = realloc( msg->header, 2 * msg->header_size * sizeof(struct header *) ))) return E_OUTOFMEMORY;
msg->header = tmp;
msg->header_size *= 2;
return S_OK;
......@@ -1112,10 +1111,10 @@ static struct header *alloc_header( WS_HEADER_TYPE type, BOOL mapped, const WS_X
const WS_XML_STRING *ns )
{
struct header *ret;
if (!(ret = heap_alloc_zero( sizeof(*ret) ))) return NULL;
if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL;
if (name && name->length)
{
if (!(ret->name.bytes = heap_alloc( name->length )))
if (!(ret->name.bytes = malloc( name->length )))
{
free_header( ret );
return NULL;
......@@ -1125,7 +1124,7 @@ static struct header *alloc_header( WS_HEADER_TYPE type, BOOL mapped, const WS_X
}
if (ns && ns->length)
{
if (!(ret->ns.bytes = heap_alloc( ns->length )))
if (!(ret->ns.bytes = malloc( ns->length )))
{
free_header( ret );
return NULL;
......@@ -1845,7 +1844,7 @@ HRESULT WINAPI WsRemoveCustomHeader( WS_MESSAGE *handle, const WS_XML_STRING *na
static WCHAR *build_http_header( const WCHAR *name, const WCHAR *value, ULONG *ret_len )
{
int len_name = lstrlenW( name ), len_value = lstrlenW( value );
WCHAR *ret = heap_alloc( (len_name + len_value + 2) * sizeof(WCHAR) );
WCHAR *ret = malloc( (len_name + len_value + 2) * sizeof(WCHAR) );
if (!ret) return NULL;
memcpy( ret, name, len_name * sizeof(WCHAR) );
......@@ -1866,7 +1865,7 @@ static WCHAR *from_xml_string( const WS_XML_STRING *str )
{
WCHAR *ret;
int len = MultiByteToWideChar( CP_UTF8, 0, (char *)str->bytes, str->length, NULL, 0 );
if (!(ret = heap_alloc( (len + 1) * sizeof(*ret) ))) return NULL;
if (!(ret = malloc( (len + 1) * sizeof(*ret) ))) return NULL;
MultiByteToWideChar( CP_UTF8, 0, (char *)str->bytes, str->length, ret, len );
ret[len] = 0;
return ret;
......@@ -1885,16 +1884,16 @@ static HRESULT insert_mapped_headers( struct msg *msg, HINTERNET req )
if (!(name = from_xml_string( &msg->header[i]->name ))) return E_OUTOFMEMORY;
if (!(value = from_xml_string( msg->header[i]->u.text )))
{
heap_free( name );
free( name );
return E_OUTOFMEMORY;
}
header = build_http_header( name, value, &len );
heap_free( name );
heap_free( value );
free( name );
free( value );
if (!header) return E_OUTOFMEMORY;
hr = insert_http_header( req, header, len, WINHTTP_ADDREQ_FLAG_ADD|WINHTTP_ADDREQ_FLAG_REPLACE );
heap_free( header );
free( header );
if (hr != S_OK) return hr;
}
return S_OK;
......@@ -1932,13 +1931,13 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
if (!header) goto done;
if ((hr = insert_http_header( req, header, len, WINHTTP_ADDREQ_FLAG_ADD )) != S_OK) goto done;
heap_free( header );
free( header );
hr = E_OUTOFMEMORY;
if (!(header = build_http_header( L"Content-Type", L"charset=utf-8", &len ))) goto done;
if ((hr = insert_http_header( req, header, len, WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON )) != S_OK)
goto done;
heap_free( header );
free( header );
header = NULL;
switch (msg->version_env)
......@@ -1949,14 +1948,14 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
break;
hr = E_OUTOFMEMORY;
if (!(buf = heap_alloc( (len + 3) * sizeof(WCHAR) ))) goto done;
if (!(buf = malloc( (len + 3) * sizeof(WCHAR) ))) goto done;
buf[0] = '"';
MultiByteToWideChar( CP_UTF8, 0, (char *)msg->action->bytes, msg->action->length, buf + 1, len );
buf[len + 1] = '"';
buf[len + 2] = 0;
header = build_http_header( L"SOAPAction", buf, &len );
heap_free( buf );
free( buf );
if (!header) goto done;
hr = insert_http_header( req, header, len, WINHTTP_ADDREQ_FLAG_ADD );
......@@ -1970,7 +1969,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
break;
hr = E_OUTOFMEMORY;
if (!(buf = heap_alloc( (len + len_action + 2) * sizeof(WCHAR) ))) goto done;
if (!(buf = malloc( (len + len_action + 2) * sizeof(WCHAR) ))) goto done;
memcpy( buf, L"action=\"", len_action * sizeof(WCHAR) );
MultiByteToWideChar( CP_UTF8, 0, (char *)msg->action->bytes, msg->action->length, buf + len_action, len );
len += len_action;
......@@ -1978,7 +1977,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
buf[len] = 0;
header = build_http_header( L"Content-Type", buf, &len );
heap_free( buf );
free( buf );
if (!header) goto done;
hr = insert_http_header( req, header, len, WINHTTP_ADDREQ_FLAG_COALESCE_WITH_SEMICOLON );
......@@ -1992,7 +1991,7 @@ HRESULT message_insert_http_headers( WS_MESSAGE *handle, HINTERNET req )
if (hr == S_OK) hr = insert_mapped_headers( msg, req );
done:
heap_free( header );
free( header );
LeaveCriticalSection( &msg->cs );
TRACE( "returning %08x\n", hr );
return hr;
......@@ -2012,26 +2011,26 @@ static HRESULT map_http_response_headers( struct msg *msg, HINTERNET req, const
GetLastError() == ERROR_INSUFFICIENT_BUFFER)
{
HRESULT hr;
if (!(value = heap_alloc( size )))
if (!(value = malloc( size )))
{
heap_free( name );
free( name );
return E_OUTOFMEMORY;
}
if (!WinHttpQueryHeaders( req, WINHTTP_QUERY_CUSTOM, name, value, &size, NULL ))
{
heap_free( name );
free( name );
return HRESULT_FROM_WIN32( GetLastError() );
}
hr = add_mapped_header( msg, &mapping->responseHeaderMappings[i]->headerName, WS_WSZ_TYPE,
WS_WRITE_REQUIRED_POINTER, &value, sizeof(value) );
heap_free( value );
free( value );
if (hr != S_OK)
{
heap_free( name );
free( name );
return hr;
}
}
heap_free( name );
free( name );
}
return S_OK;
}
......
......@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
......@@ -24,7 +25,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -59,7 +59,7 @@ static struct proxy *alloc_proxy(void)
struct proxy *ret;
ULONG size = sizeof(*ret) + prop_size( proxy_props, count );
if (!(ret = heap_alloc_zero( size ))) return NULL;
if (!(ret = calloc( 1, size ))) return NULL;
ret->magic = PROXY_MAGIC;
InitializeCriticalSection( &ret->cs );
......@@ -83,7 +83,7 @@ static void free_proxy( struct proxy *proxy )
proxy->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &proxy->cs );
heap_free( proxy );
free( proxy );
}
static HRESULT create_proxy( WS_CHANNEL *channel, const WS_PROXY_PROPERTY *properties, ULONG count,
......
......@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include <assert.h>
#include "windef.h"
......@@ -24,7 +25,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -100,18 +100,18 @@ static HRESULT grow_dict( struct dictionary *dict, ULONG size )
if (!dict->dict.strings)
{
new_size = max( MIN_DICTIONARY_SIZE, size );
if (!(dict->dict.strings = heap_alloc( new_size * sizeof(*dict->dict.strings) ))) return E_OUTOFMEMORY;
if (!(dict->sorted = heap_alloc( new_size * sizeof(*dict->sorted) )))
if (!(dict->dict.strings = malloc( new_size * sizeof(*dict->dict.strings) ))) return E_OUTOFMEMORY;
if (!(dict->sorted = malloc( new_size * sizeof(*dict->sorted) )))
{
heap_free( dict->dict.strings );
free( dict->dict.strings );
dict->dict.strings = NULL;
return E_OUTOFMEMORY;
}
if (!(dict->sequence = heap_alloc( new_size * sizeof(*dict->sequence) )))
if (!(dict->sequence = malloc( new_size * sizeof(*dict->sequence) )))
{
heap_free( dict->dict.strings );
free( dict->dict.strings );
dict->dict.strings = NULL;
heap_free( dict->sorted );
free( dict->sorted );
dict->sorted = NULL;
return E_OUTOFMEMORY;
}
......@@ -120,11 +120,11 @@ static HRESULT grow_dict( struct dictionary *dict, ULONG size )
}
new_size = max( dict->size * 2, size );
if (!(tmp = heap_realloc( dict->dict.strings, new_size * sizeof(*tmp) ))) return E_OUTOFMEMORY;
if (!(tmp = realloc( dict->dict.strings, new_size * sizeof(*tmp) ))) return E_OUTOFMEMORY;
dict->dict.strings = tmp;
if (!(tmp_sorted = heap_realloc( dict->sorted, new_size * sizeof(*tmp_sorted) ))) return E_OUTOFMEMORY;
if (!(tmp_sorted = realloc( dict->sorted, new_size * sizeof(*tmp_sorted) ))) return E_OUTOFMEMORY;
dict->sorted = tmp_sorted;
if (!(tmp_sequence = heap_realloc( dict->sequence, new_size * sizeof(*tmp_sequence) ))) return E_OUTOFMEMORY;
if (!(tmp_sequence = realloc( dict->sequence, new_size * sizeof(*tmp_sequence) ))) return E_OUTOFMEMORY;
dict->sequence = tmp_sequence;
dict->size = new_size;
......@@ -135,13 +135,13 @@ void clear_dict( struct dictionary *dict )
{
ULONG i;
assert( !dict->dict.isConst );
for (i = 0; i < dict->dict.stringCount; i++) heap_free( dict->dict.strings[i].bytes );
heap_free( dict->dict.strings );
for (i = 0; i < dict->dict.stringCount; i++) free( dict->dict.strings[i].bytes );
free( dict->dict.strings );
dict->dict.strings = NULL;
dict->dict.stringCount = 0;
heap_free( dict->sorted );
free( dict->sorted );
dict->sorted = NULL;
heap_free( dict->sequence );
free( dict->sequence );
dict->sequence = NULL;
dict->current_sequence = 0;
dict->size = 0;
......@@ -179,7 +179,7 @@ HRESULT add_xml_string( WS_XML_STRING *str )
EnterCriticalSection( &dict_cs );
if ((index = find_string( &dict_builtin, str->bytes, str->length, &id )) == -1)
{
heap_free( str->bytes );
free( str->bytes );
*str = dict_builtin.dict.strings[id];
}
else if ((hr = insert_string( &dict_builtin, str->bytes, str->length, index, &id )) == S_OK)
......@@ -194,10 +194,10 @@ WS_XML_STRING *alloc_xml_string( const unsigned char *data, ULONG len )
{
WS_XML_STRING *ret;
if (!(ret = heap_alloc_zero( sizeof(*ret) ))) return NULL;
if ((ret->length = len) && !(ret->bytes = heap_alloc( len )))
if (!(ret = calloc( 1, sizeof(*ret) ))) return NULL;
if ((ret->length = len) && !(ret->bytes = malloc( len )))
{
heap_free( ret );
free( ret );
return NULL;
}
if (data)
......@@ -211,8 +211,8 @@ WS_XML_STRING *alloc_xml_string( const unsigned char *data, ULONG len )
void free_xml_string( WS_XML_STRING *str )
{
if (!str) return;
if (!str->dictionary) heap_free( str->bytes );
heap_free( str );
if (!str->dictionary) free( str->bytes );
free( str );
}
WS_XML_STRING *dup_xml_string( const WS_XML_STRING *src, BOOL use_static_dict )
......@@ -223,7 +223,7 @@ WS_XML_STRING *dup_xml_string( const WS_XML_STRING *src, BOOL use_static_dict )
int index;
ULONG id;
if (!(ret = heap_alloc( sizeof(*ret) ))) return NULL;
if (!(ret = malloc( sizeof(*ret) ))) return NULL;
if (src->dictionary)
{
*ret = *src;
......@@ -241,9 +241,9 @@ WS_XML_STRING *dup_xml_string( const WS_XML_STRING *src, BOOL use_static_dict )
LeaveCriticalSection( &dict_cs );
return ret;
}
if (!(data = heap_alloc( src->length )))
if (!(data = malloc( src->length )))
{
heap_free( ret );
free( ret );
LeaveCriticalSection( &dict_cs );
return NULL;
}
......
......@@ -901,7 +901,7 @@ static void test_simple_struct_type(void)
s.fields = fields;
s.fieldCount = 1;
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) );
test = malloc( sizeof(*test) );
test->field = L"value";
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, NULL,
WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
......@@ -968,7 +968,7 @@ static void test_simple_struct_type(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<struct struct=\"value\"/>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test );
free( test );
WsFreeWriter( writer );
}
......@@ -1005,7 +1005,7 @@ static void test_WsWriteElement(void)
desc.type = WS_STRUCT_TYPE;
desc.typeDescription = &s;
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) );
test = malloc( sizeof(*test) );
test->str = L"test";
hr = WsWriteElement( NULL, &desc, WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
......@@ -1049,7 +1049,7 @@ static void test_WsWriteElement(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<str str=\"test\"/>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test );
free( test );
WsFreeWriter( writer );
}
......@@ -1192,7 +1192,7 @@ static void test_WsWriteAttribute(void)
desc.type = WS_STRUCT_TYPE;
desc.typeDescription = &s;
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) );
test = malloc( sizeof(*test) );
test->str = L"test";
hr = WsWriteAttribute( NULL, &desc, WS_WRITE_REQUIRED_POINTER, &test, sizeof(test), NULL );
ok( hr == E_INVALIDARG, "got %08x\n", hr );
......@@ -1219,7 +1219,7 @@ static void test_WsWriteAttribute(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<str str=\"test\"/>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test );
free( test );
WsFreeWriter( writer );
}
......@@ -1652,7 +1652,7 @@ static void test_complex_struct_type(void)
s.typeNs = &ns;
size = sizeof(struct officeconfig) + sizeof(struct services);
test = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size );
test = calloc( 1, size );
test->services = (struct services *)(test + 1);
test->services->generationtime = L"2015-09-03T18:47:54";
hr = WsWriteType( writer, WS_ELEMENT_CONTENT_TYPE_MAPPING, WS_STRUCT_TYPE, &s,
......@@ -1663,7 +1663,7 @@ static void test_complex_struct_type(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output_buffer( buffer, expected, __LINE__ );
HeapFree( GetProcessHeap(), 0, test );
free( test );
WsFreeWriter( writer );
WsFreeHeap( heap );
}
......@@ -3116,7 +3116,7 @@ static void test_repeating_element(void)
hr = WsWriteStartElement( writer, NULL, &localname, &ns, NULL );
ok( hr == S_OK, "got %08x\n", hr );
test = HeapAlloc( GetProcessHeap(), 0, sizeof(*test) + 2 * sizeof(const WCHAR *) );
test = malloc( sizeof(*test) + 2 * sizeof(const WCHAR *) );
test->val = (const WCHAR **)(test + 1);
test->val[0] = L"1";
test->val[1] = L"2";
......@@ -3127,7 +3127,7 @@ static void test_repeating_element(void)
hr = WsWriteEndElement( writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<test><wrapper><val>1</val><val>2</val></wrapper></test>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test );
free( test );
/* array of integers, no wrapper */
hr = set_output( writer );
......@@ -3139,7 +3139,7 @@ static void test_repeating_element(void)
f.localName = NULL;
f.ns = NULL;
test2 = HeapAlloc( GetProcessHeap(), 0, sizeof(*test2) + 2 * sizeof(INT32) );
test2 = malloc( sizeof(*test2) + 2 * sizeof(INT32) );
test2->val = (INT32 *)(test2 + 1);
test2->val[0] = 1;
test2->val[1] = 2;
......@@ -3167,7 +3167,7 @@ static void test_repeating_element(void)
hr = WsWriteEndElement( writer, NULL );
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<test><val>1</val><val>2</val></test>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test2 );
free( test2 );
/* nillable item */
hr = set_output( writer );
......@@ -3198,7 +3198,7 @@ static void test_repeating_element(void)
f.options = WS_FIELD_POINTER|WS_FIELD_OPTIONAL|WS_FIELD_NILLABLE|WS_FIELD_NILLABLE_ITEM;
value.data = -1;
test3 = HeapAlloc( GetProcessHeap(), 0, sizeof(*test3) + 2 * sizeof(const struct value *) );
test3 = malloc( sizeof(*test3) + 2 * sizeof(const struct value *) );
test3->val = (const struct value **)(test3 + 1);
test3->val[0] = &value;
test3->val[1] = NULL;
......@@ -3211,7 +3211,7 @@ static void test_repeating_element(void)
ok( hr == S_OK, "got %08x\n", hr );
check_output( writer, "<test><wrapper><val><data>-1</data></val><val a:nil=\"true\" "
"xmlns:a=\"http://www.w3.org/2001/XMLSchema-instance\"/></wrapper></test>", __LINE__ );
HeapFree( GetProcessHeap(), 0, test3 );
free( test3 );
WsFreeWriter( writer );
}
......
......@@ -17,6 +17,7 @@
*/
#include <stdarg.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
......@@ -25,7 +26,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -70,7 +70,7 @@ static unsigned char *strdup_utf8( const WCHAR *str, ULONG len, ULONG *ret_len )
{
unsigned char *ret;
*ret_len = WideCharToMultiByte( CP_UTF8, 0, str, len, NULL, 0, NULL, NULL );
if ((ret = heap_alloc( *ret_len )))
if ((ret = malloc( *ret_len )))
WideCharToMultiByte( CP_UTF8, 0, str, len, (char *)ret, *ret_len, NULL, NULL );
return ret;
}
......@@ -156,13 +156,13 @@ static WCHAR *url_decode( WCHAR *str, ULONG len, WS_HEAP *heap, ULONG *ret_len )
len_utf8, NULL, 0 )))
{
WARN( "invalid UTF-8 sequence\n" );
heap_free( utf8 );
free( utf8 );
return NULL;
}
if ((ret = ws_alloc( heap, *ret_len * sizeof(WCHAR) )))
MultiByteToWideChar( CP_UTF8, 0, (char *)utf8, len_utf8, ret, *ret_len );
heap_free( utf8 );
free( utf8 );
return ret;
}
......@@ -357,7 +357,7 @@ static HRESULT url_encode_size( const WCHAR *str, ULONG len, const char *except,
*ret_len = 0;
if (!(utf8 = strdup_utf8( str, len, &len_utf8 ))) return E_OUTOFMEMORY;
for (i = 0; i < len_utf8; i++) *ret_len += escape_size( utf8[i], except );
heap_free( utf8 );
free( utf8 );
return S_OK;
}
......@@ -416,7 +416,7 @@ static HRESULT url_encode( const WCHAR *str, ULONG len, WCHAR *buf, const char *
p += len_enc;
}
heap_free( utf8 );
free( utf8 );
return hr;
}
......
......@@ -18,6 +18,7 @@
#include <assert.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdio.h>
#include <float.h>
#include <math.h>
......@@ -29,7 +30,6 @@
#include "webservices.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/list.h"
#include "webservices_private.h"
......@@ -106,7 +106,7 @@ static struct writer *alloc_writer(void)
struct writer *ret;
ULONG size = sizeof(*ret) + prop_size( writer_props, count );
if (!(ret = heap_alloc_zero( size ))) return NULL;
if (!(ret = calloc( 1, size ))) return NULL;
ret->magic = WRITER_MAGIC;
InitializeCriticalSection( &ret->cs );
......@@ -122,11 +122,11 @@ static void free_writer( struct writer *writer )
destroy_nodes( writer->root );
free_xml_string( writer->current_ns );
WsFreeHeap( writer->output_heap );
heap_free( writer->stream_buf );
free( writer->stream_buf );
writer->cs.DebugInfo->Spare[0] = 0;
DeleteCriticalSection( &writer->cs );
heap_free( writer );
free( writer );
}
static void write_insert_eof( struct writer *writer, struct node *eof )
......@@ -430,7 +430,7 @@ HRESULT WINAPI WsSetOutput( WS_XML_WRITER *handle, const WS_XML_WRITER_ENCODING
case WS_XML_WRITER_OUTPUT_TYPE_STREAM:
{
const WS_XML_WRITER_STREAM_OUTPUT *stream = (const WS_XML_WRITER_STREAM_OUTPUT *)output;
if (!writer->stream_buf && !(writer->stream_buf = heap_alloc( STREAM_BUFSIZE )))
if (!writer->stream_buf && !(writer->stream_buf = malloc( STREAM_BUFSIZE )))
{
hr = E_OUTOFMEMORY;
goto done;
......@@ -1283,12 +1283,12 @@ static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TE
len = text_utf8->value.length;
if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK)
{
heap_free( new );
free( new );
return hr;
}
write_char( writer, len );
write_bytes( writer, text_utf8->value.bytes, len );
heap_free( new );
free( new );
return S_OK;
}
case RECORD_CHARS16_TEXT:
......@@ -1306,12 +1306,12 @@ static HRESULT write_attribute_value_bin( struct writer *writer, const WS_XML_TE
len = text_utf8->value.length;
if ((hr = write_grow_buffer( writer, sizeof(len) + len )) != S_OK)
{
heap_free( new );
free( new );
return hr;
}
write_bytes( writer, (const BYTE *)&len, sizeof(len) );
write_bytes( writer, text_utf8->value.bytes, len );
heap_free( new );
free( new );
return S_OK;
}
case RECORD_BYTES8_TEXT:
......@@ -1629,7 +1629,7 @@ static HRESULT add_namespace_attribute( struct writer *writer, const WS_XML_STRI
WS_XML_ELEMENT_NODE *elem = &writer->current->hdr;
HRESULT hr;
if (!(attr = heap_alloc_zero( sizeof(*attr) ))) return E_OUTOFMEMORY;
if (!(attr = calloc( 1, sizeof(*attr) ))) return E_OUTOFMEMORY;
attr->singleQuote = !!single;
attr->isXmlNs = 1;
......@@ -2044,7 +2044,7 @@ static HRESULT write_add_attribute( struct writer *writer, const WS_XML_STRING *
WS_XML_ELEMENT_NODE *elem = &writer->current->hdr;
HRESULT hr;
if (!(attr = heap_alloc_zero( sizeof(*attr) ))) return E_OUTOFMEMORY;
if (!(attr = calloc( 1, sizeof(*attr) ))) return E_OUTOFMEMORY;
if (!prefix && ns->length) prefix = elem->prefix;
......@@ -2477,7 +2477,7 @@ static HRESULT write_set_attribute_value( struct writer *writer, const WS_XML_TE
{
WS_XML_UTF8_TEXT *new, *old = (WS_XML_UTF8_TEXT *)elem->attributes[elem->attributeCount - 1]->value;
if ((hr = text_to_utf8text( value, old, NULL, &new )) != S_OK) return hr;
heap_free( old );
free( old );
elem->attributes[elem->attributeCount - 1]->value = &new->text;
break;
}
......@@ -2485,7 +2485,7 @@ static HRESULT write_set_attribute_value( struct writer *writer, const WS_XML_TE
{
WS_XML_TEXT *new, *old = elem->attributes[elem->attributeCount - 1]->value;
if ((hr = text_to_text( value, old, NULL, &new )) != S_OK) return hr;
heap_free( old );
free( old );
elem->attributes[elem->attributeCount - 1]->value = new;
break;
}
......@@ -2517,7 +2517,7 @@ static HRESULT write_add_text_node( struct writer *writer, const WS_XML_TEXT *va
WS_XML_UTF8_TEXT *new;
if ((hr = text_to_utf8text( value, NULL, NULL, &new )) != S_OK)
{
heap_free( node );
free( node );
return hr;
}
text->text = &new->text;
......@@ -2528,7 +2528,7 @@ static HRESULT write_add_text_node( struct writer *writer, const WS_XML_TEXT *va
WS_XML_TEXT *new;
if ((hr = text_to_text( value, NULL, NULL, &new )) != S_OK)
{
heap_free( node );
free( node );
return hr;
}
text->text = new;
......@@ -2536,7 +2536,7 @@ static HRESULT write_add_text_node( struct writer *writer, const WS_XML_TEXT *va
}
default:
FIXME( "unhandled output encoding %u\n", writer->output_enc );
heap_free( node );
free( node );
return E_NOTIMPL;
}
......@@ -2691,13 +2691,13 @@ static HRESULT write_text_bin( struct writer *writer, const WS_XML_TEXT *text, U
len = text_utf8->value.length;
if ((hr = write_grow_buffer( writer, 1 + sizeof(len) + len )) != S_OK)
{
heap_free( new );
free( new );
return hr;
}
write_char( writer, type );
write_char( writer, len );
write_bytes( writer, text_utf8->value.bytes, len );
heap_free( new );
free( new );
return S_OK;
}
case RECORD_CHARS16_TEXT_WITH_ENDELEMENT:
......@@ -2715,13 +2715,13 @@ static HRESULT write_text_bin( struct writer *writer, const WS_XML_TEXT *text, U
len = text_utf8->value.length;
if ((hr = write_grow_buffer( writer, 1 + sizeof(len) + len )) != S_OK)
{
heap_free( new );
free( new );
return hr;
}
write_char( writer, type );
write_bytes( writer, (const BYTE *)&len, sizeof(len) );
write_bytes( writer, text_utf8->value.bytes, len );
heap_free( new );
free( new );
return S_OK;
}
case RECORD_BYTES8_TEXT:
......@@ -2920,7 +2920,7 @@ static HRESULT write_text_node( struct writer *writer, const WS_XML_TEXT *text )
WS_XML_UTF8_TEXT *new, *old = (WS_XML_UTF8_TEXT *)node->text;
offset = old->value.length;
if ((hr = text_to_utf8text( text, old, &offset, &new )) != S_OK) return hr;
heap_free( old );
free( old );
node->text = &new->text;
break;
}
......@@ -2928,7 +2928,7 @@ static HRESULT write_text_node( struct writer *writer, const WS_XML_TEXT *text )
{
WS_XML_TEXT *new, *old = node->text;
if ((hr = text_to_text( text, old, &offset, &new )) != S_OK) return hr;
heap_free( old );
free( old );
node->text = new;
break;
}
......@@ -4610,7 +4610,7 @@ static HRESULT write_add_comment_node( struct writer *writer, const WS_XML_STRIN
if (!(node = alloc_node( WS_XML_NODE_TYPE_COMMENT ))) return E_OUTOFMEMORY;
comment = (WS_XML_COMMENT_NODE *)node;
if (value->length && !(comment->value.bytes = heap_alloc( value->length )))
if (value->length && !(comment->value.bytes = malloc( value->length )))
{
free_node( node );
return E_OUTOFMEMORY;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment