Fix CreateFontIndirectA so it will not bigcheck with a null pointer.

svn path=/trunk/; revision=24221
This commit is contained in:
James Tabor 2006-09-20 21:34:08 +00:00
parent 18733c4397
commit 6d8ba42532

View file

@ -61,7 +61,7 @@ static LPWSTR FONT_mbtowc(LPCSTR str, INT count, INT *plenW)
lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0); lenW = MultiByteToWideChar(cp, 0, str, count, NULL, 0);
strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR)); strW = HeapAlloc(GetProcessHeap(), 0, lenW*sizeof(WCHAR));
MultiByteToWideChar(cp, 0, str, count, strW, lenW); MultiByteToWideChar(cp, 0, str, count, strW, lenW);
DPRINT("mapped %s -> %s \n", str, strW); DPRINT1("mapped %s -> %s \n", str, strW);
if(plenW) *plenW = lenW; if(plenW) *plenW = lenW;
return strW; return strW;
} }
@ -383,7 +383,7 @@ GetCharWidthA (
LPINT lpBuffer LPINT lpBuffer
) )
{ {
DPRINT("GCWA iFirstChar %x\n",iFirstChar); DPRINT1("GCWA iFirstChar %x\n",iFirstChar);
return GetCharWidth32A ( hdc, iFirstChar, iLastChar, lpBuffer ); return GetCharWidth32A ( hdc, iFirstChar, iLastChar, lpBuffer );
} }
@ -405,7 +405,7 @@ GetCharWidth32A(
LPSTR str; LPSTR str;
LPWSTR wstr; LPWSTR wstr;
BOOL ret = TRUE; BOOL ret = TRUE;
DPRINT("GCW32A iFirstChar %x\n",iFirstChar); DPRINT1("GCW32A iFirstChar %x\n",iFirstChar);
if(count <= 0) return FALSE; if(count <= 0) return FALSE;
@ -445,7 +445,7 @@ GetCharWidthW (
LPINT lpBuffer LPINT lpBuffer
) )
{ {
DPRINT("GCW32w uFirstChar %x\n",iFirstChar); DPRINT1("GCW32w uFirstChar %x\n",iFirstChar);
/* FIXME should be NtGdiGetCharWidthW */ /* FIXME should be NtGdiGetCharWidthW */
return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer ); return NtGdiGetCharWidth32 ( hdc, iFirstChar, iLastChar, lpBuffer );
@ -563,7 +563,7 @@ GetCharABCWidthsA(
LPABC lpabc LPABC lpabc
) )
{ {
DPRINT("GCABCWA uFirstChar %x\n",uFirstChar); DPRINT1("GCABCWA uFirstChar %x\n",uFirstChar);
return NtGdiGetCharABCWidths(hdc, uFirstChar, uLastChar, lpabc); return NtGdiGetCharABCWidths(hdc, uFirstChar, uLastChar, lpabc);
} }
@ -581,7 +581,7 @@ GetCharABCWidthsFloatA(
LPABCFLOAT lpABCF LPABCFLOAT lpABCF
) )
{ {
DPRINT("GCABCWFA iFirstChar %x\n",iFirstChar); DPRINT1("GCABCWFA iFirstChar %x\n",iFirstChar);
/* FIXME what to do with iFirstChar and iLastChar ??? */ /* FIXME what to do with iFirstChar and iLastChar ??? */
return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF ); return NtGdiGetCharABCWidthsFloat ( hdc, iFirstChar, iLastChar, lpABCF );
@ -607,7 +607,7 @@ GetGlyphOutlineA(
LPWSTR p = NULL; LPWSTR p = NULL;
DWORD ret; DWORD ret;
UINT c; UINT c;
DPRINT("GetGlyphOutlineA uChar %x\n", uChar); DPRINT1("GetGlyphOutlineA uChar %x\n", uChar);
if(!(uFormat & GGO_GLYPH_INDEX)) { if(!(uFormat & GGO_GLYPH_INDEX)) {
int len; int len;
char mbchs[2]; char mbchs[2];
@ -644,7 +644,7 @@ GetGlyphOutlineW(
CONST MAT2 *lpmat2 CONST MAT2 *lpmat2
) )
{ {
DPRINT("GetGlyphOutlineW uChar %x\n", uChar); DPRINT1("GetGlyphOutlineW uChar %x\n", uChar);
return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE); return NtGdiGetGlyphOutline ( hdc, uChar, uFormat, lpgm, cbBuffer, lpvBuffer, (CONST LPMAT2)lpmat2, TRUE);
} }
@ -829,9 +829,12 @@ CreateFontIndirectA(
{ {
LOGFONTW tlf; LOGFONTW tlf;
LogFontA2W(&tlf, lplf); if (lplf)
{
return NtGdiCreateFontIndirect(&tlf); LogFontA2W(&tlf, lplf);
return NtGdiCreateFontIndirect(&tlf);
}
else return (HFONT) 0; //or call NtGdiCreateFontIndirect(NULL)?
} }