Splint fiddles.

CVS patchset: 7529
CVS date: 2004/10/31 04:14:11
This commit is contained in:
jbj 2004-10-31 04:14:11 +00:00
parent d294191632
commit ad4046da94
22 changed files with 183 additions and 118 deletions

View File

@ -14,57 +14,52 @@
# --- in progress
#+bounds
-branchstate
-boolops
-bufferoverflowhigh
-compdef
-compdestroy
-compmempass
-declundef
-enummemuse
-evalorder
-exportlocal
-fcnuse
-fielduse
-fixedformalarray
-fullinitblock
-globstate
-infloops
-infloopsuncon
-initallelements
-internalglobs
-mayaliasunique
-modfilesys
-branchstate # 25
-boolops # 34
-bufferoverflowhigh # 2
-compdef # 92
-compdestroy # 100
-compmempass # 26
-declundef # 56
-enummemuse # 3
-evalorder # 2
-exportlocal # 18
-fcnuse # 109
-fielduse # 11
-fixedformalarray # 5
-fullinitblock # 7
-infloops # 1
-infloopsuncon # 1
-initallelements # 3
-mayaliasunique # 4
-modfilesys # 12
-modnomods # 1
-moduncon # 119
-multithreaded
-noeffect
-multithreaded # 1
-noeffect # 152
-noeffectuncon # 30
-nullpass # 17
-nullret
-nullstate
-paramuse
-predboolptr
-protoparammatch
+ptrnegate
-redef
-retalias
-retvalint
-retvalother
-sizeoftype
-staticinittrans
-type
-typeuse
-unrecog
-usereleased
-nullstate # 6
-paramuse # 79
-predboolptr # 70
-protoparammatch # 126
-redef # 1
-retalias # 27
-retvalint # 12
-retvalother # 36
-sizeoftype # 10
-type # 47
-typeuse # 4
-unrecog # 5
-usereleased # 40
-immediatetrans
-kepttrans
-observertrans
-readonlytrans
-statictrans
-temptrans
-unqualifiedtrans
-immediatetrans # 5
-kepttrans # 5
-observertrans # 5
-readonlytrans # 1
-statictrans # 1
-temptrans # 46
-unqualifiedtrans # 12
-casebreak
-loopswitchbreak
@ -78,26 +73,26 @@
-exportvar
# --- not-yet at strict level
-bitwisesigned # 86
-elseifcomplete # 2
-forblock # 6
-ifblock # 231
-incondefs # 64
-namechecks # tedious ANSI compliance checks
-ptrarith # tedious
-bitwisesigned
-elseifcomplete
-forblock
-ifblock
-incondefs
-namechecks
-ptrarith
-mustdefine # 25
-shiftimplementation # 148 ctype.h
-mustdefine
-shiftimplementation
-strictops # 37
-whileblock # 16
-strictops
-whileblock
# --- not-yet at checks level
-mustfree # 26
-usedef # 31
-mustfree
-usedef
# --- not-yet at standard level
+boolint # 38
+charint # 147
+ignorequals # 49
+matchanyintegral # 77
+boolint
+charint
+ignorequals
+matchanyintegral

View File

@ -104,8 +104,9 @@ void *ne_207_get_current_response(ne_207_parser *p)
* NE_OK: for a 2xx response or a 207 response which contained
* only 2xx-class propstats.
* The request object is destroyed in both cases. */
int ne_simple_request(ne_session *sess, ne_request *req)
/*@modifies sess, req @*/;
int ne_simple_request(ne_session *sess, /*@only@*/ ne_request *req)
/*@globals internalState @*/
/*@modifies sess, req, internalState @*/;
END_NEON_DECLS

View File

@ -44,6 +44,7 @@
#include "ne_xml.h" /* for NE_XML_MEDIA_TYPE */
static ne_buffer *acl_body(ne_acl_entry *right, int count)
/*@*/
{
ne_buffer *body = ne_buffer_create();
int m;

View File

@ -50,7 +50,8 @@ typedef struct
/* Set the ACL for the given resource to the list of ACL entries. */
int ne_acl_set(ne_session *sess, const char *uri,
ne_acl_entry entries[], int numentries)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
END_NEON_DECLS

View File

@ -120,8 +120,18 @@ struct auth_challenge {
/*@unchecked@*/
static const struct auth_class {
const char *id, *req_hdr, *resp_hdr, *resp_info_hdr, *fail_msg;
int status_code, fail_code;
/*@observer@*/
const char *id;
/*@observer@*/
const char *req_hdr;
/*@observer@*/
const char *resp_hdr;
/*@observer@*/
const char *resp_info_hdr;
/*@observer@*/
const char *fail_msg;
int status_code;
int fail_code;
} ah_server_class = {
HOOK_SERVER_ID,
"Authorization", "WWW-Authenticate", "Authentication-Info",
@ -163,9 +173,11 @@ typedef struct {
char *basic;
#ifdef HAVE_GSSAPI
/* for the GSSAPI/Negotiate scheme: */
/*@relnull@*/
char *gssapi_token;
gss_ctx_id_t gssctx;
gss_name_t gssname;
/*@relnull@*/
gss_OID gssmech;
#endif
/* These all used for Digest auth */
@ -1293,7 +1305,7 @@ static void ah_destroy(ne_request *req, void *session)
}
}
static void free_auth(void *cookie)
static void free_auth(/*@only@*/ void *cookie)
/*@modifies cookie @*/
{
auth_session *sess = cookie;

View File

@ -441,7 +441,8 @@ void ne_add_depth_header(ne_request *req, int depth)
static int copy_or_move(ne_session *sess, int is_move, int overwrite,
int depth, const char *src, const char *dest)
/*@modifies sess @*/
/*@globals internalState @*/
/*@modifies sess, internalState @*/
{
ne_request *req = ne_request_create( sess, is_move?"MOVE":"COPY", src );

View File

@ -31,12 +31,14 @@ BEGIN_NEON_DECLS
/* Perform a GET request on resource at 'path', writing the entity
* body which is returned to 'fd'. */
int ne_get(ne_session *sess, const char *path, int fd)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* Perform a PUT request on resource at 'path', reading the entity
* body to submit from 'fd'. */
int ne_put(ne_session *sess, const char *path, int fd)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
#define NE_DEPTH_ZERO (0)
#define NE_DEPTH_ONE (1)
@ -56,19 +58,24 @@ int ne_put(ne_session *sess, const char *path, int fd)
* are to be copied. */
int ne_copy(ne_session *sess, int overwrite, int depth,
const char *src, const char *dest)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Move resource from 'src' to dest 'path'. */
int ne_move(ne_session *sess, int overwrite,
const char *src, const char *dest)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Delete resource at 'path'. */
int ne_delete(ne_session *sess, const char *path)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Create a collection at 'path', which MUST have a trailing slash. */
int ne_mkcol(ne_session *sess, const char *path)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Adds a Depth: header to a request */
void ne_add_depth_header(ne_request *req, int depth)
@ -77,10 +84,12 @@ void ne_add_depth_header(ne_request *req, int depth)
/* Retrieve modification time of resource at location 'path', place in
* *modtime. (uses HEAD) */
int ne_getmodtime(ne_session *sess, const char *path, time_t *modtime)
/*@modifies *modtime @*/;
/*@globals internalState @*/
/*@modifies *modtime, internalState @*/;
typedef struct {
const char *type, *subtype;
/*@observer@*/
const char *charset;
char *value;
} ne_content_type;
@ -102,7 +111,8 @@ typedef struct {
* to determine proxy server capabilities if using a proxy server. */
int ne_options(ne_session *sess, const char *path,
ne_server_capabilities *caps)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* Defines a range of bytes, starting at 'start' and ending
* at 'end'. 'total' is the number of bytes in the range.
@ -127,11 +137,13 @@ typedef struct {
* ne_get_range(sess, path, &range, myfile); */
int ne_get_range(ne_session *sess, const char *path,
ne_content_range *range, int fd)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Post using buffer as request-body: stream response into f */
int ne_post(ne_session *sess, const char *path, int fd, const char *buffer)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
END_NEON_DECLS

View File

@ -51,6 +51,7 @@
/* A list of lock objects. */
struct lock_list {
struct ne_lock *lock;
/*@relnull@*/
struct lock_list *next, *prev;
};

View File

@ -44,7 +44,9 @@ struct ne_lock {
int depth; /* the depth of the lock (NE_DEPTH_*). */
enum ne_lock_type type;
enum ne_lock_scope scope;
/*@null@*/
char *token; /* the lock token: uniquely identifies this lock. */
/*@null@*/
char *owner; /* string describing the owner of the lock. */
long timeout; /* timeout in seconds. (or NE_TIMEOUT_*) */
};
@ -127,7 +129,8 @@ struct ne_lock *ne_lockstore_next(ne_lock_store *store)
* path. */
struct ne_lock *ne_lockstore_findbyuri(ne_lock_store *store,
const ne_uri *uri)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* Issue a LOCK request for the given lock. Requires that the uri,
* depth, type, scope, and timeout members of 'lock' are filled in.
@ -135,15 +138,18 @@ struct ne_lock *ne_lockstore_findbyuri(ne_lock_store *store,
* free()d by this function. On successful return, lock->token will
* contain the lock token. */
int ne_lock(ne_session *sess, struct ne_lock *lock)
/*@modifies sess, lock @*/;
/*@globals internalState @*/
/*@modifies sess, lock, internalState @*/;
/* Issue an UNLOCK request for the given lock */
int ne_unlock(ne_session *sess, const struct ne_lock *lock)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* Refresh a lock. Updates lock->timeout appropriately. */
int ne_lock_refresh(ne_session *sess, struct ne_lock *lock)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Callback for lock discovery. If 'lock' is NULL, something went
* wrong performing lockdiscovery for the resource, look at 'status'
@ -159,7 +165,8 @@ typedef void (*ne_lock_result)(void *userdata, const struct ne_lock *lock,
* the results (possibly >1 times). */
int ne_lock_discover(ne_session *sess, const char *path,
ne_lock_result result, void *userdata)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* The ne_lock_using_* functions should be used before dispatching a

View File

@ -30,8 +30,10 @@
#include "ne_ssl.h"
struct host_info {
/*@relnull@*/
char *hostname;
unsigned int port;
/*@relnull@*/
ne_sock_addr *address; /* if non-NULL, result of resolving 'hostname'. */
/* current network address obtained from 'address' being used. */
const ne_inet_addr *current;

View File

@ -123,7 +123,8 @@ ne_request *ne_propfind_get_request(ne_propfind_handler *handler)
static int propfind(ne_propfind_handler *handler,
ne_props_result results, void *userdata)
/*@modifies handler @*/
/*@globals internalState @*/
/*@modifies handler, internalState @*/
{
int ret;
ne_request *req = handler->request;
@ -544,7 +545,7 @@ static void free_propset(/*@only@*/ ne_prop_result_set *set)
ne_free(set);
}
static void end_response(void *userdata, void *resource,
static void end_response(void *userdata, /*@only@*/ void *resource,
const ne_status *status,
const char *description)
/*@modifies resource @*/

View File

@ -54,7 +54,10 @@ BEGIN_NEON_DECLS
/* The name of a WebDAV property. 'nspace' may be NULL. */
typedef struct {
const char *nspace, *name;
/*@observer@*/
const char *nspace;
/*@observer@*/
const char *name;
} ne_propname;
typedef struct ne_prop_result_set_s ne_prop_result_set;
@ -133,7 +136,8 @@ typedef void (*ne_props_result)(void *userdata, const char *href,
int ne_simple_propfind(ne_session *sess, const char *path, int depth,
const ne_propname *props,
ne_props_result results, void *userdata)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* The properties of a resource can be manipulated using ne_proppatch.
* A single proppatch request may include any number of individual
@ -161,7 +165,8 @@ typedef struct {
* NE_*. */
int ne_proppatch(ne_session *sess, const char *path,
const ne_proppatch_operation *ops)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Retrieve property names for the resources at 'path'. 'results'
* callback is called for each resource. Use 'ne_propset_iterate' on
@ -169,7 +174,8 @@ int ne_proppatch(ne_session *sess, const char *path,
* */
int ne_propnames(ne_session *sess, const char *path, int depth,
ne_props_result results, void *userdata)
/*@*/;
/*@globals internalState @*/
/*@modifies internalState @*/;
/* The complex, you-do-all-the-work, property fetch interface:
*/
@ -242,7 +248,8 @@ void ne_propfind_set_private(ne_propfind_handler *handler,
* Returns NE_*. */
int ne_propfind_allprop(ne_propfind_handler *handler,
ne_props_result result, void *userdata)
/*@modifies handler @*/;
/*@globals internalState @*/
/*@modifies handler, internalState @*/;
/* Fetch all properties with names listed in array 'names', which is
* terminated by a property with a NULL name field. For each resource
@ -253,7 +260,8 @@ int ne_propfind_allprop(ne_propfind_handler *handler,
int ne_propfind_named(ne_propfind_handler *handler,
const ne_propname *names,
ne_props_result result, void *userdata)
/*@modifies handler @*/;
/*@globals internalState @*/
/*@modifies handler, internalState @*/;
/* Destroy a propfind handler after use. */
void ne_propfind_destroy(/*@only@*/ ne_propfind_handler *handler)

View File

@ -109,7 +109,7 @@ static int post_send(ne_request *req, void *private, const ne_status *status)
return NE_REDIRECT;
}
static void free_redirect(void *cookie)
static void free_redirect(/*@only@*/ void *cookie)
/*@modifies cookie @*/
{
struct redirect *red = cookie;

View File

@ -200,7 +200,8 @@ struct ne_request_s {
};
static int open_connection(ne_request *req)
/*@modifies req @*/;
/*@globals internalState @*/
/*@modifies req, internalState @*/;
/* The iterative step used to produce the hash value. This is DJB's
* magic "*33" hash function. Ralf Engelschall has done some amazing
@ -233,7 +234,8 @@ static inline unsigned int hash_and_lower(char *name)
* whilst doing 'doing'. 'code', if non-zero, is the socket error
* code, NE_SOCK_*, or if zero, is ignored. */
static int aborted(ne_request *req, const char *doing, ssize_t code)
/*@modifies req @*/
/*@globals internalState @*/
/*@modifies req, internalState @*/
{
ne_session *sess = req->session;
int ret = NE_ERROR;
@ -290,6 +292,7 @@ void ne_handle_numeric_header(void *userdata, const char *value)
*location = atoi(value);
}
/*@null@*/
static void *get_private(const struct hook *hk, const char *id)
/*@*/
{
@ -780,7 +783,8 @@ void ne_request_destroy(ne_request *req)
* set. */
static int read_response_block(ne_request *req, struct ne_response *resp,
char *buffer, size_t *buflen)
/*@modifies req, resp, buffer, *buflen @*/
/*@globals internalState @*/
/*@modifies req, resp, buffer, *buflen, internalState @*/
{
ne_socket *const sock = req->session->socket;
size_t willread;
@ -979,7 +983,8 @@ static inline void strip_eol(char *buf, ssize_t *len)
/* Read and parse response status-line into 'status'. 'retry' is non-zero
* if an NE_RETRY should be returned if an EOF is received. */
static int read_status_line(ne_request *req, ne_status *status, int retry)
/*@modifies req, status @*/
/*@globals internalState @*/
/*@modifies req, status, internalState @*/
{
char *buffer = req->respbuf;
ssize_t ret;
@ -1004,7 +1009,8 @@ static int read_status_line(ne_request *req, ne_status *status, int retry)
/* Discard a set of message headers. */
static int discard_headers(ne_request *req)
/*@modifies req @*/
/*@globals internalState @*/
/*@modifies req, internalState @*/
{
do {
SOCK_ERR(req, ne_sock_readline(req->session->socket, req->respbuf,
@ -1024,7 +1030,8 @@ static int discard_headers(ne_request *req)
* closed already.
*/
static int send_request(ne_request *req, const ne_buffer *request)
/*@modifies req @*/
/*@globals internalState @*/
/*@modifies req, internalState @*/
{
ne_session *sess = req->session;
ssize_t ret = NE_OK;
@ -1086,7 +1093,8 @@ static int send_request(ne_request *req, const ne_buffer *request)
* NE_ERROR: Error (session error is set).
*/
static int read_message_header(ne_request *req, char *buf, size_t buflen)
/*@modifies req, buf @*/
/*@globals internalState @*/
/*@modifies req, buf, internalState @*/
{
ssize_t n;
ne_socket *sock = req->session->socket;
@ -1148,7 +1156,8 @@ static int read_message_header(ne_request *req, char *buf, size_t buflen)
/* Read response headers. Returns NE_* code, sets session error. */
static int read_response_headers(ne_request *req)
/*@modifies req @*/
/*@globals internalState @*/
/*@modifies req, internalState @*/
{
char hdr[8192]; /* max header length */
int ret, count = 0;
@ -1428,7 +1437,8 @@ static const ne_inet_addr *resolve_next(ne_session *sess,
* succeeded, that address will be used first for the next attempt to
* connect. */
static int do_connect(ne_request *req, struct host_info *host, const char *err)
/*@modifies req, host @*/
/*@globals internalState @*/
/*@modifies req, host, internalState @*/
{
ne_session *const sess = req->session;
int ret;

View File

@ -211,7 +211,8 @@ void ne_print_request_header(ne_request *req, const char *name,
* return a meaningful error string
*/
int ne_request_dispatch(ne_request *req)
/*@modifies req @*/;
/*@globals internalState @*/
/*@modifies req, internalState @*/;
/* Returns a pointer to the response status information for the given
* request; pointer is valid until request object is destroyed. */
@ -239,9 +240,11 @@ void ne_request_destroy(/*@only@*/ ne_request *req)
* ne_end_request returns NE_RETRY, you must restart the loop from (1)
* above. */
int ne_begin_request(ne_request *req)
/*@modifies req @*/;
/*@globals internalState @*/
/*@modifies req, internalState @*/;
int ne_end_request(ne_request *req)
/*@modifies req @*/;
/*@globals internalState @*/
/*@modifies req, internalState @*/;
/* Read a block of the response. buffer must be at least 128 bytes.
* 'buflen' must be length of buffer.
@ -252,7 +255,8 @@ int ne_end_request(ne_request *req)
* >0 - number of bytes read into buffer.
*/
ssize_t ne_read_response_block(ne_request *req, char *buffer, size_t buflen)
/*@modifies req, buffer @*/;
/*@globals internalState @*/
/*@modifies req, buffer, internalState @*/;
/* Include the HTTP/1.1 header "Expect: 100-continue" in request 'req'
* if 'flag' is non-zero. Warning: 100-continue support is not
@ -316,6 +320,7 @@ void ne_hook_destroy_session(ne_session *sess,
* call to ne_request_get_private with the same ID. */
void ne_set_request_private(ne_request *req, const char *id, void *priv)
/*@modifies req @*/;
/*@relnull@*/
void *ne_get_request_private(ne_request *req, const char *id)
/*@*/;

View File

@ -46,7 +46,7 @@
#include "ne_private.h"
/* Destroy a a list of hooks. */
static void destroy_hooks(struct hook *hooks)
static void destroy_hooks(/*@only@*/ struct hook *hooks)
/*@modifies hooks @*/
{
struct hook *nexthk;

View File

@ -44,12 +44,14 @@ ne_session *ne_session_create(const char *scheme,
/* Finish an HTTP session */
void ne_session_destroy(/*@only@*/ ne_session *sess)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Prematurely force the connection to be closed for the given
* session. */
void ne_close_connection(ne_session *sess)
/*@modifies sess @*/;
/*@globals internalState @*/
/*@modifies sess, internalState @*/;
/* Set the proxy server to be used for the session. */
void ne_session_proxy(ne_session *sess,
@ -79,6 +81,7 @@ void ne_set_progress(ne_session *sess,
* call to ne_session_get_private with the same ID. */
void ne_set_session_private(ne_session *sess, const char *id, void *priv)
/*@modifies sess @*/;
/*@relnull@*/
void *ne_get_session_private(ne_session *sess, const char *id)
/*@*/;

View File

@ -950,8 +950,8 @@ void ne_addr_destroy(ne_sock_addr *addr)
/* Connect socket 'fd' to address 'addr' on given 'port': */
static int raw_connect(int fd, const ne_inet_addr *addr, unsigned int port)
/*@globals errno @*/
/*@modifies errno @*/
/*@globals errno, internalState @*/
/*@modifies errno, internalState @*/
{
#ifdef USE_GETADDRINFO
#ifdef AF_INET6

View File

@ -87,7 +87,7 @@ const ne_inet_addr *ne_addr_next(ne_sock_addr *addr)
/* If name resolution fails, copies the error string into 'buffer',
* which is of size 'bufsiz'. 'buffer' is returned. */
char *ne_addr_error(const ne_sock_addr *addr, char *buffer, size_t bufsiz)
char *ne_addr_error(const ne_sock_addr *addr, /*@returned@*/ char *buffer, size_t bufsiz)
/*@modifies buffer @*/;
/* Destroys an address object created by ne_addr_resolve. */
@ -133,7 +133,8 @@ ne_socket *ne_sock_create(void)
* Returns non-zero if a connection could not be established. */
int ne_sock_connect(ne_socket *sock, const ne_inet_addr *addr,
unsigned int port)
/*@modifies sock @*/;
/*@globals internalState @*/
/*@modifies sock, internalState @*/;
/* ne_sock_read reads up to 'count' bytes into 'buffer'.
* Returns:
@ -192,7 +193,8 @@ int ne_sock_fd(const ne_socket *sock)
/* Close the socket, and destroy the socket object. Returns non-zero
* on error. */
int ne_sock_close(/*@only@*/ ne_socket *sock)
/*@modifies sock @*/;
/*@globals internalState @*/
/*@modifies sock, internalState @*/;
/* Return current error string for socket. */
const char *ne_sock_error(const ne_socket *sock)

View File

@ -238,7 +238,7 @@ void ne_buffer_altered(ne_buffer *buf)
buf->used = strlen(buf->data) + 1;
}
/*@unchecked@*/
/*@unchecked@*/ /*@observer@*/
static const char *b64_alphabet =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"

View File

@ -87,7 +87,7 @@ int ne_uri_cmp(const ne_uri *u1, const ne_uri *u2)
/*@*/;
/* Free URI object. */
void ne_uri_free(/*@only@*/ ne_uri *parsed)
void ne_uri_free(ne_uri *parsed)
/*@modifies parsed @*/;
END_NEON_DECLS

View File

@ -146,7 +146,10 @@ const char *ne_xml_doc_encoding(const ne_xml_parser *p)
/* A utility interface for mapping {nspace, name} onto an integer. */
struct ne_xml_idmap {
const char *nspace, *name;
/*@observer@*/
const char *nspace;
/*@observer@*/
const char *name;
int id;
};