Renamed HashTable_Add to HashTable_Insert

* Since the changes break HashTable_Add rename it so that it will
  not fail silently
This commit is contained in:
Armin Novak 2021-05-17 12:27:42 +02:00 committed by akallabeth
parent cb642699c8
commit 880c603c26
15 changed files with 35 additions and 35 deletions

View File

@ -246,8 +246,8 @@ static UINT geometry_recv_pdu(GEOMETRY_CHANNEL_CALLBACK* callback, wStream* s)
mappedGeometry->refCounter = 1;
mappedGeometry->mappingId = id;
if (HashTable_Add(context->geometries, &(mappedGeometry->mappingId), mappedGeometry) <
0)
if (HashTable_Insert(context->geometries, &(mappedGeometry->mappingId),
mappedGeometry) < 0)
{
WLog_ERR(TAG, "unable to register geometry 0x%" PRIx64 " in the table", id);
free(mappedGeometry);

View File

@ -1948,7 +1948,7 @@ static UINT rdpgfx_set_surface_data(RdpgfxClientContext* context, UINT16 surface
key = ((ULONG_PTR)surfaceId) + 1;
if (pData)
HashTable_Add(gfx->SurfaceTable, (void*)key, pData);
HashTable_Insert(gfx->SurfaceTable, (void*)key, pData);
else
HashTable_Remove(gfx->SurfaceTable, (void*)key);

View File

@ -525,7 +525,7 @@ static BOOL wf_rail_window_common(rdpContext* context, const WINDOW_ORDER_INFO*
}
SetWindowLongPtr(railWindow->hWnd, GWLP_USERDATA, (LONG_PTR)railWindow);
HashTable_Add(wfc->railWindows, (void*)(UINT_PTR)orderInfo->windowId, (void*)railWindow);
HashTable_Insert(wfc->railWindows, (void*)(UINT_PTR)orderInfo->windowId, (void*)railWindow);
free(titleW);
UpdateWindow(railWindow->hWnd);
return TRUE;

View File

@ -1869,7 +1869,7 @@ static BOOL xf_cliprdr_fuse_create_nodes(xfClipboard* clipboard, wStream* s, siz
char* tmpName = _strdup(curName);
if (!tmpName)
break;
if (HashTable_Add(mapDir, tmpName, inode) < 0)
if (HashTable_Insert(mapDir, tmpName, inode) < 0)
{
free(tmpName);
break;

View File

@ -1173,7 +1173,7 @@ xfAppWindow* xf_rail_add_window(xfContext* xfc, UINT64 id, UINT32 x, UINT32 y, U
appWindow->width = width;
appWindow->height = height;
xf_AppWindowCreate(xfc, appWindow);
HashTable_Add(xfc->railWindows, &appWindow->windowId, (void*)appWindow);
HashTable_Insert(xfc->railWindows, &appWindow->windowId, (void*)appWindow);
return appWindow;
}

View File

@ -357,7 +357,7 @@ static INLINE BOOL progressive_set_surface_data(PROGRESSIVE_CONTEXT* progressive
key = ((ULONG_PTR)surfaceId) + 1;
if (pData)
return HashTable_Add(progressive->SurfaceContexts, (void*)key, pData) >= 0;
return HashTable_Insert(progressive->SurfaceContexts, (void*)key, pData) >= 0;
HashTable_Remove(progressive->SurfaceContexts, (void*)key);
return TRUE;

View File

@ -830,7 +830,7 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInitEx(
pChannelOpenData->OpenHandle = InterlockedIncrement(&g_OpenHandleSeq);
pChannelOpenData->channels = channels;
pChannelOpenData->lpUserParam = lpUserParam;
HashTable_Add(g_ChannelHandles, (void*)(UINT_PTR)pChannelOpenData->OpenHandle,
HashTable_Insert(g_ChannelHandles, (void*)(UINT_PTR)pChannelOpenData->OpenHandle,
(void*)pChannelOpenData);
pChannelOpenData->flags = 1; /* init */
strncpy(pChannelOpenData->name, pChannelDef->name, CHANNEL_NAME_LEN);
@ -920,7 +920,7 @@ static UINT VCAPITYPE FreeRDP_VirtualChannelInit(LPVOID* ppInitHandle, PCHANNEL_
pChannelOpenData = &channels->openDataList[channels->openDataCount];
pChannelOpenData->OpenHandle = InterlockedIncrement(&g_OpenHandleSeq);
pChannelOpenData->channels = channels;
HashTable_Add(g_ChannelHandles, (void*)(UINT_PTR)pChannelOpenData->OpenHandle,
HashTable_Insert(g_ChannelHandles, (void*)(UINT_PTR)pChannelOpenData->OpenHandle,
(void*)pChannelOpenData);
pChannelOpenData->flags = 1; /* init */
strncpy(pChannelOpenData->name, pChannelDef->name, CHANNEL_NAME_LEN);

View File

@ -828,7 +828,7 @@ HANDLE WINAPI FreeRDP_WTSOpenServerA(LPSTR pServerName)
goto error_free;
}
if (HashTable_Add(g_ServerHandles, (void*)(UINT_PTR)vcm->SessionId, (void*)vcm) < 0)
if (HashTable_Insert(g_ServerHandles, (void*)(UINT_PTR)vcm->SessionId, (void*)vcm) < 0)
goto error_free;
queueCallbacks.fnObjectFree = wts_virtual_channel_manager_free_message;

View File

@ -252,7 +252,7 @@ BOOL pf_server_channels_init(pServerContext* ps)
}
channel_id = (UINT64)WTSChannelGetId(ps->context.peer, channel_name);
HashTable_Add(ps->vc_ids, channel_name, (void*)channel_id);
HashTable_Insert(ps->vc_ids, channel_name, (void*)channel_id);
}
}

View File

@ -344,7 +344,7 @@ static BOOL pf_client_post_connect(freerdp* instance)
{
char* channel_name = config->Passthrough[i];
UINT64 channel_id = (UINT64)freerdp_channels_get_id_by_name(instance, channel_name);
HashTable_Add(pc->vc_ids, (void*)channel_name, (void*)channel_id);
HashTable_Insert(pc->vc_ids, (void*)channel_name, (void*)channel_id);
}
}

View File

@ -215,9 +215,9 @@ static BOOL pf_modules_set_plugin_data(const char* plugin_name, proxyData* pdata
if (data == NULL) /* no need to store anything */
return FALSE;
if (HashTable_Add(pdata->modules_info, ccharconv.cp, data) < 0)
if (HashTable_Insert(pdata->modules_info, ccharconv.cp, data) < 0)
{
WLog_ERR(TAG, "[%s]: HashTable_Add failed!");
WLog_ERR(TAG, "[%s]: HashTable_Insert failed!");
return FALSE;
}

View File

@ -296,7 +296,7 @@ extern "C"
typedef BOOL (*HASH_TABLE_FOREACH_FN)(const void* key, const void* value, void* arg);
WINPR_API size_t HashTable_Count(wHashTable* table);
WINPR_API BOOL HashTable_Add(wHashTable* table, const void* key, const void* value);
WINPR_API BOOL HashTable_Insert(wHashTable* table, const void* key, const void* value);
WINPR_API BOOL HashTable_Remove(wHashTable* table, const void* key);
WINPR_API void HashTable_Clear(wHashTable* table);
WINPR_API BOOL HashTable_Contains(wHashTable* table, const void* key);
@ -328,7 +328,7 @@ extern "C"
{
wObject* obj;
if (!HashTable_SetHashFunction(table, HashTable_StringHash))
if (!HashTable_SetHashFunction(table, ))
return FALSE;
obj = HashTable_KeyObject(table);

View File

@ -2803,7 +2803,7 @@ static LONG WINAPI PCSC_SCardWriteCacheA(SCARDCONTEXT hContext, UUID* CardIdenti
memcpy(data->data, Data, data->len);
HashTable_Remove(ctx->cache, id);
HashTable_Add(ctx->cache, id, data);
HashTable_Insert(ctx->cache, id, data);
return SCARD_S_SUCCESS;
}
@ -2841,7 +2841,7 @@ static LONG WINAPI PCSC_SCardWriteCacheW(SCARDCONTEXT hContext, UUID* CardIdenti
memcpy(data->data, Data, data->len);
HashTable_Remove(ctx->cache, id);
HashTable_Add(ctx->cache, id, data);
HashTable_Insert(ctx->cache, id, data);
return SCARD_S_SUCCESS;
}

View File

@ -268,7 +268,7 @@ size_t HashTable_Count(wHashTable* table)
* Adds an element with the specified key and value into the HashTable.
*/
BOOL HashTable_Add(wHashTable* table, const void* key, const void* value)
BOOL HashTable_Insert(wHashTable* table, const void* key, const void* value)
{
BOOL rc = FALSE;
UINT32 hashValue;

View File

@ -22,11 +22,11 @@ static int test_hash_table_pointer(void)
if (!table)
return -1;
if (!HashTable_Add(table, key1, val1))
if (!HashTable_Insert(table, key1, val1))
goto fail;
if (!HashTable_Add(table, key2, val2))
if (!HashTable_Insert(table, key2, val2))
goto fail;
if (!HashTable_Add(table, key3, val3))
if (!HashTable_Insert(table, key3, val3))
goto fail;
count = HashTable_Count(table);
@ -66,11 +66,11 @@ static int test_hash_table_pointer(void)
goto fail;
}
if (!HashTable_Add(table, key1, val1))
if (!HashTable_Insert(table, key1, val1))
goto fail;
if (!HashTable_Add(table, key2, val2))
if (!HashTable_Insert(table, key2, val2))
goto fail;
if (!HashTable_Add(table, key3, val3))
if (!HashTable_Insert(table, key3, val3))
goto fail;
count = HashTable_Count(table);
@ -160,11 +160,11 @@ static int test_hash_table_string(void)
if (!HashTable_SetupForStringData(table, TRUE))
goto fail;
if (!HashTable_Add(table, key1, val1))
if (!HashTable_Insert(table, key1, val1))
goto fail;
if (!HashTable_Add(table, key2, val2))
if (!HashTable_Insert(table, key2, val2))
goto fail;
if (!HashTable_Add(table, key3, val3))
if (!HashTable_Insert(table, key3, val3))
goto fail;
count = HashTable_Count(table);
@ -204,11 +204,11 @@ static int test_hash_table_string(void)
goto fail;
}
if (!HashTable_Add(table, key1, val1))
if (!HashTable_Insert(table, key1, val1))
goto fail;
if (!HashTable_Add(table, key2, val2))
if (!HashTable_Insert(table, key2, val2))
goto fail;
if (!HashTable_Add(table, key3, val3))
if (!HashTable_Insert(table, key3, val3))
goto fail;
count = HashTable_Count(table);
@ -378,8 +378,8 @@ int test_hash_foreach(void)
if (!HashTable_SetupForStringData(table, TRUE))
goto out;
if (HashTable_Add(table, key1, val1) < 0 || HashTable_Add(table, key2, val2) < 0 ||
HashTable_Add(table, key3, val3) < 0)
if (HashTable_Insert(table, key1, val1) < 0 || HashTable_Insert(table, key2, val2) < 0 ||
HashTable_Insert(table, key3, val3) < 0)
{
retCode = -2;
goto out;