Author: rharabien Date: Wed Feb 8 19:03:43 2012 New Revision: 55497
URL: http://svn.reactos.org/svn/reactos?rev=55497&view=rev Log: [SHELL32] - Fix warnings in MSVC
Modified: trunk/reactos/dll/win32/shell32/pidl.cpp trunk/reactos/dll/win32/shell32/pidl.h
Modified: trunk/reactos/dll/win32/shell32/pidl.cpp URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.cpp?... ============================================================================== --- trunk/reactos/dll/win32/shell32/pidl.cpp [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/pidl.cpp [iso-8859-1] Wed Feb 8 19:03:43 2012 @@ -1463,8 +1463,8 @@
LPITEMIDLIST _ILCreateFromFindDataW( const WIN32_FIND_DATAW *wfd ) { - char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ - DWORD len, len1, wlen, alen; + char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */ + DWORD len, len1, wlen, alen, cbData; LPITEMIDLIST pidl; PIDLTYPE type;
@@ -1481,8 +1481,10 @@ type = (wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? PT_FOLDER : PT_VALUE;
wlen = wcslen(wfd->cFileName) + 1; - pidl = _ILAlloc(type, sizeof(FileStruct) + (alen + (alen & 1)) + - sizeof(FileStructW) + wlen * sizeof(WCHAR) + sizeof(WORD)); + cbData = sizeof(FileStruct) - 1 + (alen + (alen & 1)); // Note: szNames field is initially 1 byte long + cbData += sizeof(FileStructW) - 1 + wlen * sizeof(WCHAR); // Note: wszName field is initially 1 byte long + cbData += sizeof(WORD); // offset to FileStructW + pidl = _ILAlloc(type, cbData); if (pidl) { LPPIDLDATA pData = _ILGetDataPointer(pidl); @@ -1496,7 +1498,7 @@ memcpy(fs->szNames, buff, alen);
fsw = (FileStructW*)(pData->u.file.szNames + alen + (alen & 0x1)); - fsw->cbLen = sizeof(FileStructW) + wlen * sizeof(WCHAR) + sizeof(WORD); + fsw->cbLen = sizeof(FileStructW) - 1 + wlen * sizeof(WCHAR) + sizeof(WORD); FileTimeToDosDateTime( &wfd->ftCreationTime, &fsw->uCreationDate, &fsw->uCreationTime); FileTimeToDosDateTime( &wfd->ftLastAccessTime, &fsw->uLastAccessDate, &fsw->uLastAccessTime); memcpy(fsw->wszName, wfd->cFileName, wlen * sizeof(WCHAR)); @@ -2115,7 +2117,7 @@ cbOffset > pidl->mkid.cb - sizeof(cbOffset) - sizeof(FileStructW) || pidl->mkid.cb != cbOffset + pFileStructW->cbLen) { - WARN("Invalid pidl format (cbOffset = %d)!\n", cbOffset); + ERR("Invalid pidl format (cbOffset = %d)!\n", cbOffset); return NULL; }
Modified: trunk/reactos/dll/win32/shell32/pidl.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/shell32/pidl.h?re... ============================================================================== --- trunk/reactos/dll/win32/shell32/pidl.h [iso-8859-1] (original) +++ trunk/reactos/dll/win32/shell32/pidl.h [iso-8859-1] Wed Feb 8 19:03:43 2012 @@ -164,7 +164,7 @@ WORD uFileDate; /*06*/ WORD uFileTime; /*08*/ WORD uFileAttribs; /*10*/ - CHAR szNames[0]; /*12*/ + CHAR szNames[1]; /*12*/ /* Here are coming two strings. The first is the long name. The second the dos name when needed or just 0x00 */ } FileStruct; @@ -180,7 +180,7 @@ WORD uLastAccessDate; WORD uLastAccessTime; BYTE dummy2[4]; - WCHAR wszName[0]; + WCHAR wszName[1]; } FileStructW;
typedef struct tagValueW