tests: Don't initialize static variables to 0.
[wine.git] / dlls / mf / mf_private.h
blob0b7d1c65fa42e211b6d474862af0275e4b3e015e
1 /*
2 * Copyright 2019 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 "mfidl.h"
21 #include "wine/heap.h"
23 static inline BOOL mf_array_reserve(void **elements, size_t *capacity, size_t count, size_t size)
25 size_t new_capacity, max_capacity;
26 void *new_elements;
28 if (count <= *capacity)
29 return TRUE;
31 max_capacity = ~(SIZE_T)0 / size;
32 if (count > max_capacity)
33 return FALSE;
35 new_capacity = max(4, *capacity);
36 while (new_capacity < count && new_capacity <= max_capacity / 2)
37 new_capacity *= 2;
38 if (new_capacity < count)
39 new_capacity = max_capacity;
41 if (!(new_elements = heap_realloc(*elements, new_capacity * size)))
42 return FALSE;
44 *elements = new_elements;
45 *capacity = new_capacity;
47 return TRUE;
50 struct activate_funcs
52 HRESULT (*create_object)(IMFAttributes *attributes, void *context, IUnknown **object);
53 void (*free_private)(void *context);
56 HRESULT create_activation_object(void *context, const struct activate_funcs *funcs, IMFActivate **ret) DECLSPEC_HIDDEN;