From 312ded39cc08596fd3818ab81f25d2e9e09d7a3c Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 23 Aug 2006 13:06:31 +0000 Subject: r17752: using -1 in a uint16_t value causes compiler warnings, use UINT16_MAX as invalid search handle metze (This used to be commit a4e19d6cc4cce611241c502de485dbd2496be0d3) --- source4/ntvfs/posix/pvfs_search.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/ntvfs') diff --git a/source4/ntvfs/posix/pvfs_search.c b/source4/ntvfs/posix/pvfs_search.c index 58cc1e04f3..0d6ee117b5 100644 --- a/source4/ntvfs/posix/pvfs_search.c +++ b/source4/ntvfs/posix/pvfs_search.c @@ -31,6 +31,8 @@ /* place a reasonable limit on old-style searches as clients tend to not send search close requests */ #define MAX_OLD_SEARCHES 2000 +#define MAX_SEARCH_HANDLES (UINT16_MAX - 1) +#define INVALID_SEARCH_HANDLE UINT16_MAX /* destroy an open search @@ -58,7 +60,7 @@ static void pvfs_search_timer(struct event_context *ev, struct timed_event *te, static void pvfs_search_setup_timer(struct pvfs_search_state *search) { struct event_context *ev = search->pvfs->ntvfs->ctx->event_ctx; - if (search->handle == -1) return; + if (search->handle == INVALID_SEARCH_HANDLE) return; talloc_free(search->te); search->te = event_add_timed(ev, search, timeval_current_ofs(search->pvfs->search.inactivity_time, 0), @@ -488,7 +490,7 @@ static NTSTATUS pvfs_search_first_trans2(struct ntvfs_module_context *ntvfs, return status; } - id = idr_get_new(pvfs->search.idtree, search, UINT16_MAX); + id = idr_get_new(pvfs->search.idtree, search, MAX_SEARCH_HANDLES); if (id == -1) { return NT_STATUS_INSUFFICIENT_RESOURCES; } @@ -669,7 +671,7 @@ static NTSTATUS pvfs_search_first_smb2(struct ntvfs_module_context *ntvfs, NT_STATUS_NOT_OK_RETURN(status); search->pvfs = pvfs; - search->handle = -1; + search->handle = INVALID_SEARCH_HANDLE; search->dir = dir; search->current_index = 0; search->search_attrib = 0; @@ -804,7 +806,7 @@ NTSTATUS pvfs_search_close(struct ntvfs_module_context *ntvfs, { struct pvfs_state *pvfs = ntvfs->private_data; struct pvfs_search_state *search; - uint16_t handle = 0; + uint16_t handle = INVALID_SEARCH_HANDLE; switch (io->generic.level) { case RAW_FINDCLOSE_GENERIC: -- cgit