Commit 4d48dd30 authored by Dimitrie O. Paun's avatar Dimitrie O. Paun Committed by Alexandre Julliard

Removed HEAP_xalloc.

parent 04c16b82
......@@ -97,7 +97,9 @@ WIN16DRV_Polygon(DC *dc, const POINT* pt, INT count )
if(pt[0].x != pt[count-1].x || pt[0].y != pt[count-1].y)
count++; /* Ensure polygon is closed */
points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
if(points == NULL) return FALSE;
for (i = 0; i < count - 1; i++)
{
points[i].x = XLPTODP( dc, pt[i].x );
......@@ -128,7 +130,9 @@ WIN16DRV_Polyline(DC *dc, const POINT* pt, INT count )
if(count < 2) return TRUE;
points = HEAP_xalloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
points = HeapAlloc( GetProcessHeap(), 0, count * sizeof(POINT16) );
if(points == NULL) return FALSE;
for (i = 0; i < count; i++)
{
points[i].x = XLPTODP( dc, pt[i].x );
......
......@@ -383,8 +383,9 @@ static BOOL OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
XpmAttributes *attrs;
int err;
attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
XpmAttributesSize() );
attrs = (XpmAttributes *)HeapAlloc( GetProcessHeap(), 0,
XpmAttributesSize() );
if(attrs == NULL) return FALSE;
attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
attrs->colormap = X11DRV_PALETTE_PaletteXColormap;
attrs->depth = descr->color ? X11DRV_GetDepth() : 1;
......
......@@ -35,14 +35,15 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
{
int i;
fontObject* pfo;
INT width, ascent, descent, xwidth, ywidth;
INT width, ascent, descent, xwidth, ywidth;
XFontStruct* font;
RECT rect;
char dfBreakChar, lfUnderline, lfStrikeOut;
BOOL rotated = FALSE;
X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
XChar2b *str2b;
XChar2b *str2b = NULL;
BOOL dibUpdateFlag = FALSE;
BOOL result = TRUE;
if (!X11DRV_SetupGCForText( dc )) return TRUE;
......@@ -224,6 +225,7 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
/* Draw the text (count > 0 verified) */
str2b = HeapAlloc( GetProcessHeap(), 0, count * sizeof(XChar2b) );
if( str2b == NULL) goto FAIL;
for(i = 0; i < count; i++) {
str2b[i].byte1 = wstr[i] >> 8;
str2b[i].byte2 = wstr[i] & 0xff;
......@@ -244,8 +246,9 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
/* allocate max items */
pitem = items = HEAP_xalloc( GetProcessHeap(), 0,
count * sizeof(XTextItem16) );
pitem = items = HeapAlloc( GetProcessHeap(), 0,
count * sizeof(XTextItem16) );
if(items == NULL) goto FAIL;
delta = i = 0;
if( lpDx ) /* explicit character widths */
{
......@@ -366,8 +369,14 @@ X11DRV_ExtTextOut( DC *dc, INT x, INT y, UINT flags,
if (flags & ETO_CLIPPED)
RestoreVisRgn16( dc->hSelf );
goto END;
FAIL:
if(str2b != NULL) HeapFree( GetProcessHeap(), 0, str2b );
result = FALSE;
END:
if (dibUpdateFlag) X11DRV_DIB_UpdateDIBSection( dc, TRUE );
return TRUE;
return result;
}
......@@ -16,7 +16,6 @@ extern HANDLE SegptrHeap;
extern int HEAP_IsInsideHeap( HANDLE heap, DWORD flags, LPCVOID ptr );
extern SEGPTR HEAP_GetSegptr( HANDLE heap, DWORD flags, LPCVOID ptr );
extern LPVOID HEAP_xalloc( HANDLE heap, DWORD flags, DWORD size );
extern LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str );
extern LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str );
extern LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str );
......
......@@ -1634,31 +1634,15 @@ DWORD WINAPI GetProcessHeaps( DWORD count, HANDLE *heaps )
/***********************************************************************
* HEAP_xalloc
*
* Same as HeapAlloc(), but die on failure.
*/
LPVOID HEAP_xalloc( HANDLE heap, DWORD flags, DWORD size )
{
LPVOID p = HeapAlloc( heap, flags, size );
if (!p)
{
MESSAGE("Virtual memory exhausted.\n" );
exit(1);
}
SET_EIP(p);
return p;
}
/***********************************************************************
* HEAP_strdupA
*/
LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
{
LPSTR p = HEAP_xalloc( heap, flags, strlen(str) + 1 );
SET_EIP(p);
strcpy( p, str );
LPSTR p = HeapAlloc( heap, flags, strlen(str) + 1 );
if(p) {
SET_EIP(p);
strcpy( p, str );
}
return p;
}
......@@ -1669,9 +1653,11 @@ LPSTR HEAP_strdupA( HANDLE heap, DWORD flags, LPCSTR str )
LPWSTR HEAP_strdupW( HANDLE heap, DWORD flags, LPCWSTR str )
{
INT len = lstrlenW(str) + 1;
LPWSTR p = HEAP_xalloc( heap, flags, len * sizeof(WCHAR) );
SET_EIP(p);
lstrcpyW( p, str );
LPWSTR p = HeapAlloc( heap, flags, len * sizeof(WCHAR) );
if(p) {
SET_EIP(p);
lstrcpyW( p, str );
}
return p;
}
......@@ -1684,9 +1670,11 @@ LPWSTR HEAP_strdupAtoW( HANDLE heap, DWORD flags, LPCSTR str )
LPWSTR ret;
if (!str) return NULL;
ret = HEAP_xalloc( heap, flags, (strlen(str)+1) * sizeof(WCHAR) );
SET_EIP(ret);
lstrcpyAtoW( ret, str );
ret = HeapAlloc( heap, flags, (strlen(str)+1) * sizeof(WCHAR) );
if (ret) {
SET_EIP(ret);
lstrcpyAtoW( ret, str );
}
return ret;
}
......@@ -1699,9 +1687,11 @@ LPSTR HEAP_strdupWtoA( HANDLE heap, DWORD flags, LPCWSTR str )
LPSTR ret;
if (!str) return NULL;
ret = HEAP_xalloc( heap, flags, lstrlenW(str) + 1 );
SET_EIP(ret);
lstrcpyWtoA( ret, str );
ret = HeapAlloc( heap, flags, lstrlenW(str) + 1 );
if(ret) {
SET_EIP(ret);
lstrcpyWtoA( ret, str );
}
return ret;
}
......
......@@ -371,15 +371,15 @@ BOOL16 WINAPI ExtTextOut16( HDC16 hdc, INT16 x, INT16 y, UINT16 flags,
RECT rect32;
LPINT lpdx32 = NULL;
if (lpDx) lpdx32 = (LPINT)HEAP_xalloc( GetProcessHeap(), 0,
sizeof(INT)*count );
if (lpDx) {
lpdx32 = (LPINT)HeapAlloc( GetProcessHeap(),0, sizeof(INT)*count );
if(lpdx32 == NULL) return FALSE;
for (i=count;i--;) lpdx32[i]=lpDx[i];
}
if (lprect) CONV_RECT16TO32(lprect,&rect32);
if (lpdx32) for (i=count;i--;) lpdx32[i]=lpDx[i];
ret = ExtTextOutA(hdc,x,y,flags,lprect?&rect32:NULL,str,count,lpdx32);
if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 );
return ret;
}
......@@ -715,7 +715,8 @@ LONG WINAPI TabbedTextOutW( HDC hdc, INT x, INT y, LPCWSTR str,
UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
acount = WideCharToMultiByte(codepage,0,str,count,NULL,0,NULL,NULL);
p = HEAP_xalloc( GetProcessHeap(), 0, acount );
p = HeapAlloc( GetProcessHeap(), 0, acount );
if(p == NULL) return 0; /* FIXME: is this the correct return on failure */
acount = WideCharToMultiByte(codepage,0,str,count,p,acount,NULL,NULL);
ret = TabbedTextOutA( hdc, x, y, p, acount, cTabStops,
lpTabPos, nTabOrg );
......@@ -762,7 +763,8 @@ DWORD WINAPI GetTabbedTextExtentW( HDC hdc, LPCWSTR lpstr, INT count,
UINT codepage = CP_ACP; /* FIXME: get codepage of font charset */
acount = WideCharToMultiByte(codepage,0,lpstr,count,NULL,0,NULL,NULL);
p = HEAP_xalloc( GetProcessHeap(), 0, acount );
p = HeapAlloc( GetProcessHeap(), 0, acount );
if(p == NULL) return 0; /* FIXME: is this the correct failure value? */
acount = WideCharToMultiByte(codepage,0,lpstr,count,p,acount,NULL,NULL);
ret = GetTabbedTextExtentA( hdc, p, acount, cTabStops, lpTabPos );
HeapFree( GetProcessHeap(), 0, p );
......
......@@ -1126,8 +1126,11 @@ INT WINAPI GetClipboardFormatNameA( UINT wFormat, LPSTR retStr, INT maxlen )
*/
INT WINAPI GetClipboardFormatNameW( UINT wFormat, LPWSTR retStr, INT maxlen )
{
LPSTR p = HEAP_xalloc( GetProcessHeap(), 0, maxlen );
INT ret = GetClipboardFormatNameA( wFormat, p, maxlen );
INT ret;
LPSTR p = HeapAlloc( GetProcessHeap(), 0, maxlen );
if(p == NULL) return 0; /* FIXME: is this the correct failure value? */
ret = GetClipboardFormatNameA( wFormat, p, maxlen );
lstrcpynAtoW( retStr, p, maxlen );
HeapFree( GetProcessHeap(), 0, p );
return ret;
......
......@@ -940,10 +940,9 @@ INT WINAPI GetKeyboardLayoutNameA(LPSTR pwszKLID)
*/
INT WINAPI GetKeyboardLayoutNameW(LPWSTR pwszKLID)
{
LPSTR buf = HEAP_xalloc( GetProcessHeap(), 0, strlen("00000409")+1);
char buf[9];
int res = GetKeyboardLayoutNameA(buf);
lstrcpyAtoW(pwszKLID,buf);
HeapFree( GetProcessHeap(), 0, buf );
return res;
}
......@@ -960,8 +959,10 @@ INT WINAPI GetKeyNameTextA(LONG lParam, LPSTR lpBuffer, INT nSize)
*/
INT WINAPI GetKeyNameTextW(LONG lParam, LPWSTR lpBuffer, INT nSize)
{
LPSTR buf = HEAP_xalloc( GetProcessHeap(), 0, nSize );
int res = GetKeyNameTextA(lParam,buf,nSize);
int res;
LPSTR buf = HeapAlloc( GetProcessHeap(), 0, nSize );
if(buf == NULL) return 0; /* FIXME: is this the correct failure value?*/
res = GetKeyNameTextA(lParam,buf,nSize);
lstrcpynAtoW(lpBuffer,buf,nSize);
HeapFree( GetProcessHeap(), 0, buf );
......@@ -1069,11 +1070,9 @@ HKL WINAPI LoadKeyboardLayoutA(LPCSTR pwszKLID, UINT Flags)
*/
HKL WINAPI LoadKeyboardLayoutW(LPCWSTR pwszKLID, UINT Flags)
{
LPSTR buf = HEAP_xalloc( GetProcessHeap(), 0, strlen("00000409")+1);
int res;
char buf[9];
lstrcpynWtoA(buf,pwszKLID,8);
buf[8] = 0;
res = LoadKeyboardLayoutA(buf, Flags);
HeapFree( GetProcessHeap(), 0, buf );
return res;
return LoadKeyboardLayoutA(buf, Flags);
}
......@@ -620,7 +620,7 @@ INT WINPROC_MapMsg32ATo32W( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
/* Multiline edit */
case EM_GETLINE:
{ WORD len = (WORD)*plparam;
LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
LPARAM *ptr = (LPARAM *) HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(WCHAR) );
if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */
*((WORD *) ptr) = len; /* Store the length */
......@@ -844,7 +844,7 @@ INT WINPROC_MapMsg32WTo32A( HWND hwnd, UINT msg, WPARAM wParam, LPARAM *plparam
/* Multiline edit */
case EM_GETLINE:
{ WORD len = (WORD)*plparam;
LPARAM *ptr = (LPARAM *) HEAP_xalloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
LPARAM *ptr = (LPARAM *) HeapAlloc( GetProcessHeap(), 0, sizeof(LPARAM) + sizeof (WORD) + len*sizeof(CHAR) );
if (!ptr) return -1;
*ptr++ = *plparam; /* Store previous lParam */
*((WORD *) ptr) = len; /* Store the length */
......
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