Release 1.3.1.
[wine/hramrach.git] / dlls / msvcp90 / memory.c
blobacbdda774dbbd4967cc95310d88398aea42749cc
1 /*
2 * Copyright 2010 Piotr Caban 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 "config.h"
21 #include <stdarg.h>
22 #include <limits.h>
24 #include "msvcp90.h"
26 #include "windef.h"
27 #include "winbase.h"
28 #include "wine/debug.h"
29 WINE_DEFAULT_DEBUG_CHANNEL(msvcp90);
31 /* ?address@?$allocator@D@std@@QBEPADAAD@Z */
32 /* ?address@?$allocator@D@std@@QEBAPEADAEAD@Z */
33 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_address, 8)
34 char* __stdcall MSVCP_allocator_char_address(void *this, char *ptr)
36 return ptr;
39 /* ?address@?$allocator@D@std@@QBEPBDABD@Z */
40 /* ?address@?$allocator@D@std@@QEBAPEBDAEBD@Z */
41 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_const_address, 8)
42 const char* __stdcall MSVCP_allocator_char_const_address(void *this, const char *ptr)
44 return ptr;
47 /* ??0?$allocator@D@std@@QAE@XZ */
48 /* ??0?$allocator@D@std@@QEAA@XZ */
49 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_ctor, 4)
50 void* __stdcall MSVCP_allocator_char_ctor(void *this)
52 return this;
55 /* ??0?$allocator@D@std@@QAE@ABV01@@Z */
56 /* ??0?$allocator@D@std@@QEAA@AEBV01@@Z */
57 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_copy_ctor, 8)
58 void* __stdcall MSVCP_allocator_char_copy_ctor(void *this, void *copy)
60 return this;
63 /* ??4?$allocator@D@std@@QAEAAV01@ABV01@@Z */
64 /* ??4?$allocator@D@std@@QEAAAEAV01@AEBV01@@Z */
65 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_assign, 8);
66 void* __stdcall MSVCP_allocator_char_assign(void *this, void *assign)
68 return this;
71 /* ?deallocate@?$allocator@D@std@@QAEXPADI@Z */
72 /* ?deallocate@?$allocator@D@std@@QEAAXPEAD_K@Z */
73 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_deallocate, 12);
74 void __stdcall MSVCP_allocator_char_deallocate(void *this, char *ptr, size_t size)
76 MSVCRT_operator_delete(ptr);
79 /* ?allocate@?$allocator@D@std@@QAEPADI@Z */
80 /* ?allocate@?$allocator@D@std@@QEAAPEAD_K@Z */
81 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_allocate, 8);
82 char* __stdcall MSVCP_allocator_char_allocate(void *this, size_t count)
84 return MSVCRT_operator_new(sizeof(char[count]));
87 /* ?allocate@?$allocator@D@std@@QAEPADIPBX@Z */
88 /* ?allocate@?$allocator@D@std@@QEAAPEAD_KPEBX@Z */
89 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_allocate_hint, 12);
90 char* __stdcall MSVCP_allocator_char_allocate_hint(void *this,
91 size_t count, const void *hint)
93 /* Native ignores hint */
94 return MSVCP_allocator_char_allocate(this, count);
97 /* ?construct@?$allocator@D@std@@QAEXPADABD@Z */
98 /* ?construct@?$allocator@D@std@@QEAAXPEADAEBD@Z */
99 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_construct, 12);
100 void __stdcall MSVCP_allocator_char_construct(void *this, char *ptr, const char *val)
102 *ptr = *val;
105 /* ?destroy@?$allocator@D@std@@QAEXPAD@Z */
106 /* ?destroy@?$allocator@D@std@@QEAAXPEAD@Z */
107 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_destroy, 8);
108 void __stdcall MSVCP_allocator_char_destroy(void *this, char *ptr)
112 /* ?max_size@?$allocator@D@std@@QBEIXZ */
113 /* ?max_size@?$allocator@D@std@@QEBA_KXZ */
114 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_char_max_size, 4);
115 size_t __stdcall MSVCP_allocator_char_max_size(void *this)
117 return UINT_MAX/sizeof(char);
121 /* allocator<wchar_t> */
122 /* ?address@?$allocator@_W@std@@QBEPA_WAA_W@Z */
123 /* ?address@?$allocator@_W@std@@QEBAPEA_WAEA_W@Z */
124 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_address, 8)
125 wchar_t* __stdcall MSVCP_allocator_wchar_address(void *this, wchar_t *ptr)
127 return ptr;
130 /* ?address@?$allocator@_W@std@@QBEPB_WAB_W@Z */
131 /* ?address@?$allocator@_W@std@@QEBAPEB_WAEB_W@Z */
132 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_const_address, 8)
133 const wchar_t* __stdcall MSVCP_allocator_wchar_const_address(void *this, const wchar_t *ptr)
135 return ptr;
138 /* ??0?$allocator@_W@std@@QAE@XZ */
139 /* ??0?$allocator@_W@std@@QEAA@XZ */
140 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_ctor, 4)
141 void* __stdcall MSVCP_allocator_wchar_ctor(void *this)
143 return this;
146 /* ??0?$allocator@_W@std@@QAE@ABV01@@Z */
147 /* ??0?$allocator@_W@std@@QEAA@AEBV01@@Z */
148 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_copy_ctor, 8)
149 void* __stdcall MSVCP_allocator_wchar_copy_ctor(void *this, void *copy)
151 return this;
154 /* ??4?$allocator@_W@std@@QAEAAV01@ABV01@@Z */
155 /* ??4?$allocator@_W@std@@QEAAAEAV01@AEBV01@@Z */
156 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_assign, 8)
157 void* __stdcall MSVCP_allocator_wchar_assign(void *this, void *assign)
159 return this;
162 /* ?deallocate@?$allocator@_W@std@@QAEXPA_WI@Z */
163 /* ?deallocate@?$allocator@_W@std@@QEAAXPEA_W_K@Z */
164 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_deallocate, 12)
165 void __stdcall MSVCP_allocator_wchar_deallocate(void *this,
166 wchar_t *ptr, size_t size)
168 MSVCRT_operator_delete(ptr);
171 /* ?allocate@?$allocator@_W@std@@QAEPA_WI@Z */
172 /* ?allocate@?$allocator@_W@std@@QEAAPEA_W_K@Z */
173 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_allocate, 8)
174 wchar_t* __stdcall MSVCP_allocator_wchar_allocate(void *this, size_t count)
176 if(UINT_MAX/count < sizeof(wchar_t)) {
177 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
178 return NULL;
181 return MSVCRT_operator_new(sizeof(wchar_t[count]));
184 /* ?allocate@?$allocator@_W@std@@QAEPA_WIPBX@Z */
185 /* ?allocate@?$allocator@_W@std@@QEAAPEA_W_KPEBX@Z */
186 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_allocate_hint, 12)
187 wchar_t* __stdcall MSVCP_allocator_wchar_allocate_hint(void *this,
188 size_t count, const void *hint)
190 return MSVCP_allocator_wchar_allocate(this, count);
193 /* ?construct@?$allocator@_W@std@@QAEXPA_WAB_W@Z */
194 /* ?construct@?$allocator@_W@std@@QEAAXPEA_WAEB_W@Z */
195 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_construct, 12)
196 void __stdcall MSVCP_allocator_wchar_construct(void *this,
197 wchar_t *ptr, const wchar_t *val)
199 *ptr = *val;
202 /* ?destroy@?$allocator@_W@std@@QAEXPA_W@Z */
203 /* ?destroy@?$allocator@_W@std@@QEAAXPEA_W@Z */
204 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_destroy, 8)
205 void __stdcall MSVCP_allocator_wchar_destroy(void *this, char *ptr)
209 /* ?max_size@?$allocator@_W@std@@QBEIXZ */
210 /* ?max_size@?$allocator@_W@std@@QEBA_KXZ */
211 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_wchar_max_size, 4)
212 size_t __stdcall MSVCP_allocator_wchar_max_size(void *this)
214 return UINT_MAX/sizeof(wchar_t);
217 /* allocator<unsigned short> */
218 /* ?address@?$allocator@G@std@@QBEPAGAAG@Z */
219 /* ?address@?$allocator@G@std@@QEBAPEAGAEAG@Z */
220 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_address, 8)
221 unsigned short* __stdcall MSVCP_allocator_short_address(
222 void *this, unsigned short *ptr)
224 return ptr;
227 /* ?address@?$allocator@G@std@@QBEPBGABG@Z */
228 /* ?address@?$allocator@G@std@@QEBAPEBGAEBG@Z */
229 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_const_address, 8)
230 const unsigned short* __stdcall MSVCP_allocator_short_const_address(
231 void *this, const unsigned short *ptr)
233 return ptr;
236 /* ??0?$allocator@G@std@@QAE@XZ */
237 /* ??0?$allocator@G@std@@QEAA@XZ */
238 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_ctor, 4)
239 void* __stdcall MSVCP_allocator_short_ctor(void *this)
241 return this;
244 /* ??0?$allocator@G@std@@QAE@ABV01@@Z */
245 /* ??0?$allocator@G@std@@QEAA@AEBV01@@Z */
246 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_copy_ctor, 8)
247 void* __stdcall MSVCP_allocator_short_copy_ctor(void *this, void *copy)
249 return this;
252 /* ??4?$allocator@G@std@@QAEAAV01@ABV01@@Z */
253 /* ??4?$allocator@G@std@@QEAAAEAV01@AEBV01@@Z */
254 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_assign, 8)
255 void* __stdcall MSVCP_allocator_short_assign(void *this, void *assign)
257 return this;
260 /* ?deallocate@?$allocator@G@std@@QAEXPAGI@Z */
261 /* ?deallocate@?$allocator@G@std@@QEAAXPEAG_K@Z */
262 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_deallocate, 12)
263 void __stdcall MSVCP_allocator_short_deallocate(void *this,
264 unsigned short *ptr, size_t size)
266 MSVCRT_operator_delete(ptr);
269 /* ?allocate@?$allocator@G@std@@QAEPAGI@Z */
270 /* ?allocate@?$allocator@G@std@@QEAAPEAG_K@Z */
271 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_allocate, 8)
272 unsigned short* __stdcall MSVCP_allocator_short_allocate(
273 void *this, size_t count)
275 if(UINT_MAX/count < sizeof(unsigned short)) {
276 throw_exception(EXCEPTION_BAD_ALLOC, NULL);
277 return NULL;
280 return MSVCRT_operator_new(sizeof(unsigned short[count]));
283 /* ?allocate@?$allocator@G@std@@QAEPAGIPBX@Z */
284 /* ?allocate@?$allocator@G@std@@QEAAPEAG_KPEBX@Z */
285 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_allocate_hint, 12)
286 unsigned short* __stdcall MSVCP_allocator_short_allocate_hint(
287 void *this, size_t count, const void *hint)
289 return MSVCP_allocator_short_allocate(this, count);
292 /* ?construct@?$allocator@G@std@@QAEXPAGABG@Z */
293 /* ?construct@?$allocator@G@std@@QEAAXPEAGAEBG@Z */
294 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_construct, 12)
295 void __stdcall MSVCP_allocator_short_construct(void *this,
296 unsigned short *ptr, unsigned short *val)
298 *ptr = *val;
301 /* ?destroy@?$allocator@G@std@@QAEXPAG@Z */
302 /* ?destroy@?$allocator@G@std@@QEAAXPEAG@Z */
303 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_destroy, 8)
304 void __stdcall MSVCP_allocator_short_destroy(void *this, size_t *ptr)
308 /* ?max_size@?$allocator@G@std@@QBEIXZ */
309 /* ?max_size@?$allocator@G@std@@QEBA_KXZ */
310 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_short_max_size, 4)
311 size_t __stdcall MSVCP_allocator_short_max_size(void *this)
313 return UINT_MAX/sizeof(unsigned short);
316 /* allocator<void> */
317 /* ??0?$allocator@X@std@@QAE@XZ */
318 /* ??0?$allocator@X@std@@QEAA@XZ */
319 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_void_ctor, 4);
320 void* __stdcall MSVCP_allocator_void_ctor(void *this)
322 return this;
325 /* ??0?$allocator@X@std@@QAE@ABV01@@Z */
326 /* ??0?$allocator@X@std@@QEAA@AEBV01@@Z */
327 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_void_copy_ctor, 8);
328 void* __stdcall MSVCP_allocator_void_copy_ctor(void *this, void *copy)
330 return this;
333 /* ??4?$allocator@X@std@@QAEAAV01@ABV01@@Z */
334 /* ??4?$allocator@X@std@@QEAAAEAV01@AEBV01@@Z */
335 DEFINE_THISCALL_WRAPPER(MSVCP_allocator_void_assign, 8);
336 void* __stdcall MSVCP_allocator_void_assign(void *this, void *assign)
338 return this;