[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-patches
Subject: Re: Saving the xterms (3)
From: Francois Gouget <fgouget () psn ! net>
Date: 1999-12-21 6:36:56
[Download RAW message or body]
> Please ignore the previous patch and apply this one instead.
Again. This time I changed the following:
- by popular demand the printing of Unicode string now prints
unprintable characters in hexadecimal. So Ascii stuff is still in octal
(but I could change that too, I've put it in a separate patch file just
in case) which gives us 3 which should be relatively easy to
distinguish from Unicode which is always 4 digits.
- I removed the diffs for the ntdll directory to avoid interfering with
Juergen Schmied's work
As said above there are two patch files:
diff19991220-debugstr.txt Just the debugstr stuff
diff19991220-string.txt Everything else but the ntdll stuff
So the Changelog would now look something like:
* misc/debugstr.c
debugstr_w now returns something looking like 'L"xxxx"...' to let you
know it's Unicode and so that you know that '...' is not part of the
string
A Unicode character being 16bits we might have to output up to 6
octal numbers, not just 3
* relay32/snoop.c
The "strcat" in the Unicode case could well have caused an overflow
since each Unicode character generates up to 7 Ascii characters
* memory/string.c
Added wrappers around all string printing to avoid accidentally
corrupting the xterm
Made the displayed messages more consistent
Added a trace to lstrcpynWtoA since lstrcpynAtoW does
so but CRTDLL_wcstombs does not seem to
Removed redundant 'L's for Unicode strings
* dlls/comctl32/tooltips.c,
dlls/shell32/pidl.c,
dlls/shell32/shellpath.c,
dlls/shell32/shlfolder.c,
dlls/shell32/shellord.c,
relay32/relay386.c
Wrapped some strings in a debugstr_* call
Replaced some calls to debugstr_{a,w} by debugstr_{a,w}n
Removed redundant 'L's for Unicode strings
Tried to harmonize the traces a little bit
Some "%s" were given NULL pointers, replaced these by ""
--
Francois Gouget fgouget@multimania.com http://www.multimania.com/fgouget
f u kn rd ts, ur wy 2 gky 4 ur wn gd.
["diff19991220-debugstr.txt" (TEXT/plain)]
Index: misc/debugstr.c
===================================================================
RCS file: /home/wine/wine/misc/debugstr.c,v
retrieving revision 1.3
diff -u -r1.3 debugstr.c
--- misc/debugstr.c 1999/11/12 01:38:12 1.3
+++ misc/debugstr.c 1999/12/21 05:42:16
@@ -35,7 +35,7 @@
if (!src) return "(null)";
if (n < 0) n = 0;
- dst = res = gimme1 (n * 4 + 10);
+ dst = res = gimme1 (n * 4 + 6);
*dst++ = '"';
while (n-- > 0 && *src)
{
@@ -59,14 +59,14 @@
}
}
}
+ *dst++ = '"';
if (*src)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
- *dst++ = '"';
- *dst = 0;
+ *dst = '\0';
return res;
}
@@ -87,7 +87,8 @@
if (!src) return "(null)";
if (n < 0) n = 0;
- dst = res = gimme1 (n * 4 + 10);
+ dst = res = gimme1 (n * 5 + 7);
+ *dst++ = 'L';
*dst++ = '"';
while (n-- > 0 && *src)
{
@@ -102,23 +103,22 @@
default:
if (c >= ' ' && c <= 126)
*dst++ = c;
- else
+ else
{
*dst++ = '\\';
- *dst++ = '0' + ((c >> 6) & 7);
- *dst++ = '0' + ((c >> 3) & 7);
- *dst++ = '0' + ((c >> 0) & 7);
+ sprintf(dst,"%04x",c);
+ dst+=4;
}
}
}
+ *dst++ = '"';
if (*src)
{
*dst++ = '.';
*dst++ = '.';
*dst++ = '.';
}
- *dst++ = '"';
- *dst = 0;
+ *dst = '\0';
return res;
}
["diff19991220-string.txt" (TEXT/plain)]
Index: relay32/snoop.c
===================================================================
RCS file: /home/wine/wine/relay32/snoop.c,v
retrieving revision 1.16
diff -u -r1.16 snoop.c
--- relay32/snoop.c 1999/11/14 21:28:57 1.16
+++ relay32/snoop.c 1999/12/20 01:40:31
@@ -209,11 +209,10 @@
sprintf(buf,"%08lx",x);
return buf;
}
- i=0;nostring=0;
if (!IsBadStringPtrA((LPSTR)x,80)) {
+ LPBYTE s=(LPBYTE)x;
+ i=0;nostring=0;
while (i<80) {
- LPBYTE s=(LPBYTE)x;
-
if (s[i]==0) break;
if (s[i]<0x20) {nostring=1;break;}
if (s[i]>=0x80) {nostring=1;break;}
@@ -221,18 +220,15 @@
}
if (!nostring) {
if (i>5) {
- sprintf(buf,"%08lx \"",x);
- strncat(buf,(LPSTR)x,198-strlen(buf)-2);
- strcat(buf,"\"");
+ wsnprintfA(buf,sizeof(buf),"%08lx %s",x,debugstr_an((LPSTR)x,sizeof(buf)-10));
return buf;
}
}
}
- i=0;nostring=0;
if (!IsBadStringPtrW((LPWSTR)x,80)) {
+ LPWSTR s=(LPWSTR)x;
+ i=0;nostring=0;
while (i<80) {
- LPWSTR s=(LPWSTR)x;
-
if (s[i]==0) break;
if (s[i]<0x20) {nostring=1;break;}
if (s[i]>0x100) {nostring=1;break;}
@@ -240,8 +236,7 @@
}
if (!nostring) {
if (i>5) {
- sprintf(buf,"%08lx L",x);
- strcat(buf,debugstr_wn((LPWSTR)x,198-strlen(buf)-2));
+ wsnprintfA(buf,sizeof(buf),"%08lx %s",x,debugstr_wn((LPWSTR)x,sizeof(buf)-10));
return buf;
}
}
Index: memory/string.c
===================================================================
RCS file: /home/wine/wine/memory/string.c,v
retrieving revision 1.20
diff -u -r1.20 string.c
--- memory/string.c 1999/11/04 01:54:26 1.20
+++ memory/string.c 1999/12/20 01:40:28
@@ -171,7 +171,7 @@
*/
INT WINAPI lstrcmpW( LPCWSTR str1, LPCWSTR str2 )
{
- TRACE("L%s and L%s\n",
+ TRACE("%s and %s\n",
debugstr_w (str1), debugstr_w (str2));
if (!str1 || !str2) {
SetLastError(ERROR_INVALID_PARAMETER);
@@ -210,7 +210,7 @@
#if 0
/* Too much! (From registry loading.) */
- TRACE("strcmpi L%s and L%s\n",
+ TRACE("strcmpi %s and %s\n",
debugstr_w (str1), debugstr_w (str2));
#endif
if (!str1 || !str2) {
@@ -299,8 +299,7 @@
LPSTR WINAPI lstrcpynA( LPSTR dst, LPCSTR src, INT n )
{
LPSTR p = dst;
- TRACE("strcpyn %s for %d chars\n",
- debugstr_an (src,n), n);
+ TRACE("(%p, %s, %i)\n", dst, debugstr_an(src,n), n);
/* In real windows the whole function is protected by an exception handler
* that returns ERROR_INVALID_PARAMETER on faulty parameters
* We currently just check for NULL.
@@ -323,8 +322,7 @@
LPWSTR WINAPI lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
{
LPWSTR p = dst;
- TRACE("strcpyn L%s for %d chars\n",
- debugstr_wn (src,n), n);
+ TRACE("(%p, %s, %i)\n", dst, debugstr_wn(src,n), n);
/* In real windows the whole function is protected by an exception handler
* that returns ERROR_INVALID_PARAMETER on faulty parameters
* We currently just check for NULL.
@@ -395,7 +393,7 @@
{
register LPWSTR p = dst;
- TRACE("%s\n",src);
+ TRACE("(%p, %s)\n", dst, debugstr_a(src));
while ((*p++ = (WCHAR)(unsigned char)*src++));
return dst;
@@ -409,7 +407,7 @@
{
register LPSTR p = dst;
- TRACE("L%s\n",debugstr_w(src));
+ TRACE("(%p, %s)\n", dst, debugstr_w(src));
while ((*p++ = (CHAR)*src++));
return dst;
@@ -425,7 +423,7 @@
{
LPWSTR p = dst;
- TRACE("%s %i\n",src, n);
+ TRACE("(%p, %s, %i)\n", dst, debugstr_an(src,n), n);
while ((n-- > 1) && *src) *p++ = (WCHAR)(unsigned char)*src++;
if (n >= 0) *p = 0;
@@ -446,6 +444,7 @@
{
if (--n >= 0)
{
+ TRACE("(%p, %s, %i)\n", dst, debugstr_wn(src,n), n);
n = CRTDLL_wcstombs( dst, src, n );
if(n<0)
n=0;
@@ -583,7 +582,7 @@
{
LPSTR oldd = d;
if (!s || !d) return TRUE;
- TRACE("CharToOem L%s\n", debugstr_w (s));
+ TRACE("CharToOem %s\n", debugstr_w (s));
while ((*d++ = ANSI_TO_OEM(*s++)));
TRACE(" to %s\n", debugstr_a (oldd));
return TRUE;
@@ -647,7 +646,7 @@
LPCWSTR pWide,
INT dwChars)
{ *pLocal = 0;
- TRACE("(%p, %s, %i)\n", pLocal, debugstr_w(pWide),dwChars);
+ TRACE("(%p, %s, %i)\n", pLocal, debugstr_wn(pWide,dwChars), dwChars);
WideCharToMultiByte(CP_ACP,0,pWide,-1,pLocal,dwChars,NULL,NULL);
return strlen(pLocal);
}
@@ -663,7 +662,7 @@
LPCSTR pLocal,
INT dwChars)
{ *pWide = 0;
- TRACE("(%p, %s, %i)\n",pWide, pLocal, dwChars);
+ TRACE("(%p, %s, %i)\n", pWide, debugstr_an(pLocal,dwChars), dwChars);
MultiByteToWideChar(CP_ACP,0,pLocal,-1,pWide,dwChars);
return lstrlenW(pWide);
}
@@ -672,7 +671,7 @@
/***********************************************************************
* lstrrchr (Not a Windows API)
*
- * This is the implementation meant to be invoked form within
+ * This is the implementation meant to be invoked from within
* COMCTL32_StrRChrA and shell32(TODO)...
*
* Return a pointer to the last occurence of wMatch in lpStart
@@ -682,7 +681,7 @@
{
LPCSTR lpGotIt = NULL;
- TRACE("(%s, %s)\n", lpStart, lpEnd);
+ TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
if (!lpEnd) lpEnd = lpStart + strlen(lpStart);
@@ -714,7 +713,7 @@
{
LPCWSTR lpGotIt = NULL;
- TRACE("(%p, %p, %c)\n", lpStart, lpEnd, wMatch);
+ TRACE("(%p, %p, %x)\n", lpStart, lpEnd, wMatch);
if (!lpEnd) lpEnd = lpStart + lstrlenW(lpStart);
for(; lpStart < lpEnd; lpStart = CharNextW(lpStart))
Index: dlls/comctl32/tooltips.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/tooltips.c,v
retrieving revision 1.24
diff -u -r1.24 tooltips.c
--- dlls/comctl32/tooltips.c 1999/10/23 19:59:55 1.24
+++ dlls/comctl32/tooltips.c 1999/12/20 01:40:08
@@ -152,7 +152,7 @@
infoPtr->szTipText[0] = L'\0';
}
- TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
+ TRACE("%s\n", debugstr_w(infoPtr->szTipText));
}
@@ -170,7 +170,7 @@
}
if (GetWindowLongA (hwnd, GWL_STYLE) & TTS_NOPREFIX)
uFlags |= DT_NOPREFIX;
- TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
+ TRACE("%s\n", debugstr_w(infoPtr->szTipText));
hdc = GetDC (hwnd);
hOldFont = SelectObject (hdc, infoPtr->hFont);
@@ -219,7 +219,7 @@
SendMessageA (toolPtr->hwnd, WM_NOTIFY,
(WPARAM)toolPtr->uId, (LPARAM)&hdr);
- TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
+ TRACE("%s\n", debugstr_w(infoPtr->szTipText));
TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
TRACE("size %d - %d\n", size.cx, size.cy);
@@ -340,7 +340,7 @@
SendMessageA (toolPtr->hwnd, WM_NOTIFY,
(WPARAM)toolPtr->uId, (LPARAM)&hdr);
- TRACE("\"%s\"\n", debugstr_w(infoPtr->szTipText));
+ TRACE("%s\n", debugstr_w(infoPtr->szTipText));
TOOLTIPS_CalcTipSize (hwnd, infoPtr, &size);
TRACE("size %d - %d\n", size.cx, size.cy);
@@ -728,7 +728,7 @@
}
else {
INT len = lstrlenW (lpToolInfo->lpszText);
- TRACE("add text \"%s\"!\n",
+ TRACE("add text %s!\n",
debugstr_w(lpToolInfo->lpszText));
toolPtr->lpszText = COMCTL32_Alloc ((len + 1)*sizeof(WCHAR));
lstrcpyW (toolPtr->lpszText, lpToolInfo->lpszText);
Index: dlls/shell32/pidl.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/pidl.c,v
retrieving revision 1.40
diff -u -r1.40 pidl.c
--- dlls/shell32/pidl.c 1999/12/08 03:56:26 1.40
+++ dlls/shell32/pidl.c 1999/12/20 01:40:12
@@ -761,7 +761,7 @@
LPITEMIDLIST WINAPI SHSimpleIDListFromPathW (LPWSTR lpszPath)
{
char lpszTemp[MAX_PATH];
- TRACE("path=L%s\n",debugstr_w(lpszPath));
+ TRACE("path=%s\n",debugstr_w(lpszPath));
WideCharToLocal(lpszTemp, lpszPath, MAX_PATH);
Index: dlls/shell32/shellord.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellord.c,v
retrieving revision 1.51
diff -u -r1.51 shellord.c
--- dlls/shell32/shellord.c 1999/11/23 22:31:18 1.51
+++ dlls/shell32/shellord.c 1999/12/20 01:40:15
@@ -203,13 +203,13 @@
*/
BOOL WINAPI OleStrToStrNA (LPSTR lpStr, INT nStr, LPCWSTR lpOle, INT nOle)
{
- TRACE("%p %x %s %x\n", lpStr, nStr, debugstr_w(lpOle), nOle);
+ TRACE("(%p, %x, %s, %x)\n", lpStr, nStr, debugstr_wn(lpOle,nOle), nOle);
return WideCharToMultiByte (0, 0, lpOle, nOle, lpStr, nStr, NULL, NULL);
}
BOOL WINAPI OleStrToStrNW (LPWSTR lpwStr, INT nwStr, LPCWSTR lpOle, INT nOle)
{
- TRACE("%p %x %s %x\n", lpwStr, nwStr, debugstr_w(lpOle), nOle);
+ TRACE("(%p, %x, %s, %x)\n", lpwStr, nwStr, debugstr_wn(lpOle,nOle), nOle);
if (lstrcpynW ( lpwStr, lpOle, nwStr))
{ return lstrlenW (lpwStr);
@@ -231,12 +231,12 @@
*/
BOOL WINAPI StrToOleStrNA (LPWSTR lpWide, INT nWide, LPCSTR lpStrA, INT nStr)
{
- TRACE("%p %x %s %x\n", lpWide, nWide, lpStrA, nStr);
+ TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_an(lpStrA,nStr), nStr);
return MultiByteToWideChar (0, 0, lpStrA, nStr, lpWide, nWide);
}
BOOL WINAPI StrToOleStrNW (LPWSTR lpWide, INT nWide, LPCWSTR lpStrW, INT nStr)
{
- TRACE("%p %x %s %x\n", lpWide, nWide, debugstr_w(lpStrW), nStr);
+ TRACE("(%p, %x, %s, %x)\n", lpWide, nWide, debugstr_wn(lpStrW, nStr), nStr);
if (lstrcpynW (lpWide, lpStrW, nWide))
{ return lstrlenW (lpWide);
@@ -1364,15 +1364,15 @@
*/
int WINAPI StrToOleStrA (LPWSTR lpWideCharStr, LPCSTR lpMultiByteString)
{
- TRACE("%p %p(%s)\n",
- lpWideCharStr, lpMultiByteString, lpMultiByteString);
+ TRACE("(%p, %p %s)\n",
+ lpWideCharStr, lpMultiByteString, debugstr_a(lpMultiByteString));
return MultiByteToWideChar(0, 0, lpMultiByteString, -1, lpWideCharStr, MAX_PATH);
}
int WINAPI StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
{
- TRACE("%p %p(%s)\n",
+ TRACE("(%p, %p %s)\n",
lpWideCharStr, lpWString, debugstr_w(lpWString));
if (lstrcpyW (lpWideCharStr, lpWString ))
@@ -1404,13 +1404,13 @@
*/
HRESULT WINAPI DoEnvironmentSubstA(LPSTR x, LPSTR y)
{
- FIXME("%p(%s) %p(%s) stub\n", x, x, y, y);
+ FIXME("(%p %s, %p %s) stub\n", x, debugstr_a(x), y, debugstr_a(y));
return 0;
}
HRESULT WINAPI DoEnvironmentSubstW(LPWSTR x, LPWSTR y)
{
- FIXME("%p(%s) %p(%s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
+ FIXME("(%p %s, %p %s) stub\n", x, debugstr_w(x), y, debugstr_w(y));
return 0;
}
Index: dlls/shell32/shellpath.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellpath.c,v
retrieving revision 1.20
diff -u -r1.20 shellpath.c
--- dlls/shell32/shellpath.c 1999/11/23 22:31:18 1.20
+++ dlls/shell32/shellpath.c 1999/12/20 01:40:17
@@ -93,7 +93,7 @@
}
LPCWSTR WINAPI PathFindExtensionW(LPCWSTR path)
{ LPCWSTR lastpoint = NULL;
- TRACE("%p L%s\n",path,debugstr_w(path));
+ TRACE("(%p %s)\n",path,debugstr_w(path));
while (*path)
{ if (*path==(WCHAR)'\\'||*path==(WCHAR)' ')
lastpoint=NULL;
@@ -213,7 +213,7 @@
{ LPCWSTR wslash;
wslash = wptr;
- TRACE("L%s\n",debugstr_w(wslash));
+ TRACE("%s\n",debugstr_w(wslash));
while (wptr[0])
{ if (((wptr[0]=='\\') || (wptr[0]==':')) && wptr[1] && wptr[1]!='\\')
wslash = wptr+1;
@@ -582,7 +582,7 @@
LPCWSTR WINAPI PathGetArgsW(LPCWSTR cmdline)
{ BOOL qflag = FALSE;
- TRACE("%sL\n",debugstr_w(cmdline));
+ TRACE("%s\n",debugstr_w(cmdline));
while (*cmdline)
{ if ((*cmdline==' ') && !qflag)
@@ -610,7 +610,7 @@
}
LPWSTR WINAPI PathQuoteSpacesW(LPCWSTR wptr)
-{ FIXME("L%s\n",debugstr_w(wptr));
+{ FIXME("%s\n",debugstr_w(wptr));
return 0;
}
LPVOID WINAPI PathQuoteSpacesAW (LPCVOID fn)
@@ -719,7 +719,7 @@
return *path?(path+1):path;
}
LPCWSTR WINAPI PathGetExtensionW(LPCWSTR path,DWORD y,DWORD z)
-{ TRACE("(L%s,%08lx,%08lx)\n",debugstr_w(path),y,z);
+{ TRACE("(%s, %08lx, %08lx)\n",debugstr_w(path),y,z);
path = PathFindExtensionW(path);
return *path?(path+1):path;
}
@@ -735,13 +735,13 @@
*/
DWORD WINAPI PathCleanupSpecA(LPSTR x, LPSTR y)
{
- FIXME("%p(%s) %p(%s) stub\n",x,x,y,y);
+ FIXME("(%p %s, %p %s) stub\n",x,debugstr_a(x),y,debugstr_a(y));
return TRUE;
}
DWORD WINAPI PathCleanupSpecW(LPWSTR x, LPWSTR y)
{
- FIXME("%p(%s) %p(%s) stub\n",x,debugstr_w(x),y,debugstr_w(y));
+ FIXME("(%p %s, %p %s) stub\n",x,debugstr_w(x),y,debugstr_w(y));
return TRUE;
}
@@ -783,7 +783,7 @@
HRESULT WINAPI PathProcessCommandW (LPWSTR lpCommand, LPSTR v, DWORD w, DWORD x)
{
- FIXME("%p(%s) %p 0x%04lx 0x%04lx stub\n",
+ FIXME("(%p %s, %p, 0x%04lx, 0x%04lx) stub\n",
lpCommand, debugstr_w(lpCommand), v, w,x );
return 0;
}
Index: dlls/shell32/shlfolder.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlfolder.c,v
retrieving revision 1.38
diff -u -r1.38 shlfolder.c
--- dlls/shell32/shlfolder.c 1999/11/23 22:31:18 1.38
+++ dlls/shell32/shlfolder.c 1999/12/20 01:40:26
@@ -100,7 +100,7 @@
LPITEMIDLIST pidlOut, pidlTemp = NULL;
IShellFolder *psfChild;
- TRACE("(%p %p %s)\n",psf, pidlInOut? *pidlInOut: NULL, debugstr_w(szNext));
+ TRACE("(%p, %p, %s)\n",psf, pidlInOut? *pidlInOut: "", debugstr_w(szNext));
/* get the shellfolder for the child pidl and let it analyse further */
Index: relay32/relay386.c
===================================================================
RCS file: /home/wine/wine/relay32/relay386.c,v
retrieving revision 1.17
diff -u -r1.17 relay386.c
--- relay32/relay386.c 1999/11/14 21:28:57 1.17
+++ relay32/relay386.c 1999/12/20 01:40:30
@@ -73,7 +73,7 @@
if ((typemask & 3) && HIWORD(*args))
{
if (typemask & 2)
- DPRINTF( "%08x L%s", *args, debugstr_w((LPWSTR)*args) );
+ DPRINTF( "%08x %s", *args, debugstr_w((LPWSTR)*args) );
else
DPRINTF( "%08x %s", *args, debugstr_a((LPCSTR)*args) );
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic