summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/.lclintrc7
-rw-r--r--rpmio/Makefile.am3
-rw-r--r--rpmio/rpmio.c6
-rw-r--r--rpmio/rpmio.h130
-rw-r--r--rpmio/rpmio_internal.h5
-rw-r--r--rpmio/rpmrpc.c6
-rw-r--r--rpmio/url.c16
7 files changed, 86 insertions, 87 deletions
diff --git a/rpmio/.lclintrc b/rpmio/.lclintrc
index f648efd07..4aaf64c22 100644
--- a/rpmio/.lclintrc
+++ b/rpmio/.lclintrc
@@ -1,4 +1,4 @@
--I. -I.. -I../popt -DHAVE_CONFIG_H -D_GNU_SOURCE
+-I. -I.. -I../beecrypt -I../popt -I../zlib -DHAVE_CONFIG_H -D_GNU_SOURCE
+partial
+forcehints
@@ -35,14 +35,11 @@
-incondefs # <bits/{ipc,pthreadtypes}.h> heartburn
-matchfields # <bits/ipc.h> heartburn
-namechecks # tedious ANSI compliance checks
--numenummembers 1024 # RPMTAG has 138 members
--numstructfields 256 # Java jni.h has 229 fields
-ptrarith # tedious
-compdestroy
-mustdefine
--shiftimplementation
-#-shiftnegative
+-shiftimplementation # ctype.h pain
-strictops
-strictusereleased
diff --git a/rpmio/Makefile.am b/rpmio/Makefile.am
index 6edf5f587..1d29675cc 100644
--- a/rpmio/Makefile.am
+++ b/rpmio/Makefile.am
@@ -8,11 +8,8 @@ EXTRA_PROGRAMS = tdigest tdir tfts tglob tinv tkey tring trpmio dumpasn1
INCLUDES = \
-I$(top_srcdir) \
- -I$(top_srcdir)/build \
- -I$(top_srcdir)/lib \
-I$(top_srcdir)/beecrypt \
-I$(top_srcdir)/popt \
- @WITH_ZLIB_INCLUDE@ \
@INCPATH@
pkgincdir = $(pkgincludedir)
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index c39dfdc9c..99e3feda2 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -269,12 +269,6 @@ DBGIO(fd, (stderr, "==> fdFdopen(%p,\"%s\") fdno %d -> fp %p fdno %d\n", cookie,
}
#endif
-#if 0
-#undef fdLink
-#undef fdFree
-#undef fdNew
-#endif
-
/* =============================================================== */
/*@-modfilesys@*/
/*@-mustmod@*/ /* FIX: cookie is modified */
diff --git a/rpmio/rpmio.h b/rpmio/rpmio.h
index b9ac3b460..a2008adcd 100644
--- a/rpmio/rpmio.h
+++ b/rpmio/rpmio.h
@@ -58,26 +58,28 @@ extern "C" {
/**
*/
typedef ssize_t (*fdio_read_function_t) (void *cookie, char *buf, size_t nbytes)
- /*@globals fileSystem @*/
- /*@modifies *cookie, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *cookie, errno, fileSystem @*/
+ /*@requires maxSet(buf) >= (nbytes - 1) @*/
+ /*@ensures maxRead(buf) >= nbytes @*/ ;
/**
*/
typedef ssize_t (*fdio_write_function_t) (void *cookie, const char *buf, size_t nbytes)
- /*@globals fileSystem @*/
- /*@modifies *cookie, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *cookie, errno, fileSystem @*/;
/**
*/
typedef int (*fdio_seek_function_t) (void *cookie, _libio_pos_t pos, int whence)
- /*@globals fileSystem @*/
- /*@modifies *cookie, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *cookie, errno, fileSystem @*/;
/**
*/
typedef int (*fdio_close_function_t) (void *cookie)
- /*@globals fileSystem @*/
- /*@modifies *cookie, fileSystem @*/;
+ /*@globals errno, fileSystem, systemState @*/
+ /*@modifies *cookie, errno, fileSystem, systemState @*/;
/**
@@ -113,8 +115,8 @@ typedef int (*fdio_fileno_function_t) (void * cookie)
/**
*/
typedef FD_t (*fdio_open_function_t) (const char * path, int flags, mode_t mode)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
*/
@@ -144,51 +146,51 @@ typedef int (*fdio_fflush_function_t) (FD_t fd)
/**
*/
typedef int (*fdio_mkdir_function_t) (const char * path, mode_t mode)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
*/
typedef int (*fdio_chdir_function_t) (const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
*/
typedef int (*fdio_rmdir_function_t) (const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
*/
typedef int (*fdio_rename_function_t) (const char * oldpath, const char * newpath)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
*/
typedef int (*fdio_unlink_function_t) (const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/*@-typeuse@*/
/**
*/
typedef int (*fdio_stat_function_t) (const char * path, /*@out@*/ struct stat * st)
- /*@globals fileSystem @*/
- /*@modifies *st, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *st, errno, fileSystem @*/;
/**
*/
typedef int (*fdio_lstat_function_t) (const char * path, /*@out@*/ struct stat * st)
- /*@globals fileSystem @*/
- /*@modifies *st, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *st, errno, fileSystem @*/;
/**
*/
typedef int (*fdio_access_function_t) (const char * path, int amode)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/*@=typeuse@*/
/*@}*/
@@ -300,8 +302,8 @@ int Fileno(FD_t fd)
*/
/*@unused@*/
int Fcntl(FD_t fd, int op, void *lip)
- /*@globals fileSystem @*/
- /*@modifies fd, *lip, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies fd, *lip, errno, fileSystem @*/;
/*@}*/
@@ -314,71 +316,73 @@ int Fcntl(FD_t fd, int op, void *lip)
* mkdir(2) clone.
*/
int Mkdir(const char * path, mode_t mode)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* chdir(2) clone.
*/
int Chdir(const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* rmdir(2) clone.
*/
int Rmdir(const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* rename(2) clone.
*/
int Rename(const char * oldpath, const char * newpath)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* link(2) clone.
*/
int Link(const char * oldpath, const char * newpath)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* unlink(2) clone.
*/
int Unlink(const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* readlink(2) clone.
*/
int Readlink(const char * path, /*@out@*/ char * buf, size_t bufsiz)
- /*@globals fileSystem @*/
- /*@modifies *buf, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *buf, errno, fileSystem @*/
+ /*@requires maxSet(buf) >= (bufsiz - 1) @*/
+ /*@ensures result <= bufsiz @*/;
/**
* stat(2) clone.
*/
int Stat(const char * path, /*@out@*/ struct stat * st)
- /*@globals fileSystem @*/
- /*@modifies *st, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *st, errno, fileSystem @*/;
/**
* lstat(2) clone.
*/
int Lstat(const char * path, /*@out@*/ struct stat * st)
- /*@globals fileSystem @*/
- /*@modifies *st, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *st, errno, fileSystem @*/;
/**
* access(2) clone.
*/
int Access(const char * path, int amode)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
@@ -403,23 +407,23 @@ void Globfree( /*@only@*/ glob_t * pglob)
*/
/*@null@*/
DIR * Opendir(const char * path)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
/**
* readdir(3) clone.
*/
/*@null@*/
struct dirent * Readdir(DIR * dir)
- /*@globals fileSystem @*/
- /*@modifies *dir, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *dir, errno, fileSystem @*/;
/**
* closedir(3) clone.
*/
int Closedir(/*@only@*/ DIR * dir)
- /*@globals fileSystem @*/
- /*@modifies *dir, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *dir, errno, fileSystem @*/;
/*@}*/
@@ -459,29 +463,31 @@ off_t fdSize(FD_t fd)
/**
*/
/*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode)
- /*@globals fileSystem @*/
- /*@modifies fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies errno, fileSystem @*/;
#define fdOpen(_path, _flags, _mode) fdio->_open((_path), (_flags), (_mode))
/**
*/
ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count)
- /*@globals fileSystem @*/
- /*@modifies *cookie, *buf, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *cookie, *buf, errno, fileSystem @*/
+ /*@requires maxSet(buf) >= (count - 1) @*/
+ /*@ensures maxRead(buf) >= count @*/ ;
#define fdRead(_fd, _buf, _count) fdio->read((_fd), (_buf), (_count))
/**
*/
ssize_t fdWrite(void * cookie, const char * buf, size_t count)
- /*@globals fileSystem @*/
- /*@modifies *cookie, fileSystem @*/;
+ /*@globals errno, fileSystem @*/
+ /*@modifies *cookie, errno, fileSystem @*/;
#define fdWrite(_fd, _buf, _count) fdio->write((_fd), (_buf), (_count))
/**
*/
int fdClose( /*@only@*/ void * cookie)
- /*@globals fileSystem @*/
- /*@modifies *cookie, fileSystem @*/;
+ /*@globals errno, fileSystem, systemState @*/
+ /*@modifies *cookie, errno, fileSystem, systemState @*/;
#define fdCLose(_fd) fdio->close(_fd)
/**
diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h
index 5681ed450..599b10d91 100644
--- a/rpmio/rpmio_internal.h
+++ b/rpmio/rpmio_internal.h
@@ -157,8 +157,13 @@ extern int _ftp_debug;
#define DBG(_f, _m, _x) \
if ((_rpmio_debug | ((_f) ? ((FD_t)(_f))->flags : 0)) & (_m)) fprintf _x
+#if defined(__LCLINT__XXX)
+#define DBGIO(_f, _x)
+#define DBGREFS(_f, _x)
+#else
#define DBGIO(_f, _x) DBG((_f), RPMIO_DEBUG_IO, _x)
#define DBGREFS(_f, _x) DBG((_f), RPMIO_DEBUG_REFS, _x)
+#endif
#ifdef __cplusplus
extern "C" {
diff --git a/rpmio/rpmrpc.c b/rpmio/rpmrpc.c
index 95e895108..02e6109a2 100644
--- a/rpmio/rpmrpc.c
+++ b/rpmio/rpmrpc.c
@@ -1,4 +1,3 @@
-/*@-type@*/ /* LCL: function typedefs */
/** \ingroup rpmio
* \file rpmio/rpmrpc.c
*/
@@ -1083,6 +1082,7 @@ struct __dirstream {
static int ftpmagicdir = 0x8440291;
#define ISFTPMAGIC(_dir) (!memcmp((_dir), &ftpmagicdir, sizeof(ftpmagicdir)))
+/*@-type@*/ /* FIX: abstract DIR */
/*@null@*/
static DIR * ftpOpendir(const char * path)
/*@globals fileSystem @*/
@@ -1260,6 +1260,7 @@ fprintf(stderr, "*** ftpReaddir(%p) %p \"%s\"\n", (void *)dir, dp, dp->d_name);
return dp;
}
+/*@=type@*/
static int ftpClosedir(/*@only@*/ DIR * dir)
/*@globals fileSystem @*/
@@ -1386,11 +1387,13 @@ fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", pattern, (unsigned)flags, (void *)e
/*@=castfcnptr@*/
switch (ut) {
case URL_IS_FTP:
+/*@-type@*/
pglob->gl_closedir = Closedir;
pglob->gl_readdir = Readdir;
pglob->gl_opendir = Opendir;
pglob->gl_lstat = Lstat;
pglob->gl_stat = Stat;
+/*@=type@*/
flags |= GLOB_ALTDIRFUNC;
break;
case URL_IS_HTTP: /* XXX WRONG WRONG WRONG */
@@ -1460,4 +1463,3 @@ fprintf(stderr, "*** Closedir(%p)\n", (void *)dir);
return closedir(dir);
}
/*@=voidabstract@*/
-/*@=type@*/
diff --git a/rpmio/url.c b/rpmio/url.c
index 4c2e3dadc..bc89ec732 100644
--- a/rpmio/url.c
+++ b/rpmio/url.c
@@ -1,4 +1,3 @@
-/*@-type@*/ /* LCL: function typedefs */
/** \ingroup rpmio
* \file rpmio/url.c
*/
@@ -177,10 +176,9 @@ void urlFreeCache(void)
static int urlStrcmp(/*@null@*/ const char * str1, /*@null@*/ const char * str2)
/*@*/
{
- if (str1 && str2)
- /*@-nullpass@*/ /* LCL: 2nd arg claims to be NULL */
- return strcmp(str1, str2);
- /*@=nullpass@*/
+ if (str1)
+ if (str2)
+ return strcmp(str1, str2);
if (str1 != str2)
return -1;
return 0;
@@ -331,7 +329,8 @@ static void urlFind(/*@null@*/ /*@in@*/ /*@out@*/ urlinfo * uret, int mustAsk)
*/
/*@observer@*/ /*@unchecked@*/
static struct urlstring {
-/*@observer@*/ /*@null@*/ const char * leadin;
+/*@observer@*/ /*@null@*/
+ const char * leadin;
urltype ret;
} urlstrings[] = {
{ "file://", URL_IS_PATH },
@@ -471,9 +470,9 @@ int urlSplit(const char * url, urlinfo *uret)
if (u->port < 0 && u->service != NULL) {
struct servent *serv;
- /*@-unrecog -multithreaded -moduncon @*/
+ /*@-multithreaded -moduncon @*/
serv = getservbyname(u->service, "tcp");
- /*@=unrecog =multithreaded =moduncon @*/
+ /*@=multithreaded =moduncon @*/
if (serv != NULL)
u->port = ntohs(serv->s_port);
else if (u->urltype == URL_IS_FTP)
@@ -557,4 +556,3 @@ exit:
return rc;
}
-/*@=type@*/