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
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
;
28 if (count
<= *capacity
)
31 max_capacity
= ~(SIZE_T
)0 / size
;
32 if (count
> max_capacity
)
35 new_capacity
= max(4, *capacity
);
36 while (new_capacity
< count
&& new_capacity
<= max_capacity
/ 2)
38 if (new_capacity
< count
)
39 new_capacity
= max_capacity
;
41 if (!(new_elements
= heap_realloc(*elements
, new_capacity
* size
)))
44 *elements
= new_elements
;
45 *capacity
= new_capacity
;
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
;