"Aric Stewart" <aric(a)codeweavers.com> wrote:
> + if (fs)
> + {
> + FileTimeToDosDateTime( &(stffile->ftLastWriteTime),
> + &fs->uFileDate, &fs->uFileTime);
> + fs->dwFileSize = stffile->nFileSizeLow;
> + fs->uFileAttribs = (WORD)stffile->dwFileAttributes;
> +
> + memcpy(fs->szNames, name_buff, name_len);
> + TRACE("-- Set Value: %s\n",debugstr_a(fs->szNames));
> + }
Indentation above is not consistent.
> LPITEMIDLIST _ILCreateFromFindDataW( WIN32_FIND_DATAW *wfd )
> {
> - /* FIXME: should make unicode PIDLs */
> - WIN32_FIND_DATAA fda;
> + char buff[MAX_PATH + 14 +1]; /* see WIN32_FIND_DATA */
> + char * pbuff = buff;
> + size_t len, len1, wlen, alen;
> + LPITEMIDLIST pidl;
> + PIDLTYPE type;
> +
> + if (!wfd)
> + return NULL;
> +
> + TRACE("(%s, %s)\n",debugstr_w(wfd->cAlternateFileName), debugstr_w(wfd->cFileName));
> +
> + /* prepare buffer with both names */
> + len = WideCharToMultiByte(CP_ACP,0,wfd->cFileName,-1,NULL,0,NULL,NULL) + 1;
> + WideCharToMultiByte(CP_ACP,0,wfd->cFileName,-1, pbuff, len, NULL, NULL);
> + pbuff += len;
Looks like 2 WideCharToMultiByte calls can be replaced by 1.
> +
> + len1 = WideCharToMultiByte(CP_ACP,0,wfd->cAlternateFileName,-1, NULL, 0, NULL, NULL) +1;
> + WideCharToMultiByte(CP_ACP,0,wfd->cAlternateFileName,-1, pbuff, len1, NULL, NULL);
> + alen = len + len1;
Same here.
> +
> + type = (wfd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? PT_FOLDER : PT_VALUE;
> +
> + /*
> + * FileStruct already has one byte for the first name, so use len - 1 in
> + * size calculation
> + */
> + wlen = lstrlenW(wfd->cFileName);
> + pidl = _ILAlloc(type, sizeof(FileStruct) + (alen - 1) + (alen & 0x1) +
> + sizeof(FileStructW) + wlen * sizeof(WCHAR) + sizeof(WORD)) ;
What (alen & 0x1) is for?
--
Dmitry.