wineps: fix a few HeapReAlloc()s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Huw,
I didn't dig deep enough to see if glyphList/->glyph_sent
can't be NULL at that point, but it wasn't obvious to me
that they can't. You know this part a lot better than myself,
can you please check that I'm not adding extranous uglifying
bits to the code?

ChangeLog
    HeapReAlloc() does not allocate memory.

Index: dlls/wineps/glyphlist.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/glyphlist.c,v
retrieving revision 1.8
diff -u -r1.8 glyphlist.c
--- dlls/wineps/glyphlist.c	24 Jun 2002 23:40:01 -0000	1.8
+++ dlls/wineps/glyphlist.c	20 Nov 2003 06:38:24 -0000
@@ -98,7 +98,11 @@
     {
 	GLYPHNAME   **newGlyphList;
 
-	newGlyphList = (GLYPHNAME **) HeapReAlloc(PSDRV_Heap, 0, glyphList,
+	if (!glyphList)
+	    newGlyphList = (GLYPHNAME **) HeapAlloc(PSDRV_Heap, 0,
+		(glyphListSize + GLYPHLIST_ALLOCSIZE) * sizeof(GLYPHNAME *));
+	else
+	    newGlyphList = (GLYPHNAME **) HeapReAlloc(PSDRV_Heap, 0, glyphList,
 		(glyphListSize + GLYPHLIST_ALLOCSIZE) * sizeof(GLYPHNAME *));
 	if (newGlyphList == NULL)
 	{
Index: dlls/wineps/type1.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/type1.c,v
retrieving revision 1.7
diff -u -r1.7 type1.c
--- dlls/wineps/type1.c	12 Nov 2003 22:42:55 -0000	1.7
+++ dlls/wineps/type1.c	20 Nov 2003 06:44:30 -0000
@@ -211,9 +211,13 @@
 	    return TRUE;
     } else {
         t1->glyph_sent_size = (index / GLYPH_SENT_INC + 1) * GLYPH_SENT_INC;
-	t1->glyph_sent = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-				      t1->glyph_sent,
-				      t1->glyph_sent_size * sizeof(*(t1->glyph_sent)));
+	if (!t1->glyph_sent)
+	    t1->glyph_sent = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+				         t1->glyph_sent_size * sizeof(*(t1->glyph_sent)));
+	else
+	    t1->glyph_sent = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+				         t1->glyph_sent,
+				         t1->glyph_sent_size * sizeof(*(t1->glyph_sent)));
     }
 
     GetObjectW(GetCurrentObject(physDev->hdc, OBJ_FONT), sizeof(lf), &lf);
Index: dlls/wineps/type42.c
===================================================================
RCS file: /var/cvs/wine/dlls/wineps/type42.c,v
retrieving revision 1.8
diff -u -r1.8 type42.c
--- dlls/wineps/type42.c	12 Nov 2003 22:42:55 -0000	1.8
+++ dlls/wineps/type42.c	20 Nov 2003 06:46:28 -0000
@@ -303,9 +303,13 @@
 	    return TRUE;
     } else {
         t42->glyph_sent_size = (index / GLYPH_SENT_INC + 1) * GLYPH_SENT_INC;
-	t42->glyph_sent = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-				      t42->glyph_sent,
-				      t42->glyph_sent_size * sizeof(*(t42->glyph_sent)));
+	if (!t42->glyph_sent)
+	    t42->glyph_sent = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+				        t42->glyph_sent_size * sizeof(*(t42->glyph_sent)));
+	else
+	    t42->glyph_sent = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+				          t42->glyph_sent,
+				          t42->glyph_sent_size * sizeof(*(t42->glyph_sent)));
     }
 
     buf = HeapAlloc(GetProcessHeap(), 0, sizeof(glyph_def) +

-- 
Dimi.



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux