Commit 8feb70aa authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

- Stop using a not initialized variable szTemp in

_dbg_ILSimpleGetText, make _dbg_ILSimpleGetText return no value since nobody is using it. - Stop dereferencing a possible NULL in pdump since _dbg_ILGetDataPointer can potentially return NULL (for instance for root or desktop pidl). - Make shdebugstr_guid use standard wine_dbg_sprintf instead of the handmade solution.
parent 78735737
...@@ -144,14 +144,12 @@ IID* _dbg_ILGetGUIDPointer(LPCITEMIDLIST pidl) ...@@ -144,14 +144,12 @@ IID* _dbg_ILGetGUIDPointer(LPCITEMIDLIST pidl)
} }
static static
DWORD _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
{ {
DWORD dwReturn=0;
LPSTR szSrc; LPSTR szSrc;
GUID const * riid; GUID const * riid;
char szTemp[MAX_PATH];
if (!pidl) return 0; if (!pidl) return;
if (szOut) if (szOut)
*szOut = 0; *szOut = 0;
...@@ -160,13 +158,11 @@ DWORD _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) ...@@ -160,13 +158,11 @@ DWORD _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
{ {
/* desktop */ /* desktop */
if (szOut) lstrcpynA(szOut, "Desktop", uOutSize); if (szOut) lstrcpynA(szOut, "Desktop", uOutSize);
dwReturn = strlen ("Desktop");
} }
else if (( szSrc = _dbg_ILGetTextPointer(pidl) )) else if (( szSrc = _dbg_ILGetTextPointer(pidl) ))
{ {
/* filesystem */ /* filesystem */
if (szOut) lstrcpynA(szOut, szSrc, uOutSize); if (szOut) lstrcpynA(szOut, szSrc, uOutSize);
dwReturn = strlen(szSrc);
} }
else if (( riid = _dbg_ILGetGUIDPointer(pidl) )) else if (( riid = _dbg_ILGetGUIDPointer(pidl) ))
{ {
...@@ -175,9 +171,7 @@ DWORD _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) ...@@ -175,9 +171,7 @@ DWORD _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize)
riid->Data1, riid->Data2, riid->Data3, riid->Data1, riid->Data2, riid->Data3,
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] ); riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] );
dwReturn = strlen (szTemp);
} }
return dwReturn;
} }
...@@ -202,17 +196,18 @@ void pdump (LPCITEMIDLIST pidl) ...@@ -202,17 +196,18 @@ void pdump (LPCITEMIDLIST pidl)
{ {
DWORD dwAttrib = 0; DWORD dwAttrib = 0;
LPPIDLDATA pData = _dbg_ILGetDataPointer(pidltemp); LPPIDLDATA pData = _dbg_ILGetDataPointer(pidltemp);
DWORD type = pData->type; DWORD type = pData ? pData->type : 0;
LPSTR szLongName = _dbg_ILGetTextPointer(pidltemp); LPSTR szLongName = _dbg_ILGetTextPointer(pidltemp);
LPSTR szShortName = _dbg_ILGetSTextPointer(pidltemp); LPSTR szShortName = _dbg_ILGetSTextPointer(pidltemp);
char szName[MAX_PATH]; char szName[MAX_PATH];
_dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH); _dbg_ILSimpleGetText(pidltemp, szName, MAX_PATH);
if( PT_FOLDER == type || PT_VALUE == type) if ( pData && (PT_FOLDER == type || PT_VALUE == type) )
dwAttrib = pData->u.file.uFileAttribs; dwAttrib = pData->u.file.uFileAttribs;
MESSAGE ("[%p] size=%04u type=%lx attr=0x%08lx name=\"%s\" (%s,%s)\n", MESSAGE ("[%p] size=%04u type=%lx attr=0x%08lx name=%s (%s,%s)\n",
pidltemp, pidltemp->mkid.cb,type,dwAttrib,szName,debugstr_a(szLongName), debugstr_a(szShortName)); pidltemp, pidltemp->mkid.cb, type, dwAttrib,
debugstr_a(szName), debugstr_a(szLongName), debugstr_a(szShortName));
pidltemp = _dbg_ILGetNext(pidltemp); pidltemp = _dbg_ILGetNext(pidltemp);
...@@ -290,11 +285,7 @@ BOOL pcheck( LPCITEMIDLIST pidl ) ...@@ -290,11 +285,7 @@ BOOL pcheck( LPCITEMIDLIST pidl )
return TRUE; return TRUE;
} }
static char shdebugstr_buf1[100]; static const struct {
static char shdebugstr_buf2[100];
static char * shdebugstr_buf = shdebugstr_buf1;
static struct {
REFIID riid; REFIID riid;
const char *name; const char *name;
} InterfaceDesc[] = { } InterfaceDesc[] = {
...@@ -328,11 +319,8 @@ const char * shdebugstr_guid( const struct _GUID *id ) ...@@ -328,11 +319,8 @@ const char * shdebugstr_guid( const struct _GUID *id )
const char* name = NULL; const char* name = NULL;
char clsidbuf[100]; char clsidbuf[100];
shdebugstr_buf = (shdebugstr_buf == shdebugstr_buf1) ? shdebugstr_buf2 : shdebugstr_buf1; if (!id) return "(null)";
if (!id) {
strcpy (shdebugstr_buf, "(null)");
} else {
for (i=0;InterfaceDesc[i].riid && !name;i++) { for (i=0;InterfaceDesc[i].riid && !name;i++) {
if (IsEqualIID(InterfaceDesc[i].riid, id)) name = InterfaceDesc[i].name; if (IsEqualIID(InterfaceDesc[i].riid, id)) name = InterfaceDesc[i].name;
} }
...@@ -341,10 +329,8 @@ const char * shdebugstr_guid( const struct _GUID *id ) ...@@ -341,10 +329,8 @@ const char * shdebugstr_guid( const struct _GUID *id )
name = clsidbuf; name = clsidbuf;
} }
sprintf( shdebugstr_buf, "\n\t{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)", return wine_dbg_sprintf( "\n\t{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)",
id->Data1, id->Data2, id->Data3, id->Data1, id->Data2, id->Data3,
id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3], id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7], name ? name : "unknown" ); id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7], name ? name : "unknown" );
}
return shdebugstr_buf;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment