Henri Verbeet : secur32: Use ~0UL instead of -1 for invalid schannel handles.
Alexandre Julliard
julliard at winehq.org
Tue Oct 7 08:53:58 CDT 2008
Module: wine
Branch: master
Commit: 79d88ffe567c774e9076f09e5cf7aa2b2f86e710
URL: http://source.winehq.org/git/wine.git/?a=commit;h=79d88ffe567c774e9076f09e5cf7aa2b2f86e710
Author: Henri Verbeet <hverbeet at gmail.com>
Date: Mon Oct 6 19:08:36 2008 +0200
secur32: Use ~0UL instead of -1 for invalid schannel handles.
---
dlls/secur32/schannel.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c
index 8207668..f501bab 100644
--- a/dlls/secur32/schannel.c
+++ b/dlls/secur32/schannel.c
@@ -48,6 +48,8 @@ MAKE_FUNCPTR(gnutls_global_set_log_function);
MAKE_FUNCPTR(gnutls_global_set_log_level);
#undef MAKE_FUNCPTR
+#define SCHAN_INVALID_HANDLE ~0UL
+
enum schan_handle_type
{
SCHAN_HANDLE_CRED,
@@ -82,7 +84,7 @@ static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type)
if (handle->type != SCHAN_HANDLE_FREE)
{
ERR("Handle %d(%p) is in the free list, but has type %#x.\n", (handle-schan_handle_table), handle, handle->type);
- return -1;
+ return SCHAN_INVALID_HANDLE;
}
schan_free_handles = (struct schan_handle *)handle->object;
handle->object = object;
@@ -98,7 +100,7 @@ static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type)
if (!new_table)
{
ERR("Failed to grow the handle table\n");
- return -1;
+ return SCHAN_INVALID_HANDLE;
}
schan_handle_table = new_table;
schan_handle_table_size = new_size;
@@ -116,7 +118,7 @@ static void *schan_free_handle(ULONG_PTR handle_idx, enum schan_handle_type type
struct schan_handle *handle;
void *object;
- if (handle_idx == -1) return NULL;
+ if (handle_idx == SCHAN_INVALID_HANDLE) return NULL;
handle = &schan_handle_table[handle_idx];
if (handle->type != type)
{
@@ -283,7 +285,7 @@ static SECURITY_STATUS schan_AcquireClientCredentials(const SCHANNEL_CRED *schan
if (!creds) return SEC_E_INSUFFICIENT_MEMORY;
handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED);
- if (handle == -1)
+ if (handle == SCHAN_INVALID_HANDLE)
{
HeapFree(GetProcessHeap(), 0, creds);
return SEC_E_INTERNAL_ERROR;
@@ -325,7 +327,7 @@ static SECURITY_STATUS schan_AcquireServerCredentials(const SCHANNEL_CRED *schan
creds->credential_use = SECPKG_CRED_INBOUND;
handle = schan_alloc_handle(creds, SCHAN_HANDLE_CRED);
- if (handle == -1)
+ if (handle == SCHAN_INVALID_HANDLE)
{
HeapFree(GetProcessHeap(), 0, creds);
return SEC_E_INTERNAL_ERROR;
More information about the wine-cvs
mailing list