Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ea15c212
Commit
ea15c212
authored
Mar 29, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 29, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
opcservices: Use CRT allocation functions.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6549f1f3
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
52 deletions
+50
-52
compress.c
dlls/opcservices/compress.c
+9
-10
factory.c
dlls/opcservices/factory.c
+3
-3
opc_private.h
dlls/opcservices/opc_private.h
+1
-2
package.c
dlls/opcservices/package.c
+27
-27
uri.c
dlls/opcservices/uri.c
+10
-10
No files found.
dlls/opcservices/compress.c
View file @
ea15c212
...
@@ -28,7 +28,6 @@
...
@@ -28,7 +28,6 @@
#include "opc_private.h"
#include "opc_private.h"
#include "wine/debug.h"
#include "wine/debug.h"
#include "wine/heap.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
msopc
);
WINE_DEFAULT_DEBUG_CHANNEL
(
msopc
);
...
@@ -120,7 +119,7 @@ HRESULT compress_create_archive(IStream *output, struct zip_archive **out)
...
@@ -120,7 +119,7 @@ HRESULT compress_create_archive(IStream *output, struct zip_archive **out)
WORD
date
,
time
;
WORD
date
,
time
;
FILETIME
ft
;
FILETIME
ft
;
if
(
!
(
archive
=
heap_
alloc
(
sizeof
(
*
archive
))))
if
(
!
(
archive
=
m
alloc
(
sizeof
(
*
archive
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
archive
->
files
=
NULL
;
archive
->
files
=
NULL
;
...
@@ -180,9 +179,9 @@ void compress_finalize_archive(struct zip_archive *archive)
...
@@ -180,9 +179,9 @@ void compress_finalize_archive(struct zip_archive *archive)
IStream_Release
(
archive
->
output
);
IStream_Release
(
archive
->
output
);
for
(
i
=
0
;
i
<
archive
->
file_count
;
i
++
)
for
(
i
=
0
;
i
<
archive
->
file_count
;
i
++
)
heap_
free
(
archive
->
files
[
i
]);
free
(
archive
->
files
[
i
]);
heap_
free
(
archive
->
files
);
free
(
archive
->
files
);
heap_
free
(
archive
);
free
(
archive
);
}
}
static
void
compress_write_content
(
struct
zip_archive
*
archive
,
IStream
*
content
,
static
void
compress_write_content
(
struct
zip_archive
*
archive
,
IStream
*
content
,
...
@@ -270,7 +269,7 @@ HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path,
...
@@ -270,7 +269,7 @@ HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path,
DWORD
len
;
DWORD
len
;
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
path
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
len
=
WideCharToMultiByte
(
CP_ACP
,
0
,
path
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
name
=
heap_
alloc
(
len
)))
if
(
!
(
name
=
m
alloc
(
len
)))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
WideCharToMultiByte
(
CP_ACP
,
0
,
path
,
-
1
,
name
,
len
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
path
,
-
1
,
name
,
len
,
NULL
,
NULL
);
...
@@ -302,9 +301,9 @@ HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path,
...
@@ -302,9 +301,9 @@ HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path,
return
archive
->
write_result
;
return
archive
->
write_result
;
/* Set directory entry */
/* Set directory entry */
if
(
!
(
entry
=
heap_alloc_zero
(
sizeof
(
*
entry
)
+
local_header
.
name_length
)))
if
(
!
(
entry
=
calloc
(
1
,
sizeof
(
*
entry
)
+
local_header
.
name_length
)))
{
{
heap_
free
(
name
);
free
(
name
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -320,12 +319,12 @@ HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path,
...
@@ -320,12 +319,12 @@ HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path,
entry
->
name_length
=
local_header
.
name_length
;
entry
->
name_length
=
local_header
.
name_length
;
entry
->
local_file_offset
=
local_header_pos
;
entry
->
local_file_offset
=
local_header_pos
;
memcpy
(
entry
+
1
,
name
,
entry
->
name_length
);
memcpy
(
entry
+
1
,
name
,
entry
->
name_length
);
heap_
free
(
name
);
free
(
name
);
if
(
!
opc_array_reserve
((
void
**
)
&
archive
->
files
,
&
archive
->
file_size
,
archive
->
file_count
+
1
,
if
(
!
opc_array_reserve
((
void
**
)
&
archive
->
files
,
&
archive
->
file_size
,
archive
->
file_count
+
1
,
sizeof
(
*
archive
->
files
)))
sizeof
(
*
archive
->
files
)))
{
{
heap_
free
(
entry
);
free
(
entry
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
...
dlls/opcservices/factory.c
View file @
ea15c212
...
@@ -85,7 +85,7 @@ static ULONG WINAPI opc_filestream_Release(IStream *iface)
...
@@ -85,7 +85,7 @@ static ULONG WINAPI opc_filestream_Release(IStream *iface)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
CloseHandle
(
stream
->
hfile
);
CloseHandle
(
stream
->
hfile
);
heap_
free
(
stream
);
free
(
stream
);
}
}
return
refcount
;
return
refcount
;
...
@@ -263,14 +263,14 @@ static HRESULT opc_filestream_create(const WCHAR *filename, OPC_STREAM_IO_MODE i
...
@@ -263,14 +263,14 @@ static HRESULT opc_filestream_create(const WCHAR *filename, OPC_STREAM_IO_MODE i
return
E_INVALIDARG
;
return
E_INVALIDARG
;
}
}
if
(
!
(
stream
=
heap_alloc_zero
(
sizeof
(
*
stream
))))
if
(
!
(
stream
=
calloc
(
1
,
sizeof
(
*
stream
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
stream
->
hfile
=
CreateFileW
(
filename
,
access
,
0
,
sa
,
creation
,
flags
,
NULL
);
stream
->
hfile
=
CreateFileW
(
filename
,
access
,
0
,
sa
,
creation
,
flags
,
NULL
);
if
(
stream
->
hfile
==
INVALID_HANDLE_VALUE
)
if
(
stream
->
hfile
==
INVALID_HANDLE_VALUE
)
{
{
HRESULT
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
HRESULT
hr
=
HRESULT_FROM_WIN32
(
GetLastError
());
heap_
free
(
stream
);
free
(
stream
);
return
hr
;
return
hr
;
}
}
...
...
dlls/opcservices/opc_private.h
View file @
ea15c212
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
*/
*/
#include "msopc.h"
#include "msopc.h"
#include "wine/heap.h"
static
inline
BOOL
opc_array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
static
inline
BOOL
opc_array_reserve
(
void
**
elements
,
size_t
*
capacity
,
size_t
count
,
size_t
size
)
{
{
...
@@ -37,7 +36,7 @@ static inline BOOL opc_array_reserve(void **elements, size_t *capacity, size_t c
...
@@ -37,7 +36,7 @@ static inline BOOL opc_array_reserve(void **elements, size_t *capacity, size_t c
if
(
new_capacity
<
count
)
if
(
new_capacity
<
count
)
new_capacity
=
max_capacity
;
new_capacity
=
max_capacity
;
if
(
!
(
new_elements
=
heap_
realloc
(
*
elements
,
new_capacity
*
size
)))
if
(
!
(
new_elements
=
realloc
(
*
elements
,
new_capacity
*
size
)))
return
FALSE
;
return
FALSE
;
*
elements
=
new_elements
;
*
elements
=
new_elements
;
...
...
dlls/opcservices/package.c
View file @
ea15c212
...
@@ -170,8 +170,8 @@ static void opc_content_release(struct opc_content *content)
...
@@ -170,8 +170,8 @@ static void opc_content_release(struct opc_content *content)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
heap_
free
(
content
->
data
);
free
(
content
->
data
);
heap_
free
(
content
);
free
(
content
);
}
}
}
}
...
@@ -214,7 +214,7 @@ static ULONG WINAPI opc_part_enum_Release(IOpcPartEnumerator *iface)
...
@@ -214,7 +214,7 @@ static ULONG WINAPI opc_part_enum_Release(IOpcPartEnumerator *iface)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
IOpcPartSet_Release
(
&
part_enum
->
part_set
->
IOpcPartSet_iface
);
IOpcPartSet_Release
(
&
part_enum
->
part_set
->
IOpcPartSet_iface
);
heap_
free
(
part_enum
);
free
(
part_enum
);
}
}
return
refcount
;
return
refcount
;
...
@@ -321,7 +321,7 @@ static HRESULT opc_part_enum_create(struct opc_part_set *part_set, IOpcPartEnume
...
@@ -321,7 +321,7 @@ static HRESULT opc_part_enum_create(struct opc_part_set *part_set, IOpcPartEnume
{
{
struct
opc_part_enum
*
part_enum
;
struct
opc_part_enum
*
part_enum
;
if
(
!
(
part_enum
=
heap_alloc_zero
(
sizeof
(
*
part_enum
))))
if
(
!
(
part_enum
=
calloc
(
1
,
sizeof
(
*
part_enum
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
part_enum
->
IOpcPartEnumerator_iface
.
lpVtbl
=
&
opc_part_enum_vtbl
;
part_enum
->
IOpcPartEnumerator_iface
.
lpVtbl
=
&
opc_part_enum_vtbl
;
...
@@ -375,7 +375,7 @@ static ULONG WINAPI opc_rel_enum_Release(IOpcRelationshipEnumerator *iface)
...
@@ -375,7 +375,7 @@ static ULONG WINAPI opc_rel_enum_Release(IOpcRelationshipEnumerator *iface)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
IOpcRelationshipSet_Release
(
&
rel_enum
->
rel_set
->
IOpcRelationshipSet_iface
);
IOpcRelationshipSet_Release
(
&
rel_enum
->
rel_set
->
IOpcRelationshipSet_iface
);
heap_
free
(
rel_enum
);
free
(
rel_enum
);
}
}
return
refcount
;
return
refcount
;
...
@@ -482,7 +482,7 @@ static HRESULT opc_rel_enum_create(struct opc_relationship_set *rel_set, IOpcRel
...
@@ -482,7 +482,7 @@ static HRESULT opc_rel_enum_create(struct opc_relationship_set *rel_set, IOpcRel
{
{
struct
opc_rel_enum
*
rel_enum
;
struct
opc_rel_enum
*
rel_enum
;
if
(
!
(
rel_enum
=
heap_alloc_zero
(
sizeof
(
*
rel_enum
))))
if
(
!
(
rel_enum
=
calloc
(
1
,
sizeof
(
*
rel_enum
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
rel_enum
->
IOpcRelationshipEnumerator_iface
.
lpVtbl
=
&
opc_rel_enum_vtbl
;
rel_enum
->
IOpcRelationshipEnumerator_iface
.
lpVtbl
=
&
opc_rel_enum_vtbl
;
...
@@ -535,7 +535,7 @@ static ULONG WINAPI opc_content_stream_Release(IStream *iface)
...
@@ -535,7 +535,7 @@ static ULONG WINAPI opc_content_stream_Release(IStream *iface)
if
(
!
refcount
)
if
(
!
refcount
)
{
{
opc_content_release
(
stream
->
content
);
opc_content_release
(
stream
->
content
);
heap_
free
(
stream
);
free
(
stream
);
}
}
return
refcount
;
return
refcount
;
...
@@ -578,7 +578,7 @@ static HRESULT WINAPI opc_content_stream_Write(IStream *iface, const void *data,
...
@@ -578,7 +578,7 @@ static HRESULT WINAPI opc_content_stream_Write(IStream *iface, const void *data,
if
(
size
>
stream
->
content
->
size
.
QuadPart
-
stream
->
pos
.
QuadPart
)
if
(
size
>
stream
->
content
->
size
.
QuadPart
-
stream
->
pos
.
QuadPart
)
{
{
void
*
ptr
=
heap_
realloc
(
stream
->
content
->
data
,
stream
->
pos
.
QuadPart
+
size
);
void
*
ptr
=
realloc
(
stream
->
content
->
data
,
stream
->
pos
.
QuadPart
+
size
);
if
(
!
ptr
)
if
(
!
ptr
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
stream
->
content
->
data
=
ptr
;
stream
->
content
->
data
=
ptr
;
...
@@ -707,7 +707,7 @@ static HRESULT opc_content_stream_create(struct opc_content *content, IStream **
...
@@ -707,7 +707,7 @@ static HRESULT opc_content_stream_create(struct opc_content *content, IStream **
{
{
struct
opc_content_stream
*
stream
;
struct
opc_content_stream
*
stream
;
if
(
!
(
stream
=
heap_alloc_zero
(
sizeof
(
*
stream
))))
if
(
!
(
stream
=
calloc
(
1
,
sizeof
(
*
stream
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
stream
->
IStream_iface
.
lpVtbl
=
&
opc_content_stream_vtbl
;
stream
->
IStream_iface
.
lpVtbl
=
&
opc_content_stream_vtbl
;
...
@@ -780,7 +780,7 @@ static ULONG WINAPI opc_part_Release(IOpcPart *iface)
...
@@ -780,7 +780,7 @@ static ULONG WINAPI opc_part_Release(IOpcPart *iface)
IOpcPartUri_Release
(
part
->
name
);
IOpcPartUri_Release
(
part
->
name
);
CoTaskMemFree
(
part
->
content_type
);
CoTaskMemFree
(
part
->
content_type
);
opc_content_release
(
part
->
content
);
opc_content_release
(
part
->
content
);
heap_
free
(
part
);
free
(
part
);
}
}
return
refcount
;
return
refcount
;
...
@@ -866,7 +866,7 @@ static HRESULT opc_part_create(struct opc_part_set *set, IOpcPartUri *name, cons
...
@@ -866,7 +866,7 @@ static HRESULT opc_part_create(struct opc_part_set *set, IOpcPartUri *name, cons
if
(
!
opc_array_reserve
((
void
**
)
&
set
->
parts
,
&
set
->
size
,
set
->
count
+
1
,
sizeof
(
*
set
->
parts
)))
if
(
!
opc_array_reserve
((
void
**
)
&
set
->
parts
,
&
set
->
size
,
set
->
count
+
1
,
sizeof
(
*
set
->
parts
)))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
!
(
part
=
heap_alloc_zero
(
sizeof
(
*
part
))))
if
(
!
(
part
=
calloc
(
1
,
sizeof
(
*
part
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
part
->
IOpcPart_iface
.
lpVtbl
=
&
opc_part_vtbl
;
part
->
IOpcPart_iface
.
lpVtbl
=
&
opc_part_vtbl
;
...
@@ -880,7 +880,7 @@ static HRESULT opc_part_create(struct opc_part_set *set, IOpcPartUri *name, cons
...
@@ -880,7 +880,7 @@ static HRESULT opc_part_create(struct opc_part_set *set, IOpcPartUri *name, cons
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
part
->
content
=
heap_alloc_zero
(
sizeof
(
*
part
->
content
));
part
->
content
=
calloc
(
1
,
sizeof
(
*
part
->
content
));
if
(
!
part
->
content
)
if
(
!
part
->
content
)
{
{
IOpcPart_Release
(
&
part
->
IOpcPart_iface
);
IOpcPart_Release
(
&
part
->
IOpcPart_iface
);
...
@@ -951,8 +951,8 @@ static ULONG WINAPI opc_part_set_Release(IOpcPartSet *iface)
...
@@ -951,8 +951,8 @@ static ULONG WINAPI opc_part_set_Release(IOpcPartSet *iface)
for
(
i
=
0
;
i
<
part_set
->
count
;
++
i
)
for
(
i
=
0
;
i
<
part_set
->
count
;
++
i
)
IOpcPart_Release
(
&
part_set
->
parts
[
i
]
->
IOpcPart_iface
);
IOpcPart_Release
(
&
part_set
->
parts
[
i
]
->
IOpcPart_iface
);
heap_
free
(
part_set
->
parts
);
free
(
part_set
->
parts
);
heap_
free
(
part_set
);
free
(
part_set
);
}
}
return
refcount
;
return
refcount
;
...
@@ -1088,7 +1088,7 @@ static ULONG WINAPI opc_relationship_Release(IOpcRelationship *iface)
...
@@ -1088,7 +1088,7 @@ static ULONG WINAPI opc_relationship_Release(IOpcRelationship *iface)
CoTaskMemFree
(
relationship
->
type
);
CoTaskMemFree
(
relationship
->
type
);
IOpcUri_Release
(
relationship
->
source_uri
);
IOpcUri_Release
(
relationship
->
source_uri
);
IUri_Release
(
relationship
->
target
);
IUri_Release
(
relationship
->
target
);
heap_
free
(
relationship
);
free
(
relationship
);
}
}
return
refcount
;
return
refcount
;
...
@@ -1183,7 +1183,7 @@ static HRESULT opc_relationship_create(struct opc_relationship_set *set, const W
...
@@ -1183,7 +1183,7 @@ static HRESULT opc_relationship_create(struct opc_relationship_set *set, const W
if
(
!
opc_array_reserve
((
void
**
)
&
set
->
relationships
,
&
set
->
size
,
set
->
count
+
1
,
sizeof
(
*
set
->
relationships
)))
if
(
!
opc_array_reserve
((
void
**
)
&
set
->
relationships
,
&
set
->
size
,
set
->
count
+
1
,
sizeof
(
*
set
->
relationships
)))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
!
(
relationship
=
heap_alloc_zero
(
sizeof
(
*
relationship
))))
if
(
!
(
relationship
=
calloc
(
1
,
sizeof
(
*
relationship
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
relationship
->
IOpcRelationship_iface
.
lpVtbl
=
&
opc_relationship_vtbl
;
relationship
->
IOpcRelationship_iface
.
lpVtbl
=
&
opc_relationship_vtbl
;
...
@@ -1272,8 +1272,8 @@ static ULONG WINAPI opc_relationship_set_Release(IOpcRelationshipSet *iface)
...
@@ -1272,8 +1272,8 @@ static ULONG WINAPI opc_relationship_set_Release(IOpcRelationshipSet *iface)
for
(
i
=
0
;
i
<
relationship_set
->
count
;
++
i
)
for
(
i
=
0
;
i
<
relationship_set
->
count
;
++
i
)
IOpcRelationship_Release
(
&
relationship_set
->
relationships
[
i
]
->
IOpcRelationship_iface
);
IOpcRelationship_Release
(
&
relationship_set
->
relationships
[
i
]
->
IOpcRelationship_iface
);
IOpcUri_Release
(
relationship_set
->
source_uri
);
IOpcUri_Release
(
relationship_set
->
source_uri
);
heap_
free
(
relationship_set
->
relationships
);
free
(
relationship_set
->
relationships
);
heap_
free
(
relationship_set
);
free
(
relationship_set
);
}
}
return
refcount
;
return
refcount
;
...
@@ -1398,7 +1398,7 @@ static HRESULT opc_relationship_set_create(IOpcUri *source_uri, IOpcRelationship
...
@@ -1398,7 +1398,7 @@ static HRESULT opc_relationship_set_create(IOpcUri *source_uri, IOpcRelationship
{
{
struct
opc_relationship_set
*
relationship_set
;
struct
opc_relationship_set
*
relationship_set
;
if
(
!
(
relationship_set
=
heap_alloc_zero
(
sizeof
(
*
relationship_set
))))
if
(
!
(
relationship_set
=
calloc
(
1
,
sizeof
(
*
relationship_set
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
relationship_set
->
IOpcRelationshipSet_iface
.
lpVtbl
=
&
opc_relationship_set_vtbl
;
relationship_set
->
IOpcRelationshipSet_iface
.
lpVtbl
=
&
opc_relationship_set_vtbl
;
...
@@ -1452,7 +1452,7 @@ static ULONG WINAPI opc_package_Release(IOpcPackage *iface)
...
@@ -1452,7 +1452,7 @@ static ULONG WINAPI opc_package_Release(IOpcPackage *iface)
IOpcRelationshipSet_Release
(
package
->
relationship_set
);
IOpcRelationshipSet_Release
(
package
->
relationship_set
);
if
(
package
->
source_uri
)
if
(
package
->
source_uri
)
IOpcUri_Release
(
package
->
source_uri
);
IOpcUri_Release
(
package
->
source_uri
);
heap_
free
(
package
);
free
(
package
);
}
}
return
refcount
;
return
refcount
;
...
@@ -1466,7 +1466,7 @@ static HRESULT WINAPI opc_package_GetPartSet(IOpcPackage *iface, IOpcPartSet **p
...
@@ -1466,7 +1466,7 @@ static HRESULT WINAPI opc_package_GetPartSet(IOpcPackage *iface, IOpcPartSet **p
if
(
!
package
->
part_set
)
if
(
!
package
->
part_set
)
{
{
struct
opc_part_set
*
part_set
=
heap_alloc_zero
(
sizeof
(
*
part_set
));
struct
opc_part_set
*
part_set
=
calloc
(
1
,
sizeof
(
*
part_set
));
if
(
!
part_set
)
if
(
!
part_set
)
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
...
@@ -1515,7 +1515,7 @@ HRESULT opc_package_create(IOpcFactory *factory, IOpcPackage **out)
...
@@ -1515,7 +1515,7 @@ HRESULT opc_package_create(IOpcFactory *factory, IOpcPackage **out)
struct
opc_package
*
package
;
struct
opc_package
*
package
;
HRESULT
hr
;
HRESULT
hr
;
if
(
!
(
package
=
heap_alloc_zero
(
sizeof
(
*
package
))))
if
(
!
(
package
=
calloc
(
1
,
sizeof
(
*
package
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
package
->
IOpcPackage_iface
.
lpVtbl
=
&
opc_package_vtbl
;
package
->
IOpcPackage_iface
.
lpVtbl
=
&
opc_package_vtbl
;
...
@@ -1523,7 +1523,7 @@ HRESULT opc_package_create(IOpcFactory *factory, IOpcPackage **out)
...
@@ -1523,7 +1523,7 @@ HRESULT opc_package_create(IOpcFactory *factory, IOpcPackage **out)
if
(
FAILED
(
hr
=
IOpcFactory_CreatePackageRootUri
(
factory
,
&
package
->
source_uri
)))
if
(
FAILED
(
hr
=
IOpcFactory_CreatePackageRootUri
(
factory
,
&
package
->
source_uri
)))
{
{
heap_
free
(
package
);
free
(
package
);
return
hr
;
return
hr
;
}
}
...
@@ -1566,7 +1566,7 @@ static HRESULT opc_package_add_override_content_type(struct content_types *types
...
@@ -1566,7 +1566,7 @@ static HRESULT opc_package_add_override_content_type(struct content_types *types
{
{
struct
content_type
*
type
;
struct
content_type
*
type
;
if
(
!
(
type
=
heap_
alloc
(
sizeof
(
*
type
))))
if
(
!
(
type
=
m
alloc
(
sizeof
(
*
type
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
type
->
element
=
CONTENT_TYPE_OVERRIDE
;
type
->
element
=
CONTENT_TYPE_OVERRIDE
;
...
@@ -1583,7 +1583,7 @@ static HRESULT opc_package_add_default_content_type(struct content_types *types,
...
@@ -1583,7 +1583,7 @@ static HRESULT opc_package_add_default_content_type(struct content_types *types,
{
{
struct
content_type
*
type
;
struct
content_type
*
type
;
if
(
!
(
type
=
heap_
alloc
(
sizeof
(
*
type
))))
if
(
!
(
type
=
m
alloc
(
sizeof
(
*
type
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
type
->
element
=
CONTENT_TYPE_DEFAULT
;
type
->
element
=
CONTENT_TYPE_DEFAULT
;
...
@@ -1593,7 +1593,7 @@ static HRESULT opc_package_add_default_content_type(struct content_types *types,
...
@@ -1593,7 +1593,7 @@ static HRESULT opc_package_add_default_content_type(struct content_types *types,
{
{
CoTaskMemFree
(
type
->
u
.
def
.
ext
);
CoTaskMemFree
(
type
->
u
.
def
.
ext
);
CoTaskMemFree
(
type
->
u
.
def
.
type
);
CoTaskMemFree
(
type
->
u
.
def
.
type
);
heap_
free
(
type
);
free
(
type
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
...
@@ -1810,7 +1810,7 @@ static HRESULT opc_package_write_contenttypes(IOpcPackage *package, struct zip_a
...
@@ -1810,7 +1810,7 @@ static HRESULT opc_package_write_contenttypes(IOpcPackage *package, struct zip_a
hr
=
IXmlWriter_WriteEndElement
(
writer
);
hr
=
IXmlWriter_WriteEndElement
(
writer
);
list_remove
(
&
content_type
->
entry
);
list_remove
(
&
content_type
->
entry
);
heap_
free
(
content_type
);
free
(
content_type
);
}
}
if
(
SUCCEEDED
(
hr
))
if
(
SUCCEEDED
(
hr
))
...
...
dlls/opcservices/uri.c
View file @
ea15c212
...
@@ -79,7 +79,7 @@ static ULONG WINAPI opc_uri_Release(IOpcPartUri *iface)
...
@@ -79,7 +79,7 @@ static ULONG WINAPI opc_uri_Release(IOpcPartUri *iface)
if
(
uri
->
source_uri
)
if
(
uri
->
source_uri
)
IOpcPartUri_Release
(
&
uri
->
source_uri
->
IOpcPartUri_iface
);
IOpcPartUri_Release
(
&
uri
->
source_uri
->
IOpcPartUri_iface
);
IUri_Release
(
uri
->
uri
);
IUri_Release
(
uri
->
uri
);
heap_
free
(
uri
);
free
(
uri
);
}
}
return
refcount
;
return
refcount
;
...
@@ -485,7 +485,7 @@ static IUri *opc_part_uri_get_rels_uri(IUri *uri)
...
@@ -485,7 +485,7 @@ static IUri *opc_part_uri_get_rels_uri(IUri *uri)
}
}
}
}
ret
=
heap_
alloc
((
len
+
ARRAY_SIZE
(
relsextW
)
+
ARRAY_SIZE
(
relsdirW
))
*
sizeof
(
WCHAR
));
ret
=
m
alloc
((
len
+
ARRAY_SIZE
(
relsextW
)
+
ARRAY_SIZE
(
relsdirW
))
*
sizeof
(
WCHAR
));
if
(
!
ret
)
if
(
!
ret
)
{
{
SysFreeString
(
path
);
SysFreeString
(
path
);
...
@@ -505,7 +505,7 @@ static IUri *opc_part_uri_get_rels_uri(IUri *uri)
...
@@ -505,7 +505,7 @@ static IUri *opc_part_uri_get_rels_uri(IUri *uri)
if
(
FAILED
(
hr
=
CreateUri
(
ret
,
Uri_CREATE_ALLOW_RELATIVE
,
0
,
&
rels_uri
)))
if
(
FAILED
(
hr
=
CreateUri
(
ret
,
Uri_CREATE_ALLOW_RELATIVE
,
0
,
&
rels_uri
)))
WARN
(
"Failed to create rels uri, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to create rels uri, hr %#lx.
\n
"
,
hr
);
heap_
free
(
ret
);
free
(
ret
);
SysFreeString
(
path
);
SysFreeString
(
path
);
return
rels_uri
;
return
rels_uri
;
...
@@ -539,13 +539,13 @@ static HRESULT opc_source_uri_create(struct opc_uri *uri, IOpcUri **out)
...
@@ -539,13 +539,13 @@ static HRESULT opc_source_uri_create(struct opc_uri *uri, IOpcUri **out)
if
(
!
uri
->
source_uri
)
if
(
!
uri
->
source_uri
)
return
OPC_E_RELATIONSHIP_URI_REQUIRED
;
return
OPC_E_RELATIONSHIP_URI_REQUIRED
;
if
(
!
(
obj
=
heap_alloc_zero
(
sizeof
(
*
obj
))))
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
opc_part_uri_init
(
obj
,
NULL
,
uri
->
source_uri
->
is_part_uri
,
uri
->
source_uri
->
uri
)))
if
(
FAILED
(
hr
=
opc_part_uri_init
(
obj
,
NULL
,
uri
->
source_uri
->
is_part_uri
,
uri
->
source_uri
->
uri
)))
{
{
WARN
(
"Failed to init part uri, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to init part uri, hr %#lx.
\n
"
,
hr
);
heap_
free
(
obj
);
free
(
obj
);
return
hr
;
return
hr
;
}
}
...
@@ -561,13 +561,13 @@ HRESULT opc_part_uri_create(IUri *uri, struct opc_uri *source_uri, IOpcPartUri *
...
@@ -561,13 +561,13 @@ HRESULT opc_part_uri_create(IUri *uri, struct opc_uri *source_uri, IOpcPartUri *
struct
opc_uri
*
obj
;
struct
opc_uri
*
obj
;
HRESULT
hr
;
HRESULT
hr
;
if
(
!
(
obj
=
heap_alloc_zero
(
sizeof
(
*
obj
))))
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
opc_part_uri_init
(
obj
,
source_uri
,
TRUE
,
uri
)))
if
(
FAILED
(
hr
=
opc_part_uri_init
(
obj
,
source_uri
,
TRUE
,
uri
)))
{
{
WARN
(
"Failed to init part uri, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to init part uri, hr %#lx.
\n
"
,
hr
);
heap_
free
(
obj
);
free
(
obj
);
return
hr
;
return
hr
;
}
}
...
@@ -584,13 +584,13 @@ HRESULT opc_root_uri_create(IOpcUri **out)
...
@@ -584,13 +584,13 @@ HRESULT opc_root_uri_create(IOpcUri **out)
*
out
=
NULL
;
*
out
=
NULL
;
if
(
!
(
obj
=
heap_alloc_zero
(
sizeof
(
*
obj
))))
if
(
!
(
obj
=
calloc
(
1
,
sizeof
(
*
obj
))))
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
CreateUri
(
L"/"
,
Uri_CREATE_ALLOW_RELATIVE
,
0
,
&
uri
)))
if
(
FAILED
(
hr
=
CreateUri
(
L"/"
,
Uri_CREATE_ALLOW_RELATIVE
,
0
,
&
uri
)))
{
{
WARN
(
"Failed to create rels uri, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to create rels uri, hr %#lx.
\n
"
,
hr
);
heap_
free
(
obj
);
free
(
obj
);
return
hr
;
return
hr
;
}
}
...
@@ -599,7 +599,7 @@ HRESULT opc_root_uri_create(IOpcUri **out)
...
@@ -599,7 +599,7 @@ HRESULT opc_root_uri_create(IOpcUri **out)
if
(
FAILED
(
hr
))
if
(
FAILED
(
hr
))
{
{
WARN
(
"Failed to init uri, hr %#lx.
\n
"
,
hr
);
WARN
(
"Failed to init uri, hr %#lx.
\n
"
,
hr
);
heap_
free
(
uri
);
free
(
uri
);
return
hr
;
return
hr
;
}
}
...
...
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