debugstr print fixes

Andreas Mohr a.mohr at mailto.de
Sun Jun 3 21:52:30 CDT 2001


Hi all,

limit output to max. 1000 chars for certain text functions
(fixes overflow when logging an IE3 install).

Andreas Mohr
-------------- next part --------------
Determining best CVS host...
Using CVSROOT :pserver:cvs at rhlx01.fht-esslingen.de:/home/wine
Index: graphics/x11drv/text.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/text.c,v
retrieving revision 1.26
diff -u -r1.26 text.c
--- graphics/x11drv/text.c	2001/05/11 00:17:47	1.26
+++ graphics/x11drv/text.c	2001/06/04 00:50:22
@@ -60,7 +60,7 @@
 
     TRACE("hdc=%04x df=%04x %d,%d %s, %d  flags=%d lpDx=%p\n",
 	  dc->hSelf, (UINT16)(physDev->font), x, y,
-	  debugstr_wn (wstr, count), count, flags, lpDx);
+	  debugstr_wn (wstr, (count < 1000) ? count : 1000), count, flags, lpDx);
 
     /* some strings sent here end in a newline for whatever reason.  I have no
        clue what the right treatment should be in general, but ignoring
@@ -401,7 +401,7 @@
     X11DRV_PDEVICE *physDev = (X11DRV_PDEVICE *)dc->physDev;
     fontObject* pfo = XFONT_GetFontObject( physDev->font );
 
-    TRACE("%s %d\n", debugstr_wn(str,count), count);
+    TRACE("%s %d\n", debugstr_wn(str, 1000), count);
     if( pfo ) {
 	XChar2b *p = X11DRV_cptable[pfo->fi->cptable].punicode_to_char2b( pfo, str, count );
 	if (!p) return FALSE;
Index: dlls/user/text.c
===================================================================
RCS file: /home/wine/wine/dlls/user/text.c,v
retrieving revision 1.9
diff -u -r1.9 text.c
--- dlls/user/text.c	2001/01/25 22:22:21	1.9
+++ dlls/user/text.c	2001/06/04 00:50:23
@@ -239,7 +239,7 @@
     int width = rect->right - rect->left;
     int max_width = 0;
 
-    TRACE("%s, %d , [(%d,%d),(%d,%d)]\n", debugstr_wn (str, count), count,
+    TRACE("%s, %d , [(%d,%d),(%d,%d)]\n", debugstr_wn(str, 1000), count,
 	  rect->left, rect->top, rect->right, rect->bottom);
 
     if(dtp) {
@@ -457,7 +457,7 @@
 INT WINAPI DrawTextExA( HDC hdc, LPCSTR str, INT count,
                      LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp )
 {
-    TRACE("(%d,'%s',%d,%p,0x%08x,%p)\n",hdc,str,count,rect,flags,dtp);
+    TRACE("(%d,%s,%d,%p,0x%08x,%p)\n",hdc,debugstr_an(str, 1000),count,rect,flags,dtp);
     if(dtp) {
         FIXME("Ignores params:%d,%d,%d,%d\n",dtp->cbSize,
                    dtp->iTabLength,dtp->iLeftMargin,dtp->iRightMargin);
@@ -690,7 +690,7 @@
                              INT16 count, INT16 cTabStops,
                              const INT16 *lpTabPos, INT16 nTabOrg )
 {
-    TRACE("%04x %d,%d '%.*s' %d\n", hdc, x, y, count, lpstr, count );
+    TRACE("%04x %d,%d %s %d\n", hdc, x, y, debugstr_an(lpstr, 1000), count );
     return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
                                lpTabPos, NULL, nTabOrg, TRUE );
 }
@@ -702,7 +702,7 @@
 LONG WINAPI TabbedTextOutA( HDC hdc, INT x, INT y, LPCSTR lpstr, INT count,
                             INT cTabStops, const INT *lpTabPos, INT nTabOrg )
 {
-    TRACE("%04x %d,%d '%.*s' %d\n", hdc, x, y, count, lpstr, count );
+    TRACE("%04x %d,%d %s %d\n", hdc, x, y, debugstr_an(lpstr, 1000), count );
     return TEXT_TabbedTextOut( hdc, x, y, lpstr, count, cTabStops,
                                NULL, lpTabPos, nTabOrg, TRUE );
 }
@@ -735,7 +735,7 @@
 DWORD WINAPI GetTabbedTextExtent16( HDC16 hdc, LPCSTR lpstr, INT16 count,
                                     INT16 cTabStops, const INT16 *lpTabPos )
 {
-    TRACE("%04x '%.*s' %d\n", hdc, count, lpstr, count );
+    TRACE("%04x %s %d\n", hdc, debugstr_an(lpstr, 1000), count );
     return TEXT_TabbedTextOut( hdc, 0, 0, lpstr, count, cTabStops,
                                lpTabPos, NULL, 0, FALSE );
 }


More information about the wine-patches mailing list