user32: Remove GetClipboardFormatName from the user driver interface.

This commit is contained in:
Alexandre Julliard 2011-03-03 21:51:29 +01:00
parent 57921fec3a
commit 383d8ac105
6 changed files with 11 additions and 57 deletions

View File

@ -243,7 +243,8 @@ UINT WINAPI RegisterClipboardFormatA(LPCSTR formatName)
*/ */
INT WINAPI GetClipboardFormatNameW(UINT wFormat, LPWSTR retStr, INT maxlen) 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 WINAPI GetClipboardFormatNameA(UINT wFormat, LPSTR retStr, INT maxlen)
{ {
INT ret; if (wFormat < MAXINTATOM) return 0;
LPWSTR p = HeapAlloc( GetProcessHeap(), 0, maxlen*sizeof(WCHAR) ); return GlobalGetAtomNameA( wFormat, retStr, maxlen );
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;
} }

View File

@ -99,7 +99,6 @@ static const USER_DRIVER *load_driver(void)
GET_USER_FUNC(EnumClipboardFormats); GET_USER_FUNC(EnumClipboardFormats);
GET_USER_FUNC(IsClipboardFormatAvailable); GET_USER_FUNC(IsClipboardFormatAvailable);
GET_USER_FUNC(RegisterClipboardFormat); GET_USER_FUNC(RegisterClipboardFormat);
GET_USER_FUNC(GetClipboardFormatName);
GET_USER_FUNC(EndClipboardUpdate); GET_USER_FUNC(EndClipboardUpdate);
GET_USER_FUNC(ChangeDisplaySettingsEx); GET_USER_FUNC(ChangeDisplaySettingsEx);
GET_USER_FUNC(EnumDisplayMonitors); GET_USER_FUNC(EnumDisplayMonitors);
@ -275,11 +274,6 @@ static HANDLE CDECL nulldrv_GetClipboardData( UINT format )
return 0; return 0;
} }
static INT CDECL nulldrv_GetClipboardFormatName( UINT format, LPWSTR buffer, UINT len )
{
return FALSE;
}
static BOOL CDECL nulldrv_IsClipboardFormatAvailable( UINT format ) static BOOL CDECL nulldrv_IsClipboardFormatAvailable( UINT format )
{ {
return FALSE; return FALSE;
@ -462,7 +456,6 @@ static USER_DRIVER null_driver =
nulldrv_EndClipboardUpdate, nulldrv_EndClipboardUpdate,
nulldrv_EnumClipboardFormats, nulldrv_EnumClipboardFormats,
nulldrv_GetClipboardData, nulldrv_GetClipboardData,
nulldrv_GetClipboardFormatName,
nulldrv_IsClipboardFormatAvailable, nulldrv_IsClipboardFormatAvailable,
nulldrv_RegisterClipboardFormat, nulldrv_RegisterClipboardFormat,
nulldrv_SetClipboardData, nulldrv_SetClipboardData,
@ -628,11 +621,6 @@ static HANDLE CDECL loaderdrv_GetClipboardData( UINT format )
return load_driver()->pGetClipboardData( 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 ) static BOOL CDECL loaderdrv_IsClipboardFormatAvailable( UINT format )
{ {
return load_driver()->pIsClipboardFormatAvailable( format ); return load_driver()->pIsClipboardFormatAvailable( format );
@ -809,7 +797,6 @@ static USER_DRIVER lazy_load_driver =
loaderdrv_EndClipboardUpdate, loaderdrv_EndClipboardUpdate,
loaderdrv_EnumClipboardFormats, loaderdrv_EnumClipboardFormats,
loaderdrv_GetClipboardData, loaderdrv_GetClipboardData,
loaderdrv_GetClipboardFormatName,
loaderdrv_IsClipboardFormatAvailable, loaderdrv_IsClipboardFormatAvailable,
loaderdrv_RegisterClipboardFormat, loaderdrv_RegisterClipboardFormat,
loaderdrv_SetClipboardData, loaderdrv_SetClipboardData,

View File

@ -140,6 +140,7 @@ todo_wine
atom_id = GlobalFindAtomA("my_cool_clipboard_format"); atom_id = GlobalFindAtomA("my_cool_clipboard_format");
ok(atom_id == 0, "GlobalFindAtomA should fail\n"); ok(atom_id == 0, "GlobalFindAtomA should fail\n");
test_last_error(ERROR_FILE_NOT_FOUND); test_last_error(ERROR_FILE_NOT_FOUND);
}
for (format_id = 0; format_id < 0xffff; format_id++) for (format_id = 0; format_id < 0xffff; format_id++)
{ {
@ -147,18 +148,9 @@ todo_wine
len = GetClipboardFormatNameA(format_id, buf, 256); len = GetClipboardFormatNameA(format_id, buf, 256);
if (format_id < 0xc000) if (format_id < 0xc000)
{
ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf); ok(!len, "GetClipboardFormatNameA should fail, but it returned %d (%s)\n", len, buf);
test_last_error(ERROR_INVALID_PARAMETER);
}
else else
{ if (len) trace("%04x: %s\n", format_id, len ? buf : "");
if (len)
trace("%04x: %s\n", format_id, len ? buf : "");
else
test_last_error(ERROR_INVALID_HANDLE);
}
}
} }
ret = OpenClipboard(0); ret = OpenClipboard(0);

View File

@ -81,7 +81,6 @@ typedef struct tagUSER_DRIVER {
void (CDECL *pEndClipboardUpdate)(void); /* End clipboard update */ void (CDECL *pEndClipboardUpdate)(void); /* End clipboard update */
UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */ UINT (CDECL *pEnumClipboardFormats)(UINT); /* Enumerate clipboard formats */
HANDLE (CDECL *pGetClipboardData)(UINT); /* Get specified selection data */ 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 */ BOOL (CDECL *pIsClipboardFormatAvailable)(UINT); /* Check if specified format is available */
UINT (CDECL *pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */ UINT (CDECL *pRegisterClipboardFormat)(LPCWSTR); /* Register a clipboard format */
BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */ BOOL (CDECL *pSetClipboardData)(UINT, HANDLE, BOOL); /* Set specified selection data */

View File

@ -283,12 +283,11 @@ static Window thread_selection_wnd(void)
static const char *debugstr_format( UINT id ) static const char *debugstr_format( UINT id )
{ {
if (id >= 0xc000) WCHAR buffer[256];
{
WCHAR buffer[256]; if (GetClipboardFormatNameW( id, buffer, 256 ))
GlobalGetAtomNameW( id, buffer, 256 );
return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) ); return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) );
}
switch (id) switch (id)
{ {
#define BUILTIN(id) case id: return #id; #define BUILTIN(id) case id: return #id;
@ -378,7 +377,7 @@ static void intern_atoms(void)
i = 0; i = 0;
LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry ) LIST_FOR_EACH_ENTRY( format, &format_list, WINE_CLIPFORMAT, entry )
if (!format->drvData) { if (!format->drvData) {
GlobalGetAtomNameW( format->wFormatID, buffer, 256 ); GetClipboardFormatNameW( format->wFormatID, buffer, 256 );
len = WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, NULL, 0, NULL, NULL); len = WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, NULL, 0, NULL, NULL);
names[i] = HeapAlloc(GetProcessHeap(), 0, len); names[i] = HeapAlloc(GetProcessHeap(), 0, len);
WideCharToMultiByte(CP_UNIXCP, 0, buffer, -1, names[i++], len, NULL, NULL); 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) static void selection_acquire(void)
{ {
Window owner; Window owner;

View File

@ -91,7 +91,6 @@
@ cdecl EndClipboardUpdate() X11DRV_EndClipboardUpdate @ cdecl EndClipboardUpdate() X11DRV_EndClipboardUpdate
@ cdecl EnumClipboardFormats(long) X11DRV_EnumClipboardFormats @ cdecl EnumClipboardFormats(long) X11DRV_EnumClipboardFormats
@ cdecl GetClipboardData(long) X11DRV_GetClipboardData @ cdecl GetClipboardData(long) X11DRV_GetClipboardData
@ cdecl GetClipboardFormatName(long ptr long) X11DRV_GetClipboardFormatName
@ cdecl GetDC(long long long ptr ptr long) X11DRV_GetDC @ cdecl GetDC(long long long ptr ptr long) X11DRV_GetDC
@ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable @ cdecl IsClipboardFormatAvailable(long) X11DRV_IsClipboardFormatAvailable
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx @ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) X11DRV_MsgWaitForMultipleObjectsEx