Commit 9ad96367 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Removed most calls to xmalloc/xrealloc.

parent abdb034f
......@@ -13,7 +13,6 @@
#include "heap.h"
#include "font.h"
#include "options.h"
#include "xmalloc.h"
#include "debugtools.h"
#include "dc.h"
......@@ -225,8 +224,12 @@ BOOL WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
/* Now Get the device capabilities from the printer driver */
printerDevCaps = (DeviceCaps *) xmalloc(sizeof(DeviceCaps));
memset(printerDevCaps, 0, sizeof(DeviceCaps));
printerDevCaps = (DeviceCaps *) calloc(1, sizeof(DeviceCaps));
if(printerDevCaps == NULL) {
ERR("No memory to read the device capabilities!");
HeapFree( GetProcessHeap(), 0, physDev );
return FALSE;
}
if(!output) output = "LPT1:";
/* Get GDIINFO which is the same as a DeviceCaps structure */
......
......@@ -22,7 +22,6 @@
#include "options.h"
#include "x11drv.h"
#include "debugtools.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
DEFAULT_DEBUG_CHANNEL(bitblt)
......
......@@ -16,7 +16,6 @@
#include "color.h"
#include "x11drv.h"
#include "debugtools.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
#include "monitor.h"
#include "local.h"
......
......@@ -21,6 +21,7 @@
# endif
#endif /* defined(HAVE_LIBXXSHM) */
#include <stdlib.h>
#include "windef.h"
#include "bitmap.h"
#include "x11drv.h"
......@@ -30,7 +31,6 @@
#include "callback.h"
#include "selectors.h"
#include "global.h"
#include "xmalloc.h" /* for XCREATEIMAGE macro */
DEFAULT_DEBUG_CHANNEL(bitmap)
DECLARE_DEBUG_CHANNEL(x11drv)
......@@ -2510,7 +2510,12 @@ int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
DefaultVisualOfScreen(X11DRV_GetXScreen()),
descr->depth, ZPixmap, 0, NULL,
descr->infoWidth, lines, 32, 0 );
bmpImage->data = xcalloc( bmpImage->bytes_per_line * lines );
bmpImage->data = calloc( lines, bmpImage->bytes_per_line );
if(bmpImage->data == NULL) {
ERR("Out of memory!");
XDestroyImage( bmpImage );
return lines;
}
}
/* Transfer the pixels */
......@@ -2610,8 +2615,12 @@ int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr )
DefaultVisualOfScreen(X11DRV_GetXScreen()),
descr->depth, ZPixmap, 0, NULL,
descr->infoWidth, lines, 32, 0 );
bmpImage->data = xcalloc( bmpImage->bytes_per_line * lines );
}
bmpImage->data = calloc( lines, bmpImage->bytes_per_line );
if(bmpImage->data == NULL) {
ERR("Out of memory!");
XDestroyImage( bmpImage );
return lines;
} }
XGetSubImage( display, descr->drawable, descr->xDest, descr->yDest,
descr->width, descr->height, AllPlanes, ZPixmap,
......
......@@ -40,7 +40,6 @@
#include "region.h"
#include "struct32.h"
#include "debugtools.h"
#include "xmalloc.h"
DEFAULT_DEBUG_CHANNEL(graphics)
......@@ -977,11 +976,15 @@ X11DRV_Polyline( DC *dc, const POINT* pt, INT count )
if((oldwidth = physDev->pen.width) == 0) physDev->pen.width = 1;
points = (XPoint *) xmalloc (sizeof (XPoint) * (count));
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * count )))
{
WARN("No memory to convert POINTs to XPoints!\n");
return FALSE;
}
for (i = 0; i < count; i++)
{
points[i].x = dc->w.DCOrgX + XLPTODP( dc, pt[i].x );
points[i].y = dc->w.DCOrgY + YLPTODP( dc, pt[i].y );
points[i].x = dc->w.DCOrgX + XLPTODP( dc, pt[i].x );
points[i].y = dc->w.DCOrgY + YLPTODP( dc, pt[i].y );
}
if (X11DRV_SetupGCForPen ( dc ))
......@@ -996,7 +999,7 @@ X11DRV_Polyline( DC *dc, const POINT* pt, INT count )
X11DRV_DIB_UpdateDIBSection(dc, TRUE);
}
free( points );
HeapFree( GetProcessHeap(), 0, points );
physDev->pen.width = oldwidth;
return TRUE;
}
......@@ -1013,7 +1016,11 @@ X11DRV_Polygon( DC *dc, const POINT* pt, INT count )
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
BOOL update = FALSE;
points = (XPoint *) xmalloc (sizeof (XPoint) * (count+1));
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (count+1) )))
{
WARN("No memory to convert POINTs to XPoints!\n");
return FALSE;
}
for (i = 0; i < count; i++)
{
points[i].x = dc->w.DCOrgX + XLPTODP( dc, pt[i].x );
......@@ -1040,7 +1047,7 @@ X11DRV_Polygon( DC *dc, const POINT* pt, INT count )
/* Update the DIBSection from the pixmap */
if (update) X11DRV_DIB_UpdateDIBSection(dc, TRUE);
free( points );
HeapFree( GetProcessHeap(), 0, points );
return TRUE;
}
......@@ -1072,8 +1079,11 @@ X11DRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons)
X11DRV_DIB_UpdateDIBSection(dc, FALSE);
for (i = 0; i < polygons; i++) if (counts[i] > max) max = counts[i];
points = (XPoint *) xmalloc( sizeof(XPoint) * (max+1) );
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (max+1) )))
{
WARN("No memory to convert POINTs to XPoints!\n");
return FALSE;
}
for (i = 0; i < polygons; i++)
{
for (j = 0; j < counts[i]; j++)
......@@ -1090,7 +1100,7 @@ X11DRV_PolyPolygon( DC *dc, const POINT* pt, const INT* counts, UINT polygons)
/* Update the DIBSection of the dc's bitmap */
X11DRV_DIB_UpdateDIBSection(dc, TRUE);
free( points );
HeapFree( GetProcessHeap(), 0, points );
}
return TRUE;
}
......@@ -1113,8 +1123,11 @@ X11DRV_PolyPolyline( DC *dc, const POINT* pt, const DWORD* counts, DWORD polylin
X11DRV_DIB_UpdateDIBSection(dc, FALSE);
for (i = 0; i < polylines; i++) if (counts[i] > max) max = counts[i];
points = (XPoint *) xmalloc( sizeof(XPoint) * (max+1) );
if (!(points = HeapAlloc( GetProcessHeap(), 0, sizeof(XPoint) * (max+1) )))
{
WARN("No memory to convert POINTs to XPoints!\n");
return FALSE;
}
for (i = 0; i < polylines; i++)
{
for (j = 0; j < counts[i]; j++)
......@@ -1131,7 +1144,7 @@ X11DRV_PolyPolyline( DC *dc, const POINT* pt, const DWORD* counts, DWORD polylin
/* Update the DIBSection of the dc's bitmap */
X11DRV_DIB_UpdateDIBSection(dc, TRUE);
free( points );
HeapFree( GetProcessHeap(), 0, points );
}
return TRUE;
}
......
......@@ -24,7 +24,7 @@
#include "xmalloc.h"
#include "x11drv.h"
DEFAULT_DEBUG_CHANNEL(palette)
DEFAULT_DEBUG_CHANNEL(palette);
/* Palette indexed mode:
* logical palette -> mapping -> pixel
......@@ -463,21 +463,32 @@ static BOOL X11DRV_PALETTE_BuildSharedMap(void)
(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_VIRTUAL || !(X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED)) )
? NB_RESERVED_COLORS/2 : -1;
COLOR_sysPal = (PALETTEENTRY*)xmalloc(sizeof(PALETTEENTRY)*256);
COLOR_sysPal = (PALETTEENTRY*)malloc(sizeof(PALETTEENTRY)*256);
if(COLOR_sysPal == NULL) {
ERR("Can not allocate system palette!\n");
return FALSE;
}
/* setup system palette entry <-> pixel mappings and fill in 20 fixed entries */
if( MONITOR_GetDepth(&MONITOR_PrimaryMonitor) <= 8 )
{
X11DRV_PALETTE_XPixelToPalette = (int*)xmalloc(sizeof(int)*256);
memset( X11DRV_PALETTE_XPixelToPalette, 0, 256*sizeof(int) );
}
{
X11DRV_PALETTE_XPixelToPalette = (int*)calloc(256, sizeof(int));
if(X11DRV_PALETTE_XPixelToPalette == NULL) {
ERR("Out of memory: XPixelToPalette!\n");
return FALSE;
}
}
/* for hicolor visuals PaletteToPixel mapping is used to skip
* RGB->pixel calculation in X11DRV_PALETTE_ToPhysical().
*/
X11DRV_PALETTE_PaletteToXPixel = (int*)xmalloc(sizeof(int)*256);
X11DRV_PALETTE_PaletteToXPixel = (int*)malloc(sizeof(int)*256);
if(X11DRV_PALETTE_PaletteToXPixel == NULL) {
ERR("Out of memory: PaletteToXPixel!\n");
return FALSE;
}
for( i = j = 0; i < 256; i++ )
{
......@@ -851,6 +862,7 @@ int X11DRV_PALETTE_SetMapping( PALETTEOBJ* palPtr, UINT uStart, UINT uNum, BOOL
char flag;
int prevMapping = (palPtr->mapping) ? 1 : 0;
int index, iRemapped = 0;
int* mapping;
/* reset dynamic system palette entries */
......@@ -859,8 +871,13 @@ int X11DRV_PALETTE_SetMapping( PALETTEOBJ* palPtr, UINT uStart, UINT uNum, BOOL
/* initialize palette mapping table */
palPtr->mapping = (int*)xrealloc(palPtr->mapping, sizeof(int)*
palPtr->logpalette.palNumEntries);
mapping = (int*)realloc(palPtr->mapping, sizeof(int)*
palPtr->logpalette.palNumEntries);
if(mapping == NULL) {
ERR("Can not allocate new mapping -- memory exausted!");
return 0;
}
palPtr->mapping = mapping;
for( uNum += uStart; uStart < uNum; uStart++ )
{
......
......@@ -191,7 +191,7 @@ extern void _XInitImageFuncPtrs(XImage *);
{ \
int width_bytes = X11DRV_DIB_GetXImageWidthBytes( (width), (bpp) ); \
(image) = TSXCreateImage(display, DefaultVisualOfScreen(X11DRV_GetXScreen()), \
(bpp), ZPixmap, 0, xcalloc( (height)*width_bytes ),\
(bpp), ZPixmap, 0, calloc( (height), width_bytes ),\
(width), (height), 32, width_bytes ); \
}
......@@ -250,8 +250,6 @@ typedef struct
} X11DRV_DIB_IMAGEBITS_DESCR;
extern int X11DRV_DIB_GetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr );
extern int X11DRV_DIB_SetImageBits( const X11DRV_DIB_IMAGEBITS_DESCR *descr );
extern int *X11DRV_DIB_BuildColorMap( struct tagDC *dc, WORD coloruse,
WORD depth, const BITMAPINFO *info,
int *nColors );
......
......@@ -5,7 +5,6 @@
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "xmalloc.h"
extern int PASCAL WinMain(HINSTANCE,HINSTANCE,LPSTR,int);
......@@ -33,7 +32,11 @@ int main( int argc, char *argv [] )
/* Alloc szCmdParam */
for (i = 1; i < argc; i++) len += strlen(argv[i]) + 1;
lpszCmdParam = (LPSTR) xmalloc(len + 1);
lpszCmdParam = (LPSTR) malloc(len + 1);
if(lpszCmdParam == NULL) {
MESSAGE("Not enough memory to store command parameters!");
return 1;
}
/* Concatenate arguments */
if (argc > 1) strcpy(lpszCmdParam, argv[1]);
else lpszCmdParam[0] = '\0';
......
......@@ -27,7 +27,6 @@
#include "stackframe.h"
#include "builtin16.h"
#include "debugtools.h"
#include "xmalloc.h"
#include "toolhelp.h"
DECLARE_DEBUG_CHANNEL(dll)
......@@ -138,8 +137,14 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
but may be missing something. If you have any doc please either send
it to me or fix the code yourself. gfm@werple.mira.net.au
*/
char* buff = xmalloc(size);
char* buff = HeapAlloc(GetProcessHeap(), 0, size);
char* curr = buff;
if(buff == NULL) {
WARN_(dll)("Memory exausted!");
return FALSE;
}
ReadFile(hf, buff, size, &res, NULL);
while(curr < buff + size) {
unsigned int rept = *((short*) curr)++;
......@@ -152,7 +157,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
}
curr += len;
}
free(buff);
HeapFree(GetProcessHeap(), 0, buff);
}
pSeg->flags |= NE_SEGFLAGS_LOADED;
......@@ -175,7 +180,11 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
(char *)pModule + pModule->name_table + 1,
segnum, pSeg->hSeg );
reloc_entries = (struct relocation_entry_s *)xmalloc(count * sizeof(struct relocation_entry_s));
reloc_entries = (struct relocation_entry_s *)HeapAlloc(GetProcessHeap(), 0, count * sizeof(struct relocation_entry_s));
if(reloc_entries == NULL) {
WARN_(fixup)("Not enough memory for relocation entries!");
return FALSE;
}
if (!ReadFile( hf, reloc_entries, count * sizeof(struct relocation_entry_s), &res, NULL) ||
(res != count * sizeof(struct relocation_entry_s)))
{
......@@ -362,7 +371,7 @@ BOOL NE_LoadSegment( NE_MODULE *pModule, WORD segnum )
}
}
free(reloc_entries);
HeapFree(GetProcessHeap(), 0, reloc_entries);
return TRUE;
unknown:
......@@ -370,7 +379,7 @@ unknown:
"TYPE %d, OFFSET %04x, TARGET %04x %04x\n",
i + 1, rep->address_type, rep->relocation_type,
rep->offset, rep->target1, rep->target2);
free(reloc_entries);
HeapFree(GetProcessHeap(), 0, reloc_entries);
return FALSE;
}
......
......@@ -24,7 +24,6 @@
#include "winerror.h"
#include "file.h"
#include "process.h"
#include "xmalloc.h"
#include "global.h"
#include "server.h"
#include "debugtools.h"
......
......@@ -32,7 +32,6 @@
#include "builtin32.h"
#include "debugtools.h"
#include "debugdefs.h"
#include "xmalloc.h"
#include "module.h"
#include "version.h"
#include "winnls.h"
......
......@@ -23,7 +23,6 @@
#include "gdi.h"
#include "dc.h"
#include "callback.h"
#include "xmalloc.h"
#include "options.h"
#include "heap.h"
......@@ -345,7 +344,7 @@ INT16 WINAPI ExtractPQ16(HPQ16 hPQ)
prev->next = queue->next;
else
hpqueue = queue->next;
free(queue);
HeapFree(GetProcessHeap(), 0, queue);
}
TRACE("%x got tag %d key %d\n", hPQ, tag, key);
......@@ -359,7 +358,11 @@ INT16 WINAPI ExtractPQ16(HPQ16 hPQ)
*/
INT16 WINAPI InsertPQ16(HPQ16 hPQ, INT16 tag, INT16 key)
{
struct hpq *queueItem = xmalloc(sizeof(struct hpq));
struct hpq *queueItem = HeapAlloc(GetProcessHeap(), 0, sizeof(struct hpq));
if(queueItem == NULL) {
ERR("Memory exausted!");
return FALSE;
}
queueItem->next = hpqueue;
hpqueue = queueItem;
queueItem->key = key;
......@@ -487,10 +490,10 @@ static int FreePrintJob(HANDLE16 hJob)
if (pPrintJob != NULL)
{
gPrintJobsTable[pPrintJob->nIndex] = NULL;
free(pPrintJob->pszOutput);
free(pPrintJob->pszTitle);
HeapFree(GetProcessHeap(), 0, pPrintJob->pszOutput);
HeapFree(GetProcessHeap(), 0, pPrintJob->pszTitle);
if (pPrintJob->fd >= 0) close(pPrintJob->fd);
free(pPrintJob);
HeapFree(GetProcessHeap(), 0, pPrintJob);
nRet = SP_OK;
}
return nRet;
......@@ -516,14 +519,17 @@ HPJOB16 WINAPI OpenJob16(LPCSTR lpOutput, LPCSTR lpTitle, HDC16 hDC)
fd = CreateSpoolFile(lpOutput);
if (fd >= 0)
{
hHandle = 1;
pPrintJob = xmalloc(sizeof(PRINTJOB));
memset(pPrintJob, 0, sizeof(PRINTJOB));
pPrintJob = HeapAlloc(GetProcessHeap(), 0, sizeof(PRINTJOB));
if(pPrintJob == NULL) {
WARN("Memory exausted!");
return hHandle;
}
hHandle = 1;
pPrintJob->pszOutput = strdup(lpOutput);
pPrintJob->pszOutput = HEAP_strdupA(GetProcessHeap(), 0, lpOutput);
if(lpTitle)
pPrintJob->pszTitle = strdup(lpTitle);
pPrintJob->pszTitle = HEAP_strdupA(GetProcessHeap(), 0, lpTitle);
pPrintJob->hDC = hDC;
pPrintJob->fd = fd;
pPrintJob->nIndex = 0;
......
......@@ -44,7 +44,6 @@
#include "file.h"
#include "heap.h"
#include "debugtools.h"
#include "xmalloc.h"
#include "options.h"
#include "winreg.h"
#include "server.h"
......@@ -73,6 +72,17 @@ static void REGISTRY_Init(void);
#define UNICONVMASK ((1<<REG_SZ)|(1<<REG_MULTI_SZ)|(1<<REG_EXPAND_SZ))
static void *xmalloc( size_t size )
{
void *res;
res = malloc (size ? size : 1);
if (res == NULL) {
WARN("Virtual memory exhausted.\n");
exit (1);
}
return res;
}
/*
* QUESTION
......@@ -404,8 +414,13 @@ static int _wine_read_line( FILE *F, char **buf, int *len )
if (NULL==(s=strchr(curread,'\n'))) {
/* buffer wasn't large enough */
curoff = strlen(*buf);
*buf = xrealloc(*buf,*len*2);
curread = *buf + curoff;
curread = realloc(*buf,*len*2);
if(curread == NULL) {
WARN("Out of memory");
return 0;
}
*buf = curread;
curread+= curoff;
mylen = *len; /* we filled up the buffer and
* got new '*len' bytes to fill
*/
......
......@@ -31,36 +31,3 @@ void *xmalloc( size_t size )
memset(res,0,size);
return res;
}
void *xcalloc( size_t size )
{
void *res;
res = xmalloc (size);
memset(res,0,size);
return res;
}
void *xrealloc( void *ptr, size_t size )
{
void *res = realloc (ptr, size);
if ((res == NULL) && size)
{
MESSAGE("Virtual memory exhausted.\n");
exit (1);
}
return res;
}
char *xstrdup( const char *str )
{
char *res = strdup( str );
if (!res)
{
MESSAGE("Virtual memory exhausted.\n");
exit (1);
}
return res;
}
......@@ -18,7 +18,6 @@
#include "gdi.h"
#include "color.h"
#include "palette.h"
#include "xmalloc.h"
#include "debugtools.h"
#include "winerror.h"
......@@ -64,15 +63,14 @@ HPALETTE16 PALETTE_Init(void)
palPtr->palPalEntry[i].peFlags = 0;
}
hpalette = CreatePalette16( palPtr );
HeapFree( GetProcessHeap(), 0, palPtr );
palObj = (PALETTEOBJ*) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
if (palObj)
{
palObj->mapping = xmalloc( sizeof(int) * 20 );
if (!(palObj->mapping = HeapAlloc( GetProcessHeap(), 0, sizeof(int) * 20 )))
ERR("Can not create palette mapping -- out of memory!");
GDI_HEAP_UNLOCK( hpalette );
HeapFree( GetProcessHeap(), 0, palPtr );
}
return hpalette;
......@@ -335,8 +333,19 @@ BOOL WINAPI ResizePalette(
palPtr = (PALETTEOBJ *) GDI_GetObjPtr( hPal, PALETTE_MAGIC );
if( !palPtr ) return FALSE;
if( mapping )
palPtr->mapping = (int*) xrealloc( mapping, cEntries * sizeof(int) );
if( mapping )
{
int *newMap = (int*) HeapReAlloc(GetProcessHeap(), 0,
mapping, cEntries * sizeof(int) );
if(newMap == NULL)
{
ERR("Can not resize mapping -- out of memory!");
GDI_HEAP_UNLOCK( hPal );
return FALSE;
}
palPtr->mapping = newMap;
}
if( cEntries > cPrevEnt )
{
if( mapping )
......
......@@ -30,7 +30,6 @@
#include "server.h"
#include "winerror.h"
#include "options.h"
#include "xmalloc.h"
/* Some versions of glibc don't define this */
#ifndef SCM_RIGHTS
......@@ -305,7 +304,8 @@ static void start_server( const char *oldcwd )
execl( BINDIR "/wineserver", "wineserver", NULL );
if (oldcwd) chdir( oldcwd );
/* now try the dir we were launched from */
path = xmalloc( strlen(argv0) + 20 );
if (!(path = malloc( strlen(argv0) + 20 )))
fatal_error( "out of memory\n" );
if ((p = strrchr( strcpy( path, argv0 ), '/' )))
{
strcpy( p, "/wineserver" );
......@@ -396,7 +396,7 @@ int CLIENT_InitServer(void)
/* retrieve the current directory */
for (size = 512; ; size *= 2)
{
oldcwd = xmalloc( size );
if (!(oldcwd = malloc( size ))) break;
if (getcwd( oldcwd, size )) break;
free( oldcwd );
if (errno == ERANGE) continue;
......@@ -407,7 +407,8 @@ int CLIENT_InitServer(void)
/* get the server directory name */
if (gethostname( hostname, sizeof(hostname) ) == -1) fatal_perror( "gethostname" );
configdir = PROFILE_GetConfigDir();
serverdir = xmalloc( strlen(configdir) + strlen(SERVERDIR) + strlen(hostname) + 1 );
serverdir = malloc( strlen(configdir) + strlen(SERVERDIR) + strlen(hostname) + 1 );
if (!serverdir) fatal_error( "out of memory\n" );
strcpy( serverdir, configdir );
strcat( serverdir, SERVERDIR );
strcat( serverdir, hostname );
......
......@@ -115,20 +115,21 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
*/
BOOL WINAPI TryEnterCriticalSection( CRITICAL_SECTION *crit )
{
if (InterlockedIncrement( &crit->LockCount ))
BOOL ret = FALSE;
if (InterlockedCompareExchange( (PVOID *)&crit->LockCount,
(PVOID)0L, (PVOID)-1L ) == (PVOID)-1L)
{
if (crit->OwningThread == GetCurrentThreadId())
{
crit->RecursionCount++;
return TRUE;
}
/* FIXME: this doesn't work */
InterlockedDecrement( &crit->LockCount );
return FALSE;
crit->OwningThread = GetCurrentThreadId();
crit->RecursionCount = 1;
ret = TRUE;
}
crit->OwningThread = GetCurrentThreadId();
crit->RecursionCount = 1;
return TRUE;
else if (crit->OwningThread == GetCurrentThreadId())
{
InterlockedIncrement( &crit->LockCount );
crit->RecursionCount++;
ret = TRUE;
}
return ret;
}
......
......@@ -33,7 +33,6 @@
#include "task.h"
#include "queue.h"
#include "clipboard.h"
#include "xmalloc.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(clipboard)
......@@ -1042,13 +1041,21 @@ UINT16 WINAPI RegisterClipboardFormat16( LPCSTR FormatName )
/* allocate storage for new format entry */
lpNewFormat = (LPWINE_CLIPFORMAT)xmalloc(sizeof(WINE_CLIPFORMAT));
lpNewFormat = (LPWINE_CLIPFORMAT)HeapAlloc(GetProcessHeap(), 0, sizeof(WINE_CLIPFORMAT));
if(lpNewFormat == NULL) {
WARN("No more memory for a new format!");
return 0;
}
lpFormat->NextFormat = lpNewFormat;
lpNewFormat->wFormatID = LastRegFormat;
lpNewFormat->wRefCount = 1;
lpNewFormat->Name = (LPSTR)xmalloc(strlen(FormatName) + 1);
strcpy(lpNewFormat->Name, FormatName);
lpNewFormat->Name = (LPSTR)HEAP_strdupA(GetProcessHeap(), 0, FormatName);
if(lpNewFormat->Name == NULL) {
WARN("No more memory for the new format name!");
HeapFree(GetProcessHeap(), 0, lpNewFormat);
return 0;
}
lpNewFormat->wDataPresent = 0;
lpNewFormat->hData16 = 0;
......
......@@ -66,7 +66,7 @@ BOOL TTYDRV_CLIPBOARD_RegisterFormat( LPCSTR FormatName )
}
/**************************************************************************
* X11DRV_CLIPBOARD_IsSelectionowner
* TTYDRV_CLIPBOARD_IsSelectionowner
*
* Returns: TRUE - We(WINE) own the selection, FALSE - Selection not owned by us
*/
......
......@@ -77,7 +77,7 @@ void TTYDRV_KEYBOARD_Beep()
}
/***********************************************************************
* X11DRV_KEYBOARD_GetDIState
* TTYDRV_KEYBOARD_GetDIState
*/
BOOL TTYDRV_KEYBOARD_GetDIState(DWORD len, LPVOID ptr)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment