[webkit-reviews] review denied: [Bug 29666] ClipboardWin::files() isn't implemented in Windows : [Attachment 40274] patch #3

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 29 08:09:37 PDT 2009


Adam Roben (aroben) <aroben at apple.com> has denied Marshall Culpepper
<mculpepper at appcelerator.org>'s request for review:
Bug 29666: ClipboardWin::files() isn't implemented in Windows
https://bugs.webkit.org/show_bug.cgi?id=29666

Attachment 40274: patch #3
https://bugs.webkit.org/attachment.cgi?id=40274&action=review

------- Additional Comments from Adam Roben (aroben) <aroben at apple.com>
>  PassRefPtr<FileList> ClipboardWin::files() const
>  {
> -    notImplemented();
> -    return 0;
> +    if (policy() != ClipboardReadable && policy() != ClipboardTypesReadable)

> +	 return FileList::create();
> +
> +    if (!m_dataObject)
> +	   return FileList::create();
> +
> +    RefPtr<FileList> files = FileList::create();
> +    STGMEDIUM medium;
> +    if (FAILED(m_dataObject->GetData(cfHDropFormat(), &medium)))
> +	   return files.release();
> +
> +    HDROP hdrop = reinterpret_cast<HDROP>(GlobalLock(medium.hGlobal));
> +    if (!hdrop)
> +	   return files.release();

I think it would be more consistent to move the declaration of files to the top
of the function and return files.release() in all the bail-out cases.

> +    WCHAR filename[MAX_PATH];
> +    UINT fileCount = DragQueryFileW(hdrop, (UINT)0xFFFFFFFF, 0, 0);

I don't think you need the (UINT) cast here. If you do, please use static_cast
instead of a C-style cast.

> +    for (UINT i = 0; i < fileCount; i++) {
> +	   if (!DragQueryFileW(hdrop, i, filename, ARRAYSIZE(filename)))
> +	       continue;
> +	   files->append(File::create(reinterpret_cast<UChar*>(filename)));
> +    }
> +
> +    DragFinish(hdrop);
> +    GlobalUnlock(medium.hGlobal);
> +    return files.release();
>  }

http://msdn.microsoft.com/en-us/library/bb776904(VS.85).aspx#extracting_filenam
es says that you should be calling ReleaseStgMedium instead of DragFinish.
Other documentation on MSDN leads me to believe that DragFinish should only be
called when handling the WM_DROPFILES message. Sorry for not realizing this
sooner!


More information about the webkit-reviews mailing list