本文整理汇总了C++中HeapReAlloc函数的典型用法代码示例。如果您正苦于以下问题:C++ HeapReAlloc函数的具体用法?C++ HeapReAlloc怎么用?C++ HeapReAlloc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了HeapReAlloc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_output
static struct output *
add_output( struct d3dadapter9 *This )
{
struct adapter_group *group = &This->groups[This->ngroups-1];
if (group->noutputs >= group->noutputsalloc) {
void *r;
if (group->noutputsalloc == 0) {
group->noutputsalloc = 2;
r = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
group->noutputsalloc*sizeof(struct output));
} else {
group->noutputsalloc <<= 1;
r = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, group->outputs,
group->noutputsalloc*sizeof(struct output));
}
if (!r) { return NULL; }
group->outputs = r;
}
return &group->outputs[group->noutputs++];
}
示例2: sw_bb_renderbuffer_storage
/* Renderbuffer routines */
static GLboolean
sw_bb_renderbuffer_storage(struct gl_context* ctx, struct gl_renderbuffer *rb,
GLenum internalFormat,
GLuint width, GLuint height)
{
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
struct sw_framebuffer* fb = CONTAINING_RECORD(srb, struct sw_framebuffer, backbuffer);
UINT widthBytes = WIDTH_BYTES_ALIGN32(width, pixel_formats[fb->format_index].color_bits);
srb->Base.Format = pixel_formats[fb->format_index].mesa;
if(srb->Buffer)
srb->Buffer = HeapReAlloc(GetProcessHeap(), 0, srb->Buffer, widthBytes*height);
else
srb->Buffer = HeapAlloc(GetProcessHeap(), 0, widthBytes*height);
if(!srb->Buffer)
{
srb->Base.Format = MESA_FORMAT_NONE;
return GL_FALSE;
}
srb->Base.Width = width;
srb->Base.Height = height;
srb->RowStride = widthBytes;
return GL_TRUE;
}
示例3: Allign256
void clsGlobalDataQueue::AddDataToQueue(GlobalQueue &pQueue, char * sData, const size_t &szLen) {
if(pQueue.szSize < (pQueue.szLen + szLen)) {
size_t szAllignLen = Allign256(pQueue.szLen + szLen);
char * pOldBuf = pQueue.sBuffer;
#ifdef _WIN32
pQueue.sBuffer = (char *)HeapReAlloc(clsServerManager::hLibHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, szAllignLen);
#else
pQueue.sBuffer = (char *)realloc(pOldBuf, szAllignLen);
#endif
if(pQueue.sBuffer == NULL) {
pQueue.sBuffer = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in clsGlobalDataQueue::AddDataToQueue\n", (uint64_t)szAllignLen);
return;
}
pQueue.szSize = szAllignLen-1;
}
memcpy(pQueue.sBuffer+pQueue.szLen, sData, szLen);
pQueue.szLen += szLen;
pQueue.sBuffer[pQueue.szLen] = '\0';
}
示例4: VGA_PrepareVideoMemCopy
/* prepare the text mode video memory copy that is used to only
* update the video memory line that did get updated. */
static void VGA_PrepareVideoMemCopy(unsigned Xres, unsigned Yres)
{
char *p, *p2;
unsigned int i;
/*
* Allocate space for char + attr.
*/
if (vga_text_old)
vga_text_old = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
vga_text_old, Xres * Yres * 2 );
else
vga_text_old = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
Xres * Yres * 2 );
p = VGA_AlphaBuffer();
p2 = vga_text_old;
/* make sure the video mem copy contains the exact opposite of our
* actual text mode memory area to make sure the screen
* does get updated fully initially */
for (i=0; i < Xres*Yres*2; i++)
*p2++ = *p++ ^ 0xff; /* XOR it */
}
示例5: sprintf
// appends data to the UserIPQueue
void clsGlobalDataQueue::UserIPStore(User * pUser) {
if(UserIPQueue.szLen == 0) {
UserIPQueue.szLen = sprintf(UserIPQueue.sBuffer, "$UserIP %s %s|", pUser->sNick, pUser->sIP);
UserIPQueue.bHaveDollars = false;
} else {
int iDataLen = sprintf(msg, "%s %s$$|", pUser->sNick, pUser->sIP);
if(CheckSprintf(iDataLen, 128, "clsGlobalDataQueue::UserIPStore") == true) {
if(UserIPQueue.bHaveDollars == false) {
UserIPQueue.sBuffer[UserIPQueue.szLen-1] = '$';
UserIPQueue.sBuffer[UserIPQueue.szLen] = '$';
UserIPQueue.bHaveDollars = true;
UserIPQueue.szLen += 2;
}
if(UserIPQueue.szSize < UserIPQueue.szLen+iDataLen) {
size_t szAllignLen = Allign256(UserIPQueue.szLen+iDataLen);
char * pOldBuf = UserIPQueue.sBuffer;
#ifdef _WIN32
UserIPQueue.sBuffer = (char *)HeapReAlloc(clsServerManager::hLibHeap, HEAP_NO_SERIALIZE, (void *)pOldBuf, szAllignLen);
#else
UserIPQueue.sBuffer = (char *)realloc(pOldBuf, szAllignLen);
#endif
if(UserIPQueue.sBuffer == NULL) {
UserIPQueue.sBuffer = pOldBuf;
AppendDebugLog("%s - [MEM] Cannot reallocate %" PRIu64 " bytes in clsGlobalDataQueue::UserIPStore\n", (uint64_t)szAllignLen);
return;
}
UserIPQueue.szSize = (uint32_t)(szAllignLen-1);
}
memcpy(UserIPQueue.sBuffer+UserIPQueue.szLen-1, msg, iDataLen);
UserIPQueue.szLen += iDataLen-1;
UserIPQueue.sBuffer[UserIPQueue.szLen] = '\0';
}
}
}
示例6: GDI_InternalBezier
/* Helper for GDI_Bezier.
* Just handles one Bezier, so Points should point to four POINTs
*/
static void GDI_InternalBezier( POINT *Points, POINT **PtsOut, INT *dwOut,
INT *nPtsOut, INT level )
{
if(*nPtsOut == *dwOut) {
*dwOut *= 2;
*PtsOut = HeapReAlloc( GetProcessHeap(), 0, *PtsOut,
*dwOut * sizeof(POINT) );
}
if(!level || BezierCheck(level, Points)) {
if(*nPtsOut == 0) {
(*PtsOut)[0].x = BEZIERSHIFTDOWN(Points[0].x);
(*PtsOut)[0].y = BEZIERSHIFTDOWN(Points[0].y);
*nPtsOut = 1;
}
(*PtsOut)[*nPtsOut].x = BEZIERSHIFTDOWN(Points[3].x);
(*PtsOut)[*nPtsOut].y = BEZIERSHIFTDOWN(Points[3].y);
(*nPtsOut) ++;
} else {
POINT Points2[4]; /* for the second recursive call */
Points2[3]=Points[3];
BEZIERMIDDLE(Points2[2], Points[2], Points[3]);
BEZIERMIDDLE(Points2[0], Points[1], Points[2]);
BEZIERMIDDLE(Points2[1],Points2[0],Points2[2]);
BEZIERMIDDLE(Points[1], Points[0], Points[1]);
BEZIERMIDDLE(Points[2], Points[1], Points2[0]);
BEZIERMIDDLE(Points[3], Points[2], Points2[1]);
Points2[0]=Points[3];
/* do the two halves */
GDI_InternalBezier(Points, PtsOut, dwOut, nPtsOut, level-1);
GDI_InternalBezier(Points2, PtsOut, dwOut, nPtsOut, level-1);
}
}
示例7: fetch_process_thread
static BOOL fetch_process_thread( DWORD flags, SYSTEM_PROCESS_INFORMATION** pspi,
ULONG* num_pcs, ULONG* num_thd)
{
NTSTATUS status;
ULONG size, offset;
PSYSTEM_PROCESS_INFORMATION spi;
*num_pcs = *num_thd = 0;
if (!(flags & (TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD))) return TRUE;
*pspi = HeapAlloc( GetProcessHeap(), 0, size = 4096 );
for (;;)
{
status = NtQuerySystemInformation( SystemProcessInformation, *pspi,
size, NULL );
switch (status)
{
case STATUS_SUCCESS:
*num_pcs = *num_thd = offset = 0;
spi = *pspi;
do
{
spi = (SYSTEM_PROCESS_INFORMATION*)((char*)spi + offset);
if (flags & TH32CS_SNAPPROCESS) (*num_pcs)++;
if (flags & TH32CS_SNAPTHREAD) *num_thd += spi->dwThreadCount;
} while ((offset = spi->NextEntryOffset));
return TRUE;
case STATUS_INFO_LENGTH_MISMATCH:
*pspi = HeapReAlloc( GetProcessHeap(), 0, *pspi, size *= 2 );
break;
default:
SetLastError( RtlNtStatusToDosError( status ) );
break;
}
}
}
示例8: CryptMemRealloc
LPVOID WINAPI CryptMemRealloc(LPVOID pv, ULONG cbSize)
{
return HeapReAlloc(GetProcessHeap(), 0, pv, cbSize);
}
示例9: IDirectSoundCaptureBufferImpl_Create
//.........这里部分代码省略.........
device->pwfx = DSOUND_CopyFormat(wfex);
if ( device->pwfx == NULL )
return DSERR_OUTOFMEMORY;
This = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
sizeof(IDirectSoundCaptureBufferImpl));
if ( This == NULL ) {
WARN("out of memory\n");
return DSERR_OUTOFMEMORY;
} else {
HRESULT err = DS_OK;
LPBYTE newbuf;
DWORD buflen;
This->numIfaces = 0;
This->ref = 0;
This->refn = 0;
This->device = device;
This->device->capture_buffer = This;
This->nrofnotifies = 0;
This->pdscbd = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
lpcDSCBufferDesc->dwSize);
if (This->pdscbd)
CopyMemory(This->pdscbd, lpcDSCBufferDesc, lpcDSCBufferDesc->dwSize);
else {
WARN("no memory\n");
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
return DSERR_OUTOFMEMORY;
}
This->IDirectSoundCaptureBuffer8_iface.lpVtbl = &dscbvt;
This->IDirectSoundNotify_iface.lpVtbl = &dscnvt;
err = IMMDevice_Activate(device->mmdevice, &IID_IAudioClient,
CLSCTX_INPROC_SERVER, NULL, (void**)&device->client);
if(FAILED(err)){
WARN("Activate failed: %08x\n", err);
HeapFree(GetProcessHeap(), 0, This->pdscbd);
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
return err;
}
err = IAudioClient_Initialize(device->client,
AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST,
200 * 100000, 50000, device->pwfx, NULL);
if(FAILED(err)){
WARN("Initialize failed: %08x\n", err);
IAudioClient_Release(device->client);
device->client = NULL;
HeapFree(GetProcessHeap(), 0, This->pdscbd);
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
if(err == AUDCLNT_E_UNSUPPORTED_FORMAT)
return DSERR_BADFORMAT;
return err;
}
err = IAudioClient_GetService(device->client, &IID_IAudioCaptureClient,
(void**)&device->capture);
if(FAILED(err)){
WARN("GetService failed: %08x\n", err);
IAudioClient_Release(device->client);
device->client = NULL;
HeapFree(GetProcessHeap(), 0, This->pdscbd);
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
return err;
}
buflen = lpcDSCBufferDesc->dwBufferBytes;
TRACE("desired buflen=%d, old buffer=%p\n", buflen, device->buffer);
if (device->buffer)
newbuf = HeapReAlloc(GetProcessHeap(),0,device->buffer,buflen);
else
newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
if (newbuf == NULL) {
IAudioClient_Release(device->client);
device->client = NULL;
IAudioCaptureClient_Release(device->capture);
device->capture = NULL;
HeapFree(GetProcessHeap(), 0, This->pdscbd);
This->device->capture_buffer = 0;
HeapFree( GetProcessHeap(), 0, This );
return DSERR_OUTOFMEMORY;
}
device->buffer = newbuf;
device->buflen = buflen;
}
IDirectSoundCaptureBuffer_AddRef(&This->IDirectSoundCaptureBuffer8_iface);
*ppobj = This;
TRACE("returning DS_OK\n");
return DS_OK;
}
示例10: yr_realloc
void* yr_realloc(void* ptr, size_t size)
{
return (void*) HeapReAlloc(hHeap, HEAP_ZERO_MEMORY, ptr, size);
}
示例11: find_joystick_devices
static INT find_joystick_devices(void)
{
INT i;
if (joystick_devices_count != -1) return joystick_devices_count;
joystick_devices_count = 0;
for (i = 0; i < MAX_JOYSTICKS; i++)
{
int fd;
struct JoyDev joydev, *new_joydevs;
BYTE axes_map[ABS_MAX + 1];
snprintf(joydev.device, sizeof(joydev.device), "%s%d", JOYDEV_NEW, i);
if ((fd = open(joydev.device, O_RDONLY)) < 0)
{
snprintf(joydev.device, sizeof(joydev.device), "%s%d", JOYDEV_OLD, i);
if ((fd = open(joydev.device, O_RDONLY)) < 0) continue;
}
strcpy(joydev.name, "Wine Joystick");
#if defined(JSIOCGNAME)
if (ioctl(fd, JSIOCGNAME(sizeof(joydev.name) - sizeof(JOYDEVDRIVER)), joydev.name) < 0)
WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joydev.device, strerror(errno));
#endif
/* Append driver name */
strcat(joydev.name, JOYDEVDRIVER);
if (device_disabled_registry(joydev.name)) {
close(fd);
continue;
}
#ifdef JSIOCGAXES
if (ioctl(fd, JSIOCGAXES, &joydev.axis_count) < 0)
{
WARN("ioctl(%s,JSIOCGAXES) failed: %s, defauting to 2\n", joydev.device, strerror(errno));
joydev.axis_count = 2;
}
#endif
#ifdef JSIOCGBUTTONS
if (ioctl(fd, JSIOCGBUTTONS, &joydev.button_count) < 0)
{
WARN("ioctl(%s,JSIOCGBUTTONS) failed: %s, defauting to 2\n", joydev.device, strerror(errno));
joydev.button_count = 2;
}
#endif
if (ioctl(fd, JSIOCGAXMAP, axes_map) < 0)
{
WARN("ioctl(%s,JSIOCGNAME) failed: %s\n", joydev.device, strerror(errno));
joydev.dev_axes_map = NULL;
}
else
if ((joydev.dev_axes_map = HeapAlloc(GetProcessHeap(), 0, joydev.axis_count * sizeof(int))))
{
INT j;
/* Remap to DI numbers */
for (j = 0; j < joydev.axis_count; j++)
if (axes_map[j] < 8)
/* Axis match 1-to-1 */
joydev.dev_axes_map[j] = j;
else if (axes_map[j] == 16 ||
axes_map[j] == 17)
/* POV axis */
joydev.dev_axes_map[j] = 8;
else
joydev.dev_axes_map[j] = -1;
}
close(fd);
if (!joystick_devices_count)
new_joydevs = HeapAlloc(GetProcessHeap(), 0, sizeof(struct JoyDev));
else
new_joydevs = HeapReAlloc(GetProcessHeap(), 0, joystick_devices,
(joystick_devices_count + 1) * sizeof(struct JoyDev));
if (!new_joydevs) continue;
TRACE("Found a joystick on %s: %s\n with %d axes and %d buttons\n", joydev.device,
joydev.name, joydev.axis_count, joydev.button_count);
joystick_devices = new_joydevs;
joystick_devices[joystick_devices_count++] = joydev;
}
return joystick_devices_count;
}
示例12: processRegLinesW
static void processRegLinesW(FILE *in)
{
WCHAR* buf = NULL; /* line read from input stream */
ULONG lineSize = REG_VAL_BUF_SIZE;
size_t CharsInBuf = -1;
WCHAR* s; /* The pointer into buf for where the current fgets should read */
WCHAR* line; /* The start of the current line */
buf = HeapAlloc(GetProcessHeap(), 0, lineSize * sizeof(WCHAR));
CHECK_ENOUGH_MEMORY(buf);
s = buf;
line = buf;
while(!feof(in)) {
size_t size_remaining;
int size_to_get;
WCHAR *s_eol = NULL; /* various local uses */
/* Do we need to expand the buffer ? */
assert (s >= buf && s <= buf + lineSize);
size_remaining = lineSize - (s-buf);
if (size_remaining < 2) /* room for 1 character and the \0 */
{
WCHAR *new_buffer;
size_t new_size = lineSize + (REG_VAL_BUF_SIZE / sizeof(WCHAR));
if (new_size > lineSize) /* no arithmetic overflow */
new_buffer = HeapReAlloc (GetProcessHeap(), 0, buf, new_size * sizeof(WCHAR));
else
new_buffer = NULL;
CHECK_ENOUGH_MEMORY(new_buffer);
buf = new_buffer;
line = buf;
s = buf + lineSize - size_remaining;
lineSize = new_size;
size_remaining = lineSize - (s-buf);
}
/* Get as much as possible into the buffer, terminated either by
* eof, error or getting the maximum amount. Abort on error.
*/
size_to_get = (size_remaining > INT_MAX ? INT_MAX : size_remaining);
CharsInBuf = fread(s, sizeof(WCHAR), size_to_get - 1, in);
s[CharsInBuf] = 0;
if (CharsInBuf == 0) {
if (ferror(in)) {
perror ("While reading input");
exit (IO_ERROR);
} else {
assert (feof(in));
*s = '\0';
/* It is not clear to me from the definition that the
* contents of the buffer are well defined on detecting
* an eof without managing to read anything.
*/
}
}
/* If we didn't read the eol nor the eof go around for the rest */
while(1)
{
const WCHAR line_endings[] = {'\r','\n',0};
s_eol = strpbrkW(line, line_endings);
if(!s_eol) {
/* Move the stub of the line to the start of the buffer so
* we get the maximum space to read into, and so we don't
* have to recalculate 'line' if the buffer expands */
MoveMemory(buf, line, (strlenW(line)+1) * sizeof(WCHAR));
line = buf;
s = strchrW(line, '\0');
break;
}
/* If it is a comment line then discard it and go around again */
if (*line == '#' || *line == ';') {
if (*s_eol == '\r' && *(s_eol+1) == '\n')
line = s_eol + 2;
else
line = s_eol + 1;
continue;
}
/* If there is a concatenating \\ then go around again */
if (*(s_eol-1) == '\\') {
WCHAR* NextLine = s_eol + 1;
if(*s_eol == '\r' && *(s_eol+1) == '\n')
NextLine++;
while(*(NextLine+1) == ' ' || *(NextLine+1) == '\t')
NextLine++;
MoveMemory(s_eol - 1, NextLine, (CharsInBuf - (NextLine - s) + 1)*sizeof(WCHAR));
CharsInBuf -= NextLine - s_eol + 1;
s_eol = 0;
continue;
//.........这里部分代码省略.........
示例13: realloc
void * __cdecl realloc(_Post_ptr_invalid_ void * _Memory, _In_ size_t _NewSize){
return HeapReAlloc(GetProcessHeap(), 0, _Memory, _NewSize);
}
示例14: sizeof
//.........这里部分代码省略.........
if(t42->tables[i].write) t42->num_of_written_tables++;
if(t42->tables[i].MS_tag == MS_MAKE_TAG('l','o','c','a'))
t42->loca_tab = i;
else if(t42->tables[i].MS_tag == MS_MAKE_TAG('g','l','y','f'))
t42->glyf_tab = i;
else if(t42->tables[i].MS_tag == MS_MAKE_TAG('h','e','a','d'))
t42->head_tab = i;
else if(t42->tables[i].MS_tag == MS_MAKE_TAG('h','m','t','x'))
t42->hmtx_tab = i;
else if(t42->tables[i].MS_tag == MS_MAKE_TAG('m','a','x','p'))
t42->maxp_tab = i;
}
if(i < num_of_tables) {
TRACE("Table %d has length %d. Will use Type 1 font instead.\n", i, t42->tables[i].len);
T42_free(t42);
return NULL;
}
t42->glyph_sent_size = GLYPH_SENT_INC;
t42->glyph_sent = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
t42->glyph_sent_size *
sizeof(*(t42->glyph_sent)));
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(start) + strlen(ps_name) +
100);
push_lc_numeric("C");
sprintf(buf, start, ps_name,
(float)bbox->left / emsize, (float)bbox->bottom / emsize,
(float)bbox->right / emsize, (float)bbox->top / emsize);
pop_lc_numeric();
PSDRV_WriteSpool(physDev, buf, strlen(buf));
t42->num_of_written_tables++; /* explicitly add glyf */
sprintf(buf, TT_offset_table, t42->num_of_written_tables,
t42->num_of_written_tables, t42->num_of_written_tables, t42->num_of_written_tables);
PSDRV_WriteSpool(physDev, buf, strlen(buf));
tablepos = 12 + t42->num_of_written_tables * 16;
cur_off = 12;
for(i = 0; i < num_of_tables; i++) {
if(!t42->tables[i].write) continue;
sprintf(buf, TT_table_dir_entry, FLIP_ORDER(t42->tables[i].MS_tag),
t42->tables[i].check, t42->tables[i].len ? tablepos : 0,
t42->tables[i].len);
PSDRV_WriteSpool(physDev, buf, strlen(buf));
tablepos += ((t42->tables[i].len + 3) & ~3);
if(t42->tables[i].MS_tag == MS_MAKE_TAG('l','o','c','a'))
loca_off = cur_off;
cur_off += 16;
}
sprintf(buf, TT_table_dir_entry, FLIP_ORDER(t42->tables[t42->glyf_tab].MS_tag),
t42->tables[t42->glyf_tab].check, tablepos, t42->tables[t42->glyf_tab].len);
PSDRV_WriteSpool(physDev, buf, strlen(buf));
PSDRV_WriteSpool(physDev, "00>\n", 4); /* add an extra byte for old PostScript rips */
glyf_off = cur_off;
for(i = 0; i < num_of_tables; i++) {
if(t42->tables[i].len == 0 || !t42->tables[i].write) continue;
PSDRV_WriteSpool(physDev, "<", 1);
for(j = 0; j < ((t42->tables[i].len + 3) & ~3); j++) {
sprintf(buf, "%02x", t42->tables[i].data[j]);
PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(j % 16 == 15) PSDRV_WriteSpool(physDev, "\n", 1);
}
PSDRV_WriteSpool(physDev, "00>\n", 4); /* add an extra byte for old PostScript rips */
}
/* glyf_blocks is a 0 terminated list, holding the start offset of each block. For simplicity
glyf_blocks[0] is 0 */
nb_blocks = 2;
t42->glyf_blocks = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nb_blocks + 1) * sizeof(DWORD));
for(i = 0; i < GET_BE_WORD(t42->tables[t42->maxp_tab].data + 4); i++) {
DWORD start, end, size;
get_glyf_pos(t42, i, &start, &end);
size = end - t42->glyf_blocks[nb_blocks-2];
if(size > 0x2000 && t42->glyf_blocks[nb_blocks-1] % 4 == 0) {
nb_blocks++;
t42->glyf_blocks = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
t42->glyf_blocks, (nb_blocks + 1) * sizeof(DWORD));
}
t42->glyf_blocks[nb_blocks-1] = end;
}
PSDRV_WriteSpool(physDev, "[ ", 2);
for(i = 1; t42->glyf_blocks[i]; i++) {
sprintf(buf,"%d ", t42->glyf_blocks[i] - t42->glyf_blocks[i-1] + 1);
/* again add one byte for old PostScript rips */
PSDRV_WriteSpool(physDev, buf, strlen(buf));
if(i % 8 == 0)
PSDRV_WriteSpool(physDev, "\n", 1);
}
PSDRV_WriteSpool(physDev, storage, sizeof(storage) - 1);
sprintf(buf, end, loca_off, glyf_off);
PSDRV_WriteSpool(physDev, buf, strlen(buf));
HeapFree(GetProcessHeap(), 0, buf);
return t42;
}
示例15: ID3DXFileDataImpl_Create
static HRESULT ID3DXFileDataImpl_Create(IDirectXFileObject *dxfile_object, ID3DXFileData **ret_iface)
{
ID3DXFileDataImpl *object;
IDirectXFileObject *data_object;
HRESULT ret;
TRACE("(%p, %p)\n", dxfile_object, ret_iface);
*ret_iface = NULL;
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
return E_OUTOFMEMORY;
object->ID3DXFileData_iface.lpVtbl = &ID3DXFileData_Vtbl;
object->ref = 1;
ret = IDirectXFileObject_QueryInterface(dxfile_object, &IID_IDirectXFileData, (void **)&object->dxfile_data);
if (FAILED(ret))
{
IDirectXFileDataReference *reference;
ret = IDirectXFileObject_QueryInterface(dxfile_object, &IID_IDirectXFileDataReference, (void **)&reference);
if (SUCCEEDED(ret))
{
ret = IDirectXFileDataReference_Resolve(reference, &object->dxfile_data);
if (FAILED(ret))
{
HeapFree(GetProcessHeap(), 0, object);
return E_FAIL;
}
object->reference = TRUE;
}
else
{
FIXME("Don't known what to do with binary object\n");
HeapFree(GetProcessHeap(), 0, object);
return E_FAIL;
}
}
while (SUCCEEDED(ret = IDirectXFileData_GetNextObject(object->dxfile_data, &data_object)))
{
if (object->children)
object->children = HeapReAlloc(GetProcessHeap(), 0, object->children, sizeof(ID3DXFileData*) * (object->nb_children + 1));
else
object->children = HeapAlloc(GetProcessHeap(), 0, sizeof(ID3DXFileData*));
if (!object->children)
{
ret = E_OUTOFMEMORY;
break;
}
ret = ID3DXFileDataImpl_Create(data_object, &object->children[object->nb_children]);
if (ret != S_OK)
break;
object->nb_children++;
}
if (ret != DXFILEERR_NOMOREOBJECTS)
{
(&object->ID3DXFileData_iface)->lpVtbl->Release(&object->ID3DXFileData_iface);
return ret;
}
TRACE("Found %u children\n", object->nb_children);
*ret_iface = &object->ID3DXFileData_iface;
return S_OK;
}