imagehlp: Use the IMAGE_FIRST_SECTION helper macro.
[wine.git] / dlls / opcservices / opc_private.h
blobcfd8ee864b296de4dcc05cb644f3fee0e3ea4baf
1 /*
2 * Copyright 2018 Nikolay Sivov for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #include "msopc.h"
21 static inline BOOL opc_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
23 size_t new_capacity, max_capacity;
24 void *new_elements;
26 if (count <= *capacity)
27 return TRUE;
29 max_capacity = ~(SIZE_T)0 / size;
30 if (count > max_capacity)
31 return FALSE;
33 new_capacity = max(4, *capacity);
34 while (new_capacity < count && new_capacity <= max_capacity / 2)
35 new_capacity *= 2;
36 if (new_capacity < count)
37 new_capacity = max_capacity;
39 if (!(new_elements = realloc(*elements, new_capacity * size)))
40 return FALSE;
42 *elements = new_elements;
43 *capacity = new_capacity;
44 return TRUE;
47 struct opc_uri
49 IOpcPartUri IOpcPartUri_iface;
50 LONG refcount;
51 BOOL is_part_uri;
53 IUri *uri;
54 IUri *rels_part_uri;
55 struct opc_uri *source_uri;
58 extern HRESULT opc_package_create(IOpcFactory *factory, IOpcPackage **package);
59 extern HRESULT opc_part_uri_create(IUri *uri, struct opc_uri *source_uri, IOpcPartUri **part_uri);
60 extern HRESULT opc_root_uri_create(IOpcUri **opc_uri);
62 extern HRESULT opc_package_write(IOpcPackage *package, OPC_WRITE_FLAGS flags, IStream *stream);
64 struct zip_archive;
65 extern HRESULT compress_create_archive(IStream *output, struct zip_archive **archive);
66 extern HRESULT compress_add_file(struct zip_archive *archive, const WCHAR *path, IStream *content,
67 OPC_COMPRESSION_OPTIONS options);
68 extern void compress_finalize_archive(struct zip_archive *archive);