Ignore:
Timestamp:
Jan 2, 2002, 7:36:01 PM (24 years ago)
Author:
sandervl
Message:

better logging for some functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gdi32/text.cpp

    r7682 r7721  
    1 /* $Id: text.cpp,v 1.28 2001-12-26 11:33:10 sandervl Exp $ */
     1/* $Id: text.cpp,v 1.29 2002-01-02 18:36:01 sandervl Exp $ */
    22
    33/*
     
    1414#include <os2win.h>
    1515#include <stdlib.h>
     16#include <stdio.h>
    1617#include <misc.h>
    1718#include <string.h>
     
    281282BOOL WIN32API TextOutA(HDC hdc,int nXStart,int nYStart,LPCSTR lpszString,int cbString)
    282283{
    283   dprintf(("GDI32: TextOutA %x (%d,%d) %s", hdc, nXStart, nYStart, lpszString));
    284 
    285   return InternalTextOutA(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE);
     284   dprintf(("GDI32: TextOutA %x (%d,%d) %d %*s", hdc, nXStart, nYStart, cbString, cbString, lpszString));
     285   return InternalTextOutA(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE);
    286286}
    287287//******************************************************************************
     
    289289BOOL WIN32API TextOutW(HDC hdc,int nXStart,int nYStart,LPCWSTR lpszString,int cbString)
    290290{
    291   dprintf(("GDI32: TextOutW %x (%d,%d) %ls", hdc, nXStart, nYStart, lpszString));
    292 
    293   return InternalTextOutW(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE);
     291#ifdef DEBUG
     292   //runtime lib ignores width specifier and also prints string until terminator is found
     293   LPWSTR buggyrtl = (LPWSTR)malloc((cbString+1)*2);
     294   memcpy(buggyrtl, lpszString, cbString*2);
     295   buggyrtl[cbString] = 0;
     296   dprintf(("GDI32: TextOutW %x (%d,%d) %d %ls", hdc, nXStart, nYStart, cbString, buggyrtl));
     297   free(buggyrtl);
     298#endif
     299   return InternalTextOutW(hdc,nXStart,nYStart,0,NULL,lpszString,cbString,NULL,FALSE);
    294300}
    295301//******************************************************************************
     
    331337{
    332338#if 1
     339   dprintf(("GDI32: GetTextExtentPointA %x %*s %d", hdc, cbString, lpsz, cbString));
     340
     341   if(lpsz == NULL || cbString < 0 || lpsSize == NULL)
     342   {
     343      dprintf(("!WARNING!: GDI32: GetTextExtentPointA invalid parameter!"));
     344      SetLastError(ERROR_INVALID_PARAMETER);
     345      return FALSE;
     346   }
     347
     348   lpsSize->cx = 0;
     349   lpsSize->cy = 0;
     350
     351   // Verified with NT4, SP6
     352   if(cbString == 0)
     353   {
     354      dprintf(("GDI32: GetTextExtentPointW cbString == 0"));
     355      SetLastError(ERROR_SUCCESS);
     356      return TRUE;
     357   }
     358
    333359   //SvL: This works better than the code below. Can been seen clearly
    334360   //     in the Settings dialog box of VirtualPC. Strings are clipped.
    335361   //     (e.g.: Hard Disk 1 -> Hard Disk)
    336    dprintf(("GDI32: GetTextExtentPointA %s\n", lpsz));
    337362   BOOL rc = O32_GetTextExtentPoint(hdc, lpsz, cbString, lpsSize);
    338363   if(rc) {
    339       dprintf(("GDI32: GetTextExtentPointA %x %s %d returned %d (%d,%d)", hdc, lpsz, cbString, rc, lpsSize->cx, lpsSize->cy));
     364      dprintf(("GDI32: GetTextExtentPointA returned (%d,%d)", lpsSize->cx, lpsSize->cy));
    340365      SetLastError(ERROR_SUCCESS);
    341366      return TRUE;
     
    422447                                  PSIZE  lpSize)
    423448{
    424   char *astring = UnicodeToAsciiString((LPWSTR)lpString);
     449  char *astring;
    425450  BOOL  rc;
    426451
    427   dprintf(("GDI32: GetTextExtentPointW %s\n", astring));
    428   lpSize->cx = lpSize->cy = 0;
    429   rc = GetTextExtentPointA(hdc,
    430                            astring,
    431                            cbString,
    432                            lpSize);
    433   FreeAsciiString(astring);
    434   return(rc);
     452   if(lpString == NULL || cbString < 0 || lpSize == NULL)
     453   {
     454      dprintf(("!WARNING!: GDI32: GetTextExtentPointW invalid parameter!"));
     455      SetLastError(ERROR_INVALID_PARAMETER);
     456      return FALSE;
     457   }
     458
     459   lpSize->cx = 0;
     460   lpSize->cy = 0;
     461
     462   // Verified with NT4, SP6
     463   if(cbString == 0)
     464   {
     465      dprintf(("GDI32: GetTextExtentPointW cbString == 0"));
     466      SetLastError(ERROR_SUCCESS);
     467      return TRUE;
     468   }
     469
     470   dprintf(("GDI32: GetTextExtentPointW %x %x %d %x", hdc, lpString, cbString, lpSize));
     471
     472   astring = (char *)malloc((cbString+1)*sizeof(WCHAR));
     473   UnicodeToAsciiN(lpString, astring, cbString+1);
     474
     475   rc = GetTextExtentPointA(hdc, astring,
     476                            cbString, lpSize);
     477
     478   free(astring);
     479   return(rc);
    435480}
    436481//******************************************************************************
     
    438483BOOL WIN32API GetTextExtentPoint32A( HDC hdc, LPCSTR lpsz, int cbString, PSIZE  lpSize)
    439484{
    440  BOOL rc;
    441 
    442     dprintf(("GDI32: GetTextExtentPoint32A %s\n", lpsz));
    443     lpSize->cx = lpSize->cy = 0;
    444     rc = GetTextExtentPointA(hdc, lpsz, cbString, lpSize);
    445     return rc;
    446 }
    447 //******************************************************************************
    448 //******************************************************************************
    449 BOOL WIN32API GetTextExtentPoint32W(HDC arg1, LPCWSTR arg2, int arg3, PSIZE lpSize)
    450 {
    451  char *astring = UnicodeToAsciiString((LPWSTR)arg2);
    452  BOOL  rc;
    453 
    454     dprintf(("GDI32: GetTextExtentPoint32W %s\n", astring));
    455     rc = GetTextExtentPointA(arg1, astring, arg3, lpSize);
    456     FreeAsciiString(astring);
    457     return(rc);
    458 }
    459 //******************************************************************************
    460 //******************************************************************************
     485    return GetTextExtentPointA(hdc, lpsz, cbString, lpSize);
     486}
     487//******************************************************************************
     488//******************************************************************************
     489BOOL WIN32API GetTextExtentPoint32W(HDC hdc, LPCWSTR lpsz, int cbString, PSIZE lpSize)
     490{
     491    return GetTextExtentPointW(hdc, lpsz, cbString, lpSize);
     492}
     493//******************************************************************************
     494//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.