Module: wine Branch: master Commit: 383d8ac105df9dfdafa4e1176ea928bdc17259f1 URL: http://source.winehq.org/git/wine.git/?a=commit;h=383d8ac105df9dfdafa4e1176e...
Author: Alexandre Julliard julliard@winehq.org Date: Thu Mar 3 21:51:29 2011 +0100
user32: Remove GetClipboardFormatName from the user driver interface.
---
dlls/user32/clipboard.c | 15 ++++----------- dlls/user32/driver.c | 13 ------------- dlls/user32/tests/clipboard.c | 12 ++---------- dlls/user32/user_private.h | 1 - dlls/winex11.drv/clipboard.c | 26 +++++--------------------- dlls/winex11.drv/winex11.drv.spec | 1 - 6 files changed, 11 insertions(+), 57 deletions(-)
diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index 7b84686..875a027 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -243,7 +243,8 @@ UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName) */ INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen) { - return USER_Driver->pGetClipboardFormatName(wFormat, retStr, maxlen); + if (wFormat < MAXINTATOM) return 0; + return GlobalGetAtomNameW( wFormat, retStr, maxlen ); }
@@ -252,16 +253,8 @@ INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen) */ INT WINAPI GetClipboardFormatNameA(UINT wFormat, LPSTR retStr, INT maxlen) { - INT ret; - LPWSTR p = HeapAlloc( GetProcessHeap(), 0, maxlen*sizeof(WCHAR) ); - if(p == NULL) return 0; /* FIXME: is this the correct failure value? */ - - ret = GetClipboardFormatNameW( wFormat, p, maxlen ); - - if (ret && maxlen > 0 && !WideCharToMultiByte( CP_ACP, 0, p, -1, retStr, maxlen, 0, 0)) - retStr[maxlen-1] = 0; - HeapFree( GetProcessHeap(), 0, p ); - return ret; + if (wFormat < MAXINTATOM) return 0; + return GlobalGetAtomNameA( wFormat, retStr, maxlen ); }
diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index 8f64219..d40789c 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -99,7 +99,6 @@ static const USER_DRIVER *load_driver(void) GET_USER_FUNC(EnumClipboardFormats); GET_USER_FUNC(IsClipboardFormatAvailable); GET_USER_FUNC(RegisterClipboardFormat); - GET_USER_FUNC(GetClipboardFormatName); GET_USER_FUNC(EndClipboardUpdate); GET_USER_FUNC(ChangeDisplaySettingsEx); GET_USER_FUNC(EnumDisplayMonitors); @@ -275,11 +274,6 @@ static HANDLE CDECL nulldrv_GetClipboardData( UINT format ) return 0; }
-static INT CDECL nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len ) -{ - return FALSE; -} - static BOOL CDECL nulldrv_IsClipboardFormatAvailable( UINT format ) { return FALSE; @@ -462,7 +456,6 @@ static USER_DRIVER null_driver = nulldrv_EndClipboardUpdate, nulldrv_EnumClipboardFormats, nulldrv_GetClipboardData, - nulldrv_GetClipboardFormatName, nulldrv_IsClipboardFormatAvailable, nulldrv_RegisterClipboardFormat, nulldrv_SetClipboardData, @@ -628,11 +621,6 @@ static HANDLE CDECL loaderdrv_GetClipboardData( UINT format ) return load_driver()->pGetClipboardData( format ); }
-static INT CDECL loaderdrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len ) -{ - return load_driver()->pGetClipboardFormatName( format, buffer, len ); -} - static BOOL CDECL loaderdrv_IsClipboardFormatAvailable( UINT format ) { return load_driver()->pIsClipboardFormatAvailable( format ); @@ -809,7 +797,6 @@ static USER_DRIVER lazy_load_driver = loaderdrv_EndClipboardUpdate, loaderdrv_EnumClipboardFormats, loaderdrv_GetClipboardData, - loaderdrv_GetClipboardFormatName, loaderdrv_IsClipboardFormatAvailable, loaderdrv_RegisterClipboardFormat, loaderdrv_SetClipboardData, diff --git a/dlls/user32/tests/clipboard.c b/dlls/user32/tests/clipboard.c index 781334e..c461df4 100644 --- a/dlls/user32/tests/clipboard.c +++ b/dlls/user32/tests/clipboard.c @@ -140,6 +140,7 @@ todo_wine atom_id = GlobalFindAtomA("my_cool_clipboard_format"); ok(atom_id == 0, "GlobalFindAtomA should fail\n"); test_last_error(ERROR_FILE_NOT_FOUND); + }
for (format_id = 0; format_id < 0xffff; format_id++) { @@ -147,18 +148,9 @@ todo_wine len = GetClipboardFormatNameA(format_id, buf, 256);
if (format_id < 0xc000) - { ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf); - test_last_error(ERROR_INVALID_PARAMETER); - } else - { - if (len) - trace("%04x: %s\n", format_id, len ? buf : ""); - else - test_last_error(ERROR_INVALID_HANDLE); - } - } + if (len) trace("%04x: %s\n", format_id, len ? buf : ""); }
ret = OpenClipboard(0); diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 51636de..f7b79b3 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -81,7 +81,6 @@ typedef struct tagUSER_DRIVER { void (CDECL *pEndClipboardUpdate)(void); /* End clipboard update */ UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */ HANDLE (CDECL *pGetClipboardData)(UINT); /* Get specified selection data */ - INT (CDECL *pGetClipboardFormatName)(UINT, LPWSTR, UINT); /* Get a clipboard format name */ BOOL (CDECL *pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */ UINT (CDECL *pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */ BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */ diff --git a/dlls/winex11.drv/clipboard.c b/dlls/winex11.drv/clipboard.c index 8b9fe2d..1a3704d 100644 --- a/dlls/winex11.drv/clipboard.c +++ b/dlls/winex11.drv/clipboard.c @@ -283,12 +283,11 @@ static Window thread_selection_wnd(void)
static const char *debugstr_format( UINT id ) { - if (id >= 0xc000) - { - WCHAR buffer[256]; - GlobalGetAtomNameW( id, buffer, 256 ); + WCHAR buffer[256]; + + if (GetClipboardFormatNameW( id, buffer, 256 )) return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) ); - } + switch (id) { #define BUILTIN(id) case id: return #id; @@ -378,7 +377,7 @@ static void intern_atoms(void) i = 0; LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry ) if (!format->drvData) { - GlobalGetAtomNameW( format->wFormatID, buffer, 256 ); + GetClipboardFormatNameW( format->wFormatID, buffer, 256 ); len = WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, NULL, 0, NULL, NULL); names[i] = HeapAlloc(GetProcessHeap(), 0, len); WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, names[i++], len, NULL, NULL); @@ -2501,21 +2500,6 @@ UINT CDECL X11DRV_RegisterClipboardFormat(LPCWSTR FormatName) }
-/************************************************************************** - * X11DRV_GetClipboardFormatName - */ -INT CDECL X11DRV_GetClipboardFormatName(UINT wFormat, LPWSTR retStr, INT maxlen) -{ - TRACE("(%04X, %p, %d) !\n", wFormat, retStr, maxlen); - - if (wFormat < 0xc000) - { - SetLastError(ERROR_INVALID_PARAMETER); - return 0; - } - return GlobalGetAtomNameW( wFormat, retStr, maxlen ); -} - static void selection_acquire(void) { Window owner; diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 2298b99..cc5cf43 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -91,7 +91,6 @@ @ cdecl EndClipboardUpdate() X11DRV_EndClipboardUpdate @ cdecl EnumClipboardFormats(long) X11DRV_EnumClipboardFormats @ cdecl GetClipboardData(long) X11DRV_GetClipboardData -@ cdecl GetClipboardFormatName(long ptr long) X11DRV_GetClipboardFormatName @ cdecl GetDC(long long long ptr ptr long) X11DRV_GetDC @ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx