RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 17-Apr-2017 21:25:27 Branch: rpm-5_4 Handle: 2017041719252700 Modified files: (Branch: rpm-5_4) rpm/rpmio iosm.c iosm.h rpmio.c rpmio_internal.h Log: - splint: RIP. Summary: Revision Changes Path 1.43.2.11 +73 -208 rpm/rpmio/iosm.c 1.18.4.6 +25 -88 rpm/rpmio/iosm.h 1.230.2.40 +84 -309 rpm/rpmio/rpmio.c 2.127.2.9 +43 -166 rpm/rpmio/rpmio_internal.h ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/iosm.c ============================================================================ $ cvs diff -u -r1.43.2.10 -r1.43.2.11 iosm.c --- rpm/rpmio/iosm.c 17 Apr 2017 18:19:08 -0000 1.43.2.10 +++ rpm/rpmio/iosm.c 17 Apr 2017 19:25:27 -0000 1.43.2.11 @@ -15,8 +15,8 @@ #include "../rpmdb/rpmtag.h" -typedef /*@abstract@*/ /*@refcounted@*/ struct rpmts_s * rpmts; -typedef /*@abstract@*/ struct rpmte_s * rpmte; +typedef struct rpmts_s * rpmts; +typedef struct rpmte_s * rpmte; #define _IOSM_INTERNAL #include <iosm.h> @@ -31,11 +31,11 @@ #define _RPMFI_NOMETHODS #include "../lib/rpmfi.h" -typedef /*@abstract@*/ /*@refcounted@*/ struct rpmds_s * rpmds; +typedef struct rpmds_s * rpmds; typedef struct rpmRelocation_s * rpmRelocation; #undef _USE_RPMTE #if defined(_USE_RPMTE) -typedef /*@abstract@*/ void * alKey; +typedef void * alKey; #include "rpmte.h" #endif @@ -44,8 +44,8 @@ #include "../lib/rpmsx.h" /* XXX rpmsx rpmsxFContext rpmsxFree */ #endif -typedef /*@abstract@*/ /*@refcounted@*/ struct rpmdb_s * rpmdb; -typedef /*@abstract@*/ struct rpmmi_s * rpmmi; +typedef struct rpmdb_s * rpmdb; +typedef struct rpmmi_s * rpmmi; typedef struct rpmPRCO_s * rpmPRCO; typedef struct Spec_s * Spec; #undef _USE_RPMTS @@ -55,12 +55,6 @@ #include "debug.h" -/*@access FD_t @*/ /* XXX void ptr args */ -/*@access IOSMI_t @*/ -/*@access IOSM_t @*/ - -/*@access rpmfi @*/ - #ifdef __cplusplus GENfree(unsigned short *) GENfree(int *) @@ -71,13 +65,9 @@ #define alloca_strdup(_s) strcpy((char *)alloca(strlen(_s)+1), (_s)) #define _IOSM_DEBUG 0 -/*@unchecked@*/ int _iosm_debug = _IOSM_DEBUG; -/*@-exportheadervar@*/ -/*@unchecked@*/ int _iosm_threads = 0; -/*@=exportheadervar@*/ /* maximum pre-fallocate and mmap size. */ off_t _iosm_maxsize = 128 * 1024 * 1024; @@ -85,27 +75,20 @@ /* size of R/W buffers */ size_t _iosm_bufsize = 32 * BUFSIZ; -/*@-redecl@*/ -int (*_iosmNext) (IOSM_t iosm, iosmFileStage nstage) - /*@modifies iosm @*/ = &iosmNext; -/*@=redecl@*/ +int (*_iosmNext) (IOSM_t iosm, iosmFileStage nstage) = &iosmNext; #if defined(_USE_RPMTS) void * iosmGetTs(const IOSM_t iosm) { const IOSMI_t iter = iosm->iter; - /*@-compdef -refcounttrans -retexpose -usereleased @*/ return (iter ? iter->ts : NULL); - /*@=compdef =refcounttrans =retexpose =usereleased @*/ } #endif void * iosmGetFi(const IOSM_t iosm) { const IOSMI_t iter = iosm->iter; - /*@-compdef -refcounttrans -retexpose -usereleased @*/ return (iter ? iter->fi : NULL); - /*@=compdef =refcounttrans =retexpose =usereleased @*/ } #define SUFFIX_RPMORIG ".rpmorig" @@ -120,13 +103,11 @@ * @param suffix suffix to use (NULL disables) * @retval path to file */ -static /*@only@*//*@null@*/ -const char * iosmFsPath(/*@special@*/ /*@null@*/ const IOSM_t iosm, - /*@null@*/ const struct stat * st, - /*@null@*/ const char * subdir, - /*@null@*/ const char * suffix) - /*@uses iosm->dirName, iosm->baseName */ - /*@*/ +static +const char * iosmFsPath(const IOSM_t iosm, + const struct stat * st, + const char * subdir, + const char * suffix) { const char * s = NULL; @@ -153,8 +134,7 @@ * @param _iter file info iterator * @retval NULL always */ -static /*@null@*/ void * mapFreeIterator(/*@only@*//*@null@*/ void * _iter) - /*@modifies p @*/ +static void * mapFreeIterator(void * _iter) { IOSMI_t iter = (IOSMI_t) _iter; if (iter) { @@ -172,10 +152,8 @@ * @param reverse iterate in reverse order? * @return file info iterator */ -/*@-mustmod@*/ static void * mapInitIterator(rpmfi fi, int reverse) - /*@modifies fi @*/ { IOSMI_t iter = NULL; @@ -183,22 +161,20 @@ #if !defined(_RPMFI_NOMETHODS) iter->fi = rpmfiLink(fi, "mapIterator"); #else -/*@i@*/ iter->fi = fi; + iter->fi = fi; #endif iter->reverse = reverse; iter->i = (iter->reverse ? (fi->fc - 1) : 0); iter->isave = iter->i; return iter; } -/*@=mustmod@*/ /** \ingroup payload * Return next index into file info. * @param _iter file info iterator * @return next index, -1 on termination */ -static int mapNextIterator(/*@null@*/ void * _iter) - /*@*/ +static int mapNextIterator(void * _iter) { IOSMI_t iter = (IOSMI_t) _iter; int i = -1; @@ -217,7 +193,6 @@ /** \ingroup payload */ static int iosmStrCmp(const void * a, const void * b) - /*@*/ { const char * aurl = *(const char **)a; const char * burl = *(const char **)b; @@ -250,15 +225,12 @@ * @param iosmPath archive path * @return index into file info, -1 if archive path was not found */ -static int mapFind(/*@null@*/ IOSMI_t iter, const char * iosmPath) - /*@modifies iter @*/ +static int mapFind(IOSMI_t iter, const char * iosmPath) { int ix = -1; if (iter) { -/*@-onlytrans@*/ const rpmfi fi = (rpmfi) iter->fi; -/*@=onlytrans@*/ #if !defined(_RPMFI_NOMETHODS) size_t fc = rpmfiFC(fi); #else @@ -285,7 +257,6 @@ */ typedef struct dnli_s { rpmfi fi; -/*@only@*/ /*@null@*/ char * active; int reverse; int isave; @@ -297,8 +268,7 @@ * @param _dnli directory name iterator * @retval NULL always */ -static /*@null@*/ void * dnlFreeIterator(/*@only@*//*@null@*/ const void * _dnli) - /*@modifies _dnli @*/ +static void * dnlFreeIterator(const void * _dnli) { if (_dnli) { DNLI_t dnli = (DNLI_t)_dnli; @@ -309,16 +279,14 @@ /** \ingroup payload */ -static inline int dnlCount(/*@null@*/ const DNLI_t dnli) - /*@*/ +static inline int dnlCount(const DNLI_t dnli) { return (int) (dnli ? dnli->fi->dc : 0); } /** \ingroup payload */ -static inline int dnlIndex(/*@null@*/ const DNLI_t dnli) - /*@*/ +static inline int dnlIndex(const DNLI_t dnli) { return (dnli ? dnli->isave : -1); } @@ -329,12 +297,8 @@ * @param reverse traverse directory names in reverse order? * @return directory name iterator */ -/*@-usereleased@*/ -static /*@only@*/ /*@null@*/ -void * dnlInitIterator(/*@special@*/ const IOSM_t iosm, - int reverse) - /*@uses iosm->iter @*/ - /*@*/ +static +void * dnlInitIterator(const IOSM_t iosm, int reverse) { rpmfi fi = (rpmfi) iosmGetFi(iosm); const char * dnl; @@ -385,20 +349,20 @@ size_t jlen; if (!dnli->active[j] || j == (int)dil) - /*@innercontinue@*/ continue; + continue; (void) urlPath(fi->dnl[j], &dnl); jlen = strlen(dnl); if (jlen != (dnlen+bnlen+1)) - /*@innercontinue@*/ continue; + continue; if (strncmp(dnl, fi->dnl[dil], dnlen)) - /*@innercontinue@*/ continue; + continue; if (strncmp(dnl+dnlen, fi->bnl[i], bnlen)) - /*@innercontinue@*/ continue; + continue; if (dnl[dnlen+bnlen] != '/' || dnl[dnlen+bnlen+1] != '\0') - /*@innercontinue@*/ continue; + continue; /* This directory is included in the package. */ dnli->active[j] = (char)0; - /*@innerbreak@*/ break; + break; } } @@ -421,16 +385,14 @@ } return dnli; } -/*@=usereleased@*/ /** \ingroup payload * Return next directory name (from file info). * @param dnli directory name iterator * @return next directory name */ -static /*@observer@*/ /*@null@*/ -const char * dnlNextIterator(/*@null@*/ DNLI_t dnli) - /*@modifies dnli @*/ +static +const char * dnlNextIterator(DNLI_t dnli) { const char * dn = NULL; @@ -454,19 +416,13 @@ #if defined(WITH_PTHREADS) static void * iosmThread(void * _iosm) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies _iosm, fileSystem, internalState @*/ { IOSM_t iosm = (IOSM_t) _iosm; -/*@-unqualifiedtrans@*/ return ((void *) ((long)iosmStage(iosm, iosm->nstage))); -/*@=unqualifiedtrans@*/ } #endif int iosmNext(IOSM_t iosm, iosmFileStage nstage) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ { iosm->nstage = nstage; #if defined(WITH_PTHREADS) @@ -481,12 +437,7 @@ * @param iosm file state machine data * @return Is chain only partially filled? */ -static int saveHardLink(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@uses iosm->links, iosm->ix, iosm->sb, iosm->goal, iosm->nsuffix @*/ - /*@defines iosm->li @*/ - /*@releases iosm->path @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int saveHardLink(IOSM_t iosm) { struct stat * st = &iosm->sb; int rc = 0; @@ -517,9 +468,7 @@ if (iosm->goal == IOSM_PKGINSTALL) iosm->li->linksLeft = 0; - /*@-kepttrans@*/ iosm->li->next = iosm->links; - /*@=kepttrans@*/ iosm->links = iosm->li; } @@ -530,9 +479,7 @@ } iosm->li->filex[iosm->li->linksLeft] = iosm->ix; - /*@-observertrans -dependenttrans@*/ iosm->li->nsuffix[iosm->li->linksLeft] = iosm->nsuffix; - /*@=observertrans =dependenttrans@*/ if (iosm->goal == IOSM_PKGINSTALL) iosm->li->linksLeft++; if (iosm->goal == IOSM_PKGBUILD) @@ -572,8 +519,7 @@ * @param li set of hard links * @return NULL always */ -static /*@null@*/ void * freeHardLink(/*@only@*/ /*@null@*/ struct hardLink_s * li) - /*@modifies li @*/ +static void * freeHardLink(struct hardLink_s * li) { if (li) { li->nsuffix = _free(li->nsuffix); /* XXX elements are shared */ @@ -607,7 +553,6 @@ } static int arSetup(IOSM_t iosm, rpmfi fi) - /*@modifies iosm @*/ { const char * path; char * t; @@ -686,7 +631,7 @@ #if defined(_USE_RPMTS) const rpmts ts = (const rpmts) _ts; #endif -/*@i@*/ const rpmfi fi = (const rpmfi) _fi; + const rpmfi fi = (const rpmfi) _fi; #if defined(_USE_RPMTE) int reverse = (rpmteType(fi->te) == TR_REMOVED && fi->action != FA_COPYOUT); int adding = (rpmteType(fi->te) == TR_ADDED); @@ -701,10 +646,8 @@ iosm->multithreaded = _iosm_threads; iosm->adding = adding; -/*@+voidabstract -nullpass@*/ if (iosm->debug < 0) fprintf(stderr, "--> iosmSetup(%p, 0x%x, \"%s\", %p, %p, %p, %p, %p)\n", iosm, goal, afmt, (void *)_ts, _fi, cfd, archiveSize, failedFile); -/*@=voidabstract =nullpass@*/ _iosmNext = &iosmNext; if (iosm->headerRead == NULL) { @@ -738,15 +681,11 @@ iosm->goal = goal; if (cfd != NULL) { -/*@-assignexpose@*/ iosm->cfd = fdLink(cfd, "persist (iosm)"); -/*@=assignexpose@*/ pos = fdGetCpioPos(iosm->cfd); fdSetCpioPos(iosm->cfd, 0); } -/*@-mods@*/ /* WTF? */ iosm->iter = (IOSMI_t) mapInitIterator(fi, reverse); -/*@=mods@*/ #if defined(_USE_RPMTS) iosm->iter->ts = rpmtsLink(ts, "mapIterator"); iosm->nofcontexts = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCONTEXTS); @@ -758,9 +697,7 @@ iosm->goal != IOSM_PKGCOMMIT) ? 0 : 1); #undef _tsmask #else -/*@-assignexpose -temptrans @*/ iosm->iter->ts = (void *)_ts; -/*@=assignexpose =temptrans @*/ iosm->nofcontexts = 1; iosm->nofdigests = 1; iosm->commit = 1; @@ -774,14 +711,12 @@ } #endif - /*@-assignexpose@*/ iosm->archiveSize = archiveSize; if (iosm->archiveSize) *iosm->archiveSize = 0; iosm->failedFile = failedFile; if (iosm->failedFile) *iosm->failedFile = NULL; - /*@=assignexpose@*/ memset(iosm->sufbuf, 0, sizeof(iosm->sufbuf)); if (iosm->goal == IOSM_PKGINSTALL) { @@ -807,9 +742,7 @@ if (iosm->archiveSize && ec == 0) *iosm->archiveSize = (fdGetCpioPos(iosm->cfd) - pos); -/*@-nullstate@*/ /* FIX: *iosm->failedFile may be NULL */ return ec; -/*@=nullstate@*/ } int iosmTeardown(IOSM_t iosm) @@ -852,7 +785,6 @@ * @return 0 always */ static int iosmMapFContext(IOSM_t iosm) - /*@modifies iosm @*/ { /* * Find file security context (if not disabled). @@ -869,7 +801,6 @@ iosm->fcontext = (fi->fcontexts ? fi->fcontexts[i] : NULL); } #endif -/*@=moduncon@*/ } return 0; } @@ -1045,11 +976,7 @@ * @param iosm file state machine data * @return 0 on success */ -/*@-compdef@*/ -static int extractRegular(/*@special@*/ IOSM_t iosm) - /*@uses iosm->fdigest, iosm->digest, iosm->sb, iosm->wfd @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int extractRegular(IOSM_t iosm) { const struct stat * st = &iosm->sb; size_t left = (size_t) st->st_size; @@ -1135,7 +1062,6 @@ (void) iosmNext(iosm, IOSM_WCLOSE); return rc; } -/*@=compdef@*/ /** \ingroup payload * Write next item to payload stream. @@ -1143,11 +1069,7 @@ * @param writeData should data be written? * @return 0 on success */ -/*@-compdef -compmempass@*/ -static int writeFile(/*@special@*/ /*@partial@*/ IOSM_t iosm, int writeData) - /*@uses iosm->path, iosm->opath, iosm->sb, iosm->osb, iosm->cfd @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int writeFile(IOSM_t iosm, int writeData) { const char * path = iosm->path; const char * opath = iosm->opath; @@ -1245,7 +1167,7 @@ #if defined(HAVE_MMAP) if (mapped != (void *)-1) { /* XXX splint misses size_t 2nd arg. */ -/*@i@*/ xx = msync(mapped, nmapped, MS_ASYNC); + xx = msync(mapped, nmapped, MS_ASYNC); #if defined(HAVE_MADVISE) && defined(MADV_DONTNEED) xx = madvise(mapped, nmapped, MADV_DONTNEED); #endif @@ -1268,23 +1190,17 @@ exit: if (iosm->rfd != NULL) (void) iosmNext(iosm, IOSM_RCLOSE); -/*@-dependenttrans@*/ iosm->opath = opath; iosm->path = path; -/*@=dependenttrans@*/ return rc; } -/*@=compdef =compmempass@*/ /** \ingroup payload * Write set of linked files to payload stream. * @param iosm file state machine data * @return 0 on success */ -static int writeLinkedFile(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@uses iosm->path, iosm->nsuffix, iosm->ix, iosm->li, iosm->failedFile @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int writeLinkedFile(IOSM_t iosm) { const char * path = iosm->path; const char * lpath = iosm->lpath; @@ -1306,9 +1222,7 @@ if (iosm->li->filex[i] < 0) continue; iosm->ix = iosm->li->filex[i]; -/*@-compdef@*/ rc = iosmNext(iosm, IOSM_MAP); -/*@=compdef@*/ /* XXX tar and cpio have to do things differently. */ if (iosm->headerWrite == tarHeaderWrite) { @@ -1339,9 +1253,7 @@ iosm->li->filex[i] = -1; } -/*@-dependenttrans@*/ linkpath = _free(linkpath); -/*@=dependenttrans@*/ iosm->ix = iterIndex; iosm->nsuffix = nsuffix; iosm->lpath = lpath; @@ -1354,11 +1266,7 @@ * @param iosm file state machine data * @return 0 on success */ -/*@-compdef@*/ -static int iosmMakeLinks(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@uses iosm->path, iosm->opath, iosm->nsuffix, iosm->ix, iosm->li @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int iosmMakeLinks(IOSM_t iosm) { const char * path = iosm->path; const char * opath = iosm->opath; @@ -1407,19 +1315,13 @@ iosm->opath = opath; return ec; } -/*@=compdef@*/ /** \ingroup payload * Commit hard linked file set atomically. * @param iosm file state machine data * @return 0 on success */ -/*@-compdef@*/ -static int iosmCommitLinks(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@uses iosm->path, iosm->nsuffix, iosm->ix, iosm->sb, - iosm->li, iosm->links @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int iosmCommitLinks(IOSM_t iosm) { const char * path = iosm->path; const char * nsuffix = iosm->nsuffix; @@ -1453,17 +1355,13 @@ iosm->path = path; return rc; } -/*@=compdef@*/ /** * Remove (if created) directories not explicitly included in package. * @param iosm file state machine data * @return 0 on success */ -static int iosmRmdirs(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@uses iosm->path, iosm->dnlx, iosm->ldn, iosm->rdbuf, iosm->iter @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int iosmRmdirs(IOSM_t iosm) { const char * path = iosm->path; void * dnli = dnlInitIterator(iosm, 1); @@ -1473,7 +1371,6 @@ iosm->path = NULL; dn[0] = '\0'; - /*@-observertrans -dependenttrans@*/ if (iosm->ldn != NULL && iosm->dnlx != NULL) while ((iosm->path = dnlNextIterator((DNLI_t)dnli)) != NULL) { size_t dnlen = strlen(iosm->path); @@ -1488,23 +1385,18 @@ iosm->path = dn; /* Remove generated directories. */ - /*@-usereleased@*/ /* LCL: te used after release? */ do { if (*te == '/') { *te = '\0'; -/*@-compdef@*/ rc = iosmNext(iosm, IOSM_RMDIR); -/*@=compdef@*/ *te = '/'; } if (rc) - /*@innerbreak@*/ break; + break; te--; } while ((te - iosm->path) > iosm->dnlx[dc]); - /*@=usereleased@*/ } dnli = dnlFreeIterator(dnli); - /*@=observertrans =dependenttrans@*/ iosm->path = path; return rc; @@ -1515,12 +1407,7 @@ * @param iosm file state machine data * @return 0 on success */ -static int iosmMkdirs(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@uses iosm->path, iosm->sb, iosm->osb, iosm->rdbuf, iosm->iter, - iosm->ldn, iosm->ldnlen, iosm->ldnalloc @*/ - /*@defines iosm->dnlx, iosm->ldn @*/ - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int iosmMkdirs(IOSM_t iosm) { struct stat * st = &iosm->sb; struct stat * ost = &iosm->osb; @@ -1536,7 +1423,6 @@ dn[0] = '\0'; iosm->dnlx = (unsigned short *) (dc ? xcalloc(dc, sizeof(*iosm->dnlx)) : NULL); - /*@-observertrans -dependenttrans@*/ if (iosm->dnlx != NULL) while ((iosm->path = dnlNextIterator((DNLI_t)dnli)) != NULL) { size_t dnlen = strlen(iosm->path); @@ -1548,10 +1434,8 @@ if (dnlen <= 1) continue; - /*@-compdef -nullpass@*/ /* FIX: iosm->ldn not defined ??? */ if (dnlen <= iosm->ldnlen && !strcmp(iosm->path, iosm->ldn)) continue; - /*@=compdef =nullpass@*/ /* Copy to avoid const on iosm->path. */ (void) stpcpy(dn, iosm->path); @@ -1561,12 +1445,11 @@ (void) urlPath(dn, (const char **)&te); for (i = 1, te++; *te != '\0'; te++, i++) { if (*te != '/') - /*@innercontinue@*/ continue; + continue; *te = '\0'; /* Already validated? */ - /*@-usedef -compdef -nullpass -nullderef@*/ if (i < iosm->ldnlen && (iosm->ldn[i] == '/' || iosm->ldn[i] == '\0') && !strncmp(iosm->path, iosm->ldn, i)) @@ -1574,9 +1457,8 @@ *te = '/'; /* Move pre-existing path marker forward. */ iosm->dnlx[dc] = (te - dn); - /*@innercontinue@*/ continue; + continue; } - /*@=usedef =compdef =nullpass =nullderef@*/ /* Validate next component of path. */ rc = iosmUNSAFE(iosm, IOSM_LSTAT); @@ -1614,12 +1496,11 @@ *te = '/'; } if (rc) - /*@innerbreak@*/ break; + break; } if (rc) break; /* Save last validated path. */ -/*@-compdef@*/ /* FIX: ldn/path annotations ? */ if (iosm->ldnalloc < (dnlen + 1)) { iosm->ldnalloc = dnlen + 100; iosm->ldn = (char *) xrealloc(iosm->ldn, iosm->ldnalloc); @@ -1628,16 +1509,12 @@ strcpy(iosm->ldn, iosm->path); iosm->ldnlen = dnlen; } -/*@=compdef@*/ } dnli = dnlFreeIterator(dnli); - /*@=observertrans =dependenttrans@*/ iosm->path = path; st->st_mode = st_mode; /* XXX restore st->st_mode */ -/*@-compdef@*/ /* FIX: ldn/path annotations ? */ return rc; -/*@=compdef@*/ } #ifdef NOTYET @@ -1646,9 +1523,7 @@ * @param iosm file state machine data * @return 0 on success */ -static int iosmStat(/*@special@*/ /*@partial@*/ IOSM_t iosm) - /*@globals fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/ +static int iosmStat(IOSM_t iosm) { int rc = 0; @@ -1677,7 +1552,6 @@ ((_x)[sizeof("/dev/log")-1] == '\0' || \ (_x)[sizeof("/dev/log")-1] == ';')) -/*@-compmempass@*/ int iosmStage(IOSM_t iosm, iosmFileStage stage) { #ifdef NOTUSED @@ -1732,21 +1606,21 @@ /* Exit on end-of-payload. */ if (rc == IOSMERR_HDR_TRAILER) { rc = 0; - /*@loopbreak@*/ break; + break; } /* Exit on error. */ if (rc) { iosm->postpone = 1; (void) iosmNext(iosm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Extract file from archive. */ rc = iosmNext(iosm, IOSM_PROCESS); if (rc) { (void) iosmNext(iosm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Notify on success. */ @@ -1754,7 +1628,7 @@ rc = iosmNext(iosm, IOSM_FINI); if (rc) { - /*@loopbreak@*/ break; + break; } } break; @@ -1767,12 +1641,12 @@ /* Exit on end-of-payload. */ if (rc == IOSMERR_HDR_TRAILER) { rc = 0; - /*@loopbreak@*/ break; + break; } /* Rename/erase next item. */ if (iosmNext(iosm, IOSM_FINI)) - /*@loopbreak@*/ break; + break; } break; case IOSM_PKGBUILD: @@ -1783,28 +1657,28 @@ /* Exit on end-of-payload. */ if (rc == IOSMERR_HDR_TRAILER) { rc = 0; - /*@loopbreak@*/ break; + break; } /* Exit on error. */ if (rc) { iosm->postpone = 1; (void) iosmNext(iosm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Copy file into archive. */ rc = iosmNext(iosm, IOSM_PROCESS); if (rc) { (void) iosmNext(iosm, IOSM_UNDO); - /*@loopbreak@*/ break; + break; } /* Notify on success. */ (void) iosmNext(iosm, IOSM_NOTIFY); if (iosmNext(iosm, IOSM_FINI)) - /*@loopbreak@*/ break; + break; } /* Flush partial sets of hard linked files. */ @@ -1817,7 +1691,7 @@ /* Re-calculate link count for archive header. */ for (j = -1, nlink = 0, i = 0; i < iosm->li->nlink; i++) { if (iosm->li->filex[i] < 0) - /*@innercontinue@*/ continue; + continue; nlink++; if (j == -1) j = i; } @@ -1876,9 +1750,7 @@ /* Detect and create directories not explicitly in package. */ if (iosm->goal == IOSM_PKGINSTALL) { -/*@-compdef@*/ rc = iosmNext(iosm, IOSM_MKDIRS); -/*@=compdef@*/ if (!rc) iosm->mkdirsdone = 1; } @@ -1968,7 +1840,6 @@ iosm->postpone = iosmFileActionSkipped(iosm->action); if (iosm->goal == IOSM_PKGINSTALL || iosm->goal == IOSM_PKGBUILD) { - /*@-evalorder@*/ /* FIX: saveHardLink can modify iosm */ if (S_ISREG(st->st_mode) && st->st_nlink > 1) { iosm->postpone = saveHardLink(iosm); if (iosm->postpone < 0) { @@ -1976,7 +1847,6 @@ break; } } - /*@=evalorder@*/ } { rpmfi fi = (rpmfi) iosmGetFi(iosm); if (fi != NULL && (fi->mapflags & IOSM_PAYLOAD_LIST)) @@ -2017,7 +1887,7 @@ for (li = iosm->links, prev = NULL; li; prev = li, li = li->next) if (li == iosm->li) - /*@loopbreak@*/ break; + break; if (prev == NULL) iosm->links = iosm->li->next; @@ -2068,9 +1938,7 @@ iosm->opath = opath; } - /*@-dependenttrans@*/ iosm->path = path; - /*@=dependenttrans@*/ if (!(rc == IOSMERR_ENOENT)) return rc; rc = extractRegular(iosm); } else if (S_ISDIR(st->st_mode)) { @@ -2098,7 +1966,7 @@ } } else if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode) || - /*@-unrecog@*/ S_ISSOCK(st->st_mode) /*@=unrecog@*/) + S_ISSOCK(st->st_mode) ) { rc = iosmUNSAFE(iosm, IOSM_VERIFY); if (rc == IOSMERR_ENOENT) @@ -2201,20 +2069,20 @@ case IOSMERR_ENOTEMPTY: /* XXX make sure that build side permits %missingok on directories. */ if (iosm->fflags & RPMFILE_MISSINGOK) - /*@innerbreak@*/ break; + break; /* XXX common error message. */ rpmlog( (iosm->strict_erasures ? RPMLOG_ERR : RPMLOG_DEBUG), _("rmdir of %s failed: Directory not empty\n"), iosm->path); - /*@innerbreak@*/ break; + break; default: rpmlog( (iosm->strict_erasures ? RPMLOG_ERR : RPMLOG_DEBUG), _("rmdir of %s failed: %s\n"), iosm->path, strerror(errno)); - /*@innerbreak@*/ break; + break; } } else { rc = iosmNext(iosm, IOSM_UNLINK); @@ -2222,14 +2090,14 @@ switch (rc) { case IOSMERR_ENOENT: if (iosm->fflags & RPMFILE_MISSINGOK) - /*@innerbreak@*/ break; + break; /*@fallthrough@*/ default: rpmlog( (iosm->strict_erasures ? RPMLOG_ERR : RPMLOG_DEBUG), _("unlink of %s failed: %s\n"), iosm->path, strerror(errno)); - /*@innerbreak@*/ break; + break; } } } @@ -2308,7 +2176,7 @@ { for (i = 0 ; i < iosm->li->linksLeft; i++) { if (iosm->li->filex[i] < 0) - /*@innercontinue@*/ continue; + continue; rc = IOSMERR_MISSING_HARDLINK; if (iosm->failedFile && *iosm->failedFile == NULL) { iosm->ix = iosm->li->filex[i]; @@ -2317,7 +2185,7 @@ iosm->path = NULL; } } - /*@loopbreak@*/ break; + break; } } if (iosm->goal == IOSM_PKGBUILD && @@ -2354,7 +2222,7 @@ iosm->path = iosm->opath; iosm->opath = NULL; return (rc ? rc : IOSMERR_ENOENT); /* XXX HACK */ - /*@notreached@*/ break; + break; } else if (S_ISDIR(st->st_mode)) { if (S_ISDIR(ost->st_mode)) return 0; if (S_ISLNK(ost->st_mode)) { @@ -2385,7 +2253,7 @@ if (iosm->stage == IOSM_PROCESS) rc = iosmNext(iosm, IOSM_UNLINK); if (rc == 0) rc = IOSMERR_ENOENT; return (rc ? rc : IOSMERR_ENOENT); /* XXX HACK */ - /*@notreached@*/ break; + break; case IOSM_UNLINK: /* XXX Remove setuid/setgid bits on possibly hard linked files. */ @@ -2452,9 +2320,9 @@ iosm->path, (rc < 0 ? strerror(errno) : "")); if (rc < 0) switch (errno) { - case ENOENT: rc = IOSMERR_ENOENT; /*@switchbreak@*/ break; - case ENOTEMPTY: rc = IOSMERR_ENOTEMPTY; /*@switchbreak@*/ break; - default: rc = IOSMERR_RMDIR_FAILED; /*@switchbreak@*/ break; + case ENOENT: rc = IOSMERR_ENOENT; break; + case ENOTEMPTY: rc = IOSMERR_ENOTEMPTY; break; + default: rc = IOSMERR_RMDIR_FAILED; break; } break; case IOSM_LSETFCON: @@ -2531,9 +2399,7 @@ if (rc < 0) rc = IOSMERR_MKFIFO_FAILED; break; case IOSM_MKNOD: - /*@-unrecog -portability @*/ /* FIX: check S_IFIFO or dev != 0 */ rc = Mknod(iosm->path, (st->st_mode & ~07777), st->st_rdev); - /*@=unrecog =portability @*/ if (iosm->debug && (stage & IOSM_SYSCALL)) rpmlog(RPMLOG_DEBUG, " %8s (%s, 0%o, 0x%x) %s\n", cur, iosm->path, (unsigned)(st->st_mode & ~07777), @@ -2592,7 +2458,7 @@ iosm->wrlen = (left > iosm->wrsize ? iosm->wrsize : left); rc = iosmNext(iosm, IOSM_DREAD); if (rc) - /*@loopbreak@*/ break; + break; } break; case IOSM_POS: @@ -2739,7 +2605,6 @@ } return rc; } -/*@=compmempass@*/ #define IOSM_SKIPPING(_a) \ ((_a) == FA_SKIP || (_a) == FA_SKIPNSTATE || (_a) == FA_SKIPNETSHARED || (_a) == FA_SKIPCOLOR) @@ -2749,7 +2614,7 @@ return IOSM_SKIPPING(action); } -/*@observer@*/ const char * iosmFileActionString(iosmFileAction a) +const char * iosmFileActionString(iosmFileAction a) { switch (a) { case FA_UNKNOWN: return "unknown"; @@ -2769,7 +2634,7 @@ /*@notreached@*/ } -/*@observer@*/ const char * iosmFileStageString(iosmFileStage a) { +const char * iosmFileStageString(iosmFileStage a) { switch(a) { case IOSM_UNKNOWN: return "unknown"; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/iosm.h ============================================================================ $ cvs diff -u -r1.18.4.5 -r1.18.4.6 iosm.h --- rpm/rpmio/iosm.h 17 Apr 2017 18:19:08 -0000 1.18.4.5 +++ rpm/rpmio/iosm.h 17 Apr 2017 19:25:27 -0000 1.18.4.6 @@ -14,12 +14,9 @@ /** \ingroup payload * File state machine data. */ -typedef /*@abstract@*/ struct iosm_s * IOSM_t; +typedef struct iosm_s * IOSM_t; -/*@-exportlocal@*/ -/*@unchecked@*/ extern int _iosm_debug; -/*@=exportlocal@*/ extern off_t _iosm_maxsize; /* XXX usually 128Mb */ extern size_t _iosm_bufsize; /* XXX usually 256Kb (32*BUFSIZ) */ @@ -184,17 +181,14 @@ /** \ingroup payload * Iterator across package file info, forward on install, backward on erase. */ -typedef /*@abstract@*/ struct iosmIterator_s * IOSMI_t; +typedef struct iosmIterator_s * IOSMI_t; /** \ingroup payload * Keeps track of the set of all hard links to a file in an archive. */ struct hardLink_s { -/*@owned@*/ /*@relnull@*/ struct hardLink_s * next; -/*@owned@*/ const char ** nsuffix; -/*@owned@*/ int * filex; struct stat sb; int nlink; @@ -219,58 +213,37 @@ * File name and stat information. */ struct iosm_s { -/*@owned@*/ /*@relnull@*/ const char * path; /*!< Current file name. */ -/*@owned@*/ /*@relnull@*/ const char * lpath; /*!< Current link name. */ -/*@owned@*/ /*@relnull@*/ const char * opath; /*!< Original file name. */ -/*@relnull@*/ FD_t cfd; /*!< Payload file handle. */ -/*@relnull@*/ FD_t rfd; /*!< read: File handle. */ int rfdno; /*!< read: File descriptor. */ -/*@dependent@*/ /*@relnull@*/ char * rdbuf; /*!< read: Buffer. */ -/*@owned@*/ /*@relnull@*/ char * rdb; /*!< read: Buffer allocated. */ size_t rdsize; /*!< read: Buffer allocated size. */ size_t rdlen; /*!< read: Number of bytes requested.*/ size_t rdnb; /*!< read: Number of bytes returned. */ FD_t wfd; /*!< write: File handle. */ int wfdno; /*!< write: File descriptor. */ -/*@dependent@*/ /*@relnull@*/ char * wrbuf; /*!< write: Buffer. */ -/*@owned@*/ /*@relnull@*/ char * wrb; /*!< write: Buffer allocated. */ size_t wrsize; /*!< write: Buffer allocated size. */ size_t wrlen; /*!< write: Number of bytes requested.*/ size_t wrnb; /*!< write: Number of bytes returned. */ -/*@only@*/ /*@relnull@*/ IOSMI_t iter; /*!< File iterator. */ int ix; /*!< Current file iterator index. */ -/*@only@*/ /*@relnull@*/ struct hardLink_s * links; /*!< Pending hard linked file(s). */ -/*@only@*/ /*@relnull@*/ struct hardLink_s * li; /*!< Current hard linked file(s). */ -/*@kept@*/ /*@null@*/ unsigned int * archiveSize; /*!< Pointer to archive size. */ -/*@kept@*/ /*@null@*/ const char ** failedFile; /*!< First file name that failed. */ -/*@shared@*/ /*@relnull@*/ const char * subdir; /*!< Current file sub-directory. */ -/*@unused@*/ char subbuf[64]; /* XXX eliminate */ -/*@observer@*/ /*@relnull@*/ const char * osuffix; /*!< Old, preserved, file suffix. */ -/*@observer@*/ /*@relnull@*/ const char * nsuffix; /*!< New, created, file suffix. */ -/*@shared@*/ /*@relnull@*/ const char * suffix; /*!< Current file suffix. */ char sufbuf[64]; /* XXX eliminate */ -/*@only@*/ /*@null@*/ unsigned short * dnlx; /*!< Last dirpath verified indexes. */ -/*@only@*/ /*@null@*/ char * ldn; /*!< Last dirpath verified. */ size_t ldnlen; /*!< Last dirpath current length. */ size_t ldnalloc; /*!< Last dirpath allocated length. */ @@ -291,15 +264,10 @@ iosmMapFlags mapFlags; /*!< Bit(s) to control mapping. */ rpmuint32_t fdigestalgo; /*!< Digest algorithm (~= PGPHASHALGO_MD5) */ rpmuint32_t digestlen; /*!< No. of bytes in binary digest (~= 16) */ -/*@shared@*/ /*@relnull@*/ const char * dirName; /*!< File directory name. */ -/*@shared@*/ /*@relnull@*/ const char * baseName; /*!< File base name. */ -/*@shared@*/ /*@relnull@*/ const char * fdigest; /*!< Hex digest (usually MD5, NULL disables). */ -/*@shared@*/ /*@relnull@*/ const unsigned char * digest;/*!< Bin digest (usually MD5, NULL disables). */ -/*@dependent@*/ /*@observer@*/ /*@null@*/ const char * fcontext; /*!< File security context (NULL disables). */ rpmuint32_t fflags; /*!< File flags. */ @@ -311,14 +279,10 @@ struct stat osb; /*!< Original file stat(2) info. */ unsigned blksize; /*!< Archive block size. */ - int (*headerRead) (void * _iosm, struct stat *st) - /*@modifies _iosm, st @*/; - int (*headerWrite) (void * _iosm, struct stat *st) - /*@modifies _iosm, st @*/; - int (*trailerWrite) (void * _iosm) - /*@modifies _iosm @*/; + int (*headerRead) (void * _iosm, struct stat *st); + int (*headerWrite) (void * _iosm, struct stat *st); + int (*trailerWrite) (void * _iosm); -/*@null@*/ char * lmtab; /*!< ar(1) long member name table. */ size_t lmtablen; /*!< ar(1) no. bytes in lmtab. */ size_t lmtaboff; /*!< ar(1) current offset in lmtab. */ @@ -331,50 +295,42 @@ extern "C" { #endif -/*@-exportlocal@*/ /** * Return formatted string representation of file stages. * @param a file stage * @return formatted string */ -/*@observer@*/ const char * iosmFileStageString(iosmFileStage a) - RPM_GNUC_CONST - /*@*/; +const char * iosmFileStageString(iosmFileStage a) + RPM_GNUC_CONST; /** * Return formatted string representation of file disposition. * @param a file disposition * @return formatted string */ -/*@observer@*/ const char * iosmFileActionString(iosmFileAction a) - RPM_GNUC_CONST - /*@*/; -/*@=exportlocal@*/ +const char * iosmFileActionString(iosmFileAction a) + RPM_GNUC_CONST; /** \ingroup payload * Return formatted error message on payload handling failure. * @param rc error code * @return (malloc'd) formatted error string */ -/*@only@*/ -char * iosmStrerror(int rc) - /*@*/; +char * iosmStrerror(int rc); #if defined(_IOSM_INTERNAL) /** * Create I/O state machine instance. * @return I/O state machine */ -/*@only@*/ IOSM_t newIOSM(void) - /*@*/; +IOSM_t newIOSM(void); /** * Destroy I/O state machine instance. * @param iosm I/O state machine * @return always NULL */ -/*@null@*/ IOSM_t freeIOSM(/*@only@*/ /*@null@*/ IOSM_t iosm) - /*@modifies iosm @*/; +IOSM_t freeIOSM(IOSM_t iosm); #endif /** @@ -389,64 +345,52 @@ * @retval failedFile pointer to first file name that failed. * @return 0 on success */ -int iosmSetup(IOSM_t iosm, iosmFileStage goal, /*@null@*/ const char * afmt, +int iosmSetup(IOSM_t iosm, iosmFileStage goal, const char * afmt, const void * _ts, const void * _fi, FD_t cfd, - /*@out@*/ /*@null@*/ unsigned int * archiveSize, - /*@out@*/ /*@null@*/ const char ** failedFile) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, _ts, _fi, cfd, *archiveSize, *failedFile, - fileSystem, internalState @*/; + unsigned int * archiveSize, + const char ** failedFile); /** * Clean I/O state machine. * @param iosm I/O state machine * @return 0 on success */ -int iosmTeardown(IOSM_t iosm) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies iosm, fileSystem, internalState @*/; +int iosmTeardown(IOSM_t iosm); #if defined(_IOSM_INTERNAL) -/*@-exportlocal@*/ /** * Retrieve transaction set from I/O state machine iterator. * @param iosm I/O state machine * @return transaction set */ -void * iosmGetTs(const IOSM_t iosm) - /*@*/; +void * iosmGetTs(const IOSM_t iosm); /** * Retrieve transaction element file info from I/O state machine iterator. * @param iosm I/O state machine * @return transaction element file info */ -void * iosmGetFi(/*@partial@*/ const IOSM_t iosm) - RPM_GNUC_PURE - /*@*/; +void * iosmGetFi(const IOSM_t iosm) + RPM_GNUC_PURE; /** * Map next file path and action. * @param iosm I/O state machine */ -int iosmMapPath(IOSM_t iosm) - /*@modifies iosm @*/; +int iosmMapPath(IOSM_t iosm); /** * Map file stat(2) info. * @param iosm I/O state machine */ -int iosmMapAttrs(IOSM_t iosm) - /*@modifies iosm @*/; -/*@=exportlocal@*/ +int iosmMapAttrs(IOSM_t iosm); /** * Vector to iosmNext. */ -extern int (*_iosmNext) (IOSM_t iosm, iosmFileStage nstage) - /*@modifies iosm @*/; +extern int (*_iosmNext) (IOSM_t iosm, iosmFileStage nstage); #endif /** @@ -455,8 +399,7 @@ * @return Is file to be skipped? */ int iosmFileActionSkipped(iosmFileAction action) - RPM_GNUC_CONST - /*@*/; + RPM_GNUC_CONST; /** * File state machine driver. @@ -464,9 +407,7 @@ * @param nstage next stage * @return 0 on success */ -int iosmNext(IOSM_t iosm, iosmFileStage nstage) - /*@globals errno, h_errno, fileSystem, internalState @*/ - /*@modifies iosm, errno, fileSystem, internalState @*/; +int iosmNext(IOSM_t iosm, iosmFileStage nstage); /** * File state machine driver. @@ -474,11 +415,7 @@ * @param stage next stage * @return 0 on success */ -/*@-exportlocal@*/ -int iosmStage(/*@partial@*/ IOSM_t iosm, iosmFileStage stage) - /*@globals errno, h_errno, fileSystem, internalState @*/ - /*@modifies iosm, errno, fileSystem, internalState @*/; -/*@=exportlocal@*/ +int iosmStage(IOSM_t iosm, iosmFileStage stage); #ifdef __cplusplus } @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio.c ============================================================================ $ cvs diff -u -r1.230.2.39 -r1.230.2.40 rpmio.c --- rpm/rpmio/rpmio.c 17 Apr 2017 18:19:08 -0000 1.230.2.39 +++ rpm/rpmio/rpmio.c 17 Apr 2017 19:25:27 -0000 1.230.2.40 @@ -30,22 +30,17 @@ struct addrinfo *ai_next; /* Pointer to next in list. */ }; -/*@-exportheader -incondefs @*/ extern int getaddrinfo (__const char *__restrict __name, __const char *__restrict __service, __const struct addrinfo *__restrict __req, - /*@out@*/ struct addrinfo **__restrict __pai) - /*@modifies *__pai @*/; + struct addrinfo **__restrict __pai); extern int getnameinfo (__const struct sockaddr *__restrict __sa, - socklen_t __salen, /*@out@*/ char *__restrict __host, - socklen_t __hostlen, /*@out@*/ char *__restrict __serv, - socklen_t __servlen, unsigned int __flags) - /*@modifies __host, __serv @*/; - -extern void freeaddrinfo (/*@only@*/ struct addrinfo *__ai) - /*@modifies __ai @*/; -/*@=exportheader =incondefs @*/ + socklen_t __salen, char *__restrict __host, + socklen_t __hostlen, char *__restrict __serv, + socklen_t __servlen, unsigned int __flags); + +extern void freeaddrinfo (struct addrinfo *__ai); #else #include <netdb.h> /* XXX getaddrinfo et al */ #endif @@ -104,7 +99,6 @@ /* XXX HP-UX w/o -D_XOPEN_SOURCE needs */ #if !defined(HAVE_HERRNO) && (defined(hpux) || defined(__hpux) || defined(__LCLINT__)) -/*@unchecked@*/ extern int h_errno; #endif @@ -118,7 +112,6 @@ #if !defined(HAVE_INET_ATON) #define inet_aton(cp,inp) rpm_inet_aton(cp,inp) static int rpm_inet_aton(const char *cp, struct in_addr *inp) - /*@modifies *inp @*/ { long addr; @@ -151,12 +144,6 @@ #include "debug.h" -/*@access FILE @*/ /* XXX to permit comparison/conversion with void *. */ -/*@access urlinfo @*/ -/*@access FDSTAT_t @*/ -/*@access rpmxar @*/ -/*@access pgpDig @*/ - #define FDTO(fd) (fd ? ((FD_t)fd)->rd_timeoutsecs : -99) #define FDCPIOPOS(fd) (fd ? ((FD_t)fd)->fd_cpioPos : -99) @@ -168,7 +155,6 @@ /** */ -/*@unchecked@*/ #if _USE_LIBIO /* XXX FIXME: inverted logic */ int noLibio = 0; #else @@ -179,27 +165,22 @@ /** */ -/*@unchecked@*/ static int ftpTimeoutSecs = TIMEOUT_SECS; /** */ -/*@unchecked@*/ int _rpmio_debug = 0; /** */ -/*@unchecked@*/ int _av_debug = 0; /** */ -/*@unchecked@*/ int _ftp_debug = 0; /** */ -/*@unchecked@*/ int _dav_debug = 0; /* =============================================================== */ @@ -255,11 +236,9 @@ sprintf(be, "XZD %p fdno %d", fps->fp, fps->fdno); #endif } else if (fps->io == fpio) { - /*@+voidabstract@*/ sprintf(be, "%s %p(%d) fdno %d", (fps->fdno < 0 ? "LIBIO" : "FP"), fps->fp, fileno(((FILE *)fps->fp)), fps->fdno); - /*@=voidabstract@*/ } else { sprintf(be, "??? io %p fp %p fdno %d ???", fps->io, fps->fp, fps->fdno); @@ -297,14 +276,11 @@ fdSetOpen(fd, "fdDup", nfdno, 0); /* XXX bogus */ fdSetFdno(fd, nfdno); DBGIO(fd, (stderr, "<-- fdDup(%d) fd %p %s\n", fdno, (fd ? fd : NULL), fdbg(fd))); - /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/ + return fd; } -static inline /*@unused@*/ -int fdSeekNot(void * cookie, - /*@unused@*/ _libio_pos_t pos, - /*@unused@*/ int whence) - /*@*/ +static inline +int fdSeekNot(void * cookie, _libio_pos_t pos, int whence) { FD_t fd = c2f(cookie); FDSANE(fd); /* XXX keep gcc quiet */ @@ -314,8 +290,6 @@ /* =============================================================== */ static void fdFini(void * _fd) - /*@globals fileSystem @*/ - /*@modifies _fd, fileSystem @*/ { FD_t fd = (FD_t) _fd; int i; @@ -337,7 +311,6 @@ fd->ndigests = 0; fd->contentType = _free(fd->contentType); fd->contentDisposition = _free(fd->contentDisposition); -/*@-onlytrans@*/ fd->xar = rpmxarFree(fd->xar, "fdFini"); #ifdef WITH_NEON #ifndef NOTYET @@ -349,15 +322,11 @@ #endif #endif fd->dig = pgpDigFree(fd->dig); -/*@=onlytrans@*/ } -/*@unchecked@*/ /*@only@*/ /*@null@*/ rpmioPool _fdPool; -static FD_t fdGetPool(/*@null@*/ rpmioPool pool) - /*@globals _fdPool, fileSystem @*/ - /*@modifies pool, _fdPool, fileSystem @*/ +static FD_t fdGetPool(rpmioPool pool) { FD_t fd; @@ -371,8 +340,6 @@ return fd; } -/*@-incondefs@*/ -/*@null@*/ FD_t XfdNew(const char * msg, const char * fn, unsigned ln) { FD_t fd = fdGetPool(_fdPool); @@ -417,12 +384,8 @@ return (FD_t)rpmioLinkPoolItem((rpmioItem)fd, msg, fn, ln); } -/*@=incondefs@*/ -static ssize_t fdRead(void * cookie, /*@out@*/ char * buf, size_t count) - /*@globals errno, fileSystem, internalState @*/ - /*@modifies buf, errno, fileSystem, internalState @*/ - /*@requires maxSet(buf) >= (count - 1) @*/ +static ssize_t fdRead(void * cookie, char * buf, size_t count) { FD_t fd = c2f(cookie); ssize_t rc; @@ -463,8 +426,6 @@ } static ssize_t fdWrite(void * cookie, const char * buf, size_t count) - /*@globals errno, fileSystem, internalState @*/ - /*@modifies errno, fileSystem, internalState @*/ { FD_t fd = c2f(cookie); int fdno = fdFileno(fd); @@ -497,8 +458,6 @@ } static int fdSeek(void * cookie, _libio_pos_t pos, int whence) - /*@globals fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/ { #ifdef USE_COOKIE_SEEK_POINTER _IO_off64_t p = *pos; @@ -604,9 +563,7 @@ return rc; } -static int fdClose( /*@only@*/ void * cookie) - /*@globals errno, fileSystem, systemState, internalState @*/ - /*@modifies errno, fileSystem, systemState, internalState @*/ +static int fdClose(void * cookie) { FD_t fd; int fdno; @@ -712,9 +669,7 @@ #endif ); -static /*@null@*/ FD_t fdOpen(const char *path, int flags, mode_t mode) - /*@globals errno, fileSystem, internalState @*/ - /*@modifies errno, fileSystem, internalState @*/ +static FD_t fdOpen(const char *path, int flags, mode_t mode) { FD_t fd; int fdno; @@ -732,7 +687,7 @@ assert(fd != NULL); fd->flags = flags; DBGIO(fd, (stderr, "<--\tfdOpen(\"%s\",%x,0%o) %s\n", path, (unsigned)flags, (unsigned)mode, fdbg(fd))); - /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/ + return fd; } #ifdef NOTUSED @@ -752,13 +707,11 @@ } #endif -/*@-type@*/ /* LCL: function typedefs */ static struct FDIO_s fdio_s = { fdRead, fdWrite, fdSeek, fdClose, NULL, NULL, NULL, }; -/*@=type@*/ -FDIO_t fdio = /*@-compmempass@*/ &fdio_s /*@=compmempass@*/ ; +FDIO_t fdio = &fdio_s; int fdWritable(FD_t fd, int secs) { @@ -792,9 +745,7 @@ tvp->tv_usec = 0; } FD_SET(fdno, &wrfds); -/*@-compdef -nullpass@*/ rc = select(fdno + 1, NULL, &wrfds, NULL, tvp); -/*@=compdef =nullpass@*/ #endif /* HACK: EBADF on PUT chunked termination from ufdClose. */ @@ -804,15 +755,14 @@ switch (errno) { case EINTR: continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: return rc; - /*@notreached@*/ /*@switchbreak@*/ break; + break; } } return rc; } while (1); - /*@notreached@*/ } int fdReadable(FD_t fd, int secs) @@ -847,24 +797,21 @@ tvp->tv_usec = 0; } FD_SET(fdno, &rdfds); - /*@-compdef -nullpass@*/ rc = select(fdno + 1, &rdfds, NULL, NULL, tvp); - /*@=compdef =nullpass@*/ #endif if (rc < 0) { switch (errno) { case EINTR: continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: return rc; - /*@notreached@*/ /*@switchbreak@*/ break; + break; } } return rc; } while (1); - /*@notreached@*/ } int fdFgets(FD_t fd, char * buf, size_t len) @@ -888,13 +835,13 @@ case -1: /* error */ ec = -1; continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; case 0: /* timeout */ ec = -1; continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: /* data to read */ - /*@switchbreak@*/ break; + break; } errno = 0; @@ -908,9 +855,9 @@ switch (errno) { case EWOULDBLOCK: continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } if (_rpmio_debug) fprintf(stderr, "*** read: fd %p rc %d errno %d %s \"%s\"\n", fd, rc, errno, strerror(errno), buf); @@ -1012,16 +959,11 @@ #if !defined(HAVE_GETADDRINFO) #if !defined(USE_ALT_DNS) || !USE_ALT_DNS -static int mygethostbyname(const char * host, - /*@out@*/ struct in_addr * address) - /*@globals h_errno @*/ - /*@modifies *address @*/ +static int mygethostbyname(const char * host, struct in_addr * address) { struct hostent * hostinfo; - /*@-multithreaded @*/ hostinfo = gethostbyname(host); - /*@=multithreaded @*/ if (!hostinfo) return 1; memcpy(address, hostinfo->h_addr_list[0], sizeof(*address)); @@ -1029,24 +971,17 @@ } #endif -/*@-compdef@*/ /* FIX: address->s_addr undefined. */ -static int getHostAddress(const char * host, /*@out@*/ struct in_addr * address) - /*@globals errno, h_errno @*/ - /*@modifies *address, errno @*/ +static int getHostAddress(const char * host, struct in_addr * address) { #if 0 /* XXX workaround nss_foo module hand-off using valgrind. */ if (!strcmp(host, "localhost")) { - /*@-moduncon @*/ if (!inet_aton("127.0.0.1", address)) return FTPERR_BAD_HOST_ADDR; - /*@=moduncon @*/ } else #endif if (xisdigit(host[0])) { - /*@-moduncon @*/ if (!inet_aton(host, address)) return FTPERR_BAD_HOST_ADDR; - /*@=moduncon @*/ } else { if (mygethostbyname(host, address)) { errno = h_errno; @@ -1056,17 +991,13 @@ return 0; } -/*@=compdef@*/ #endif /* HAVE_GETADDRINFO */ static int tcpConnect(FD_t ctrl, const char * host, int port) - /*@globals fileSystem, internalState @*/ - /*@modifies ctrl, fileSystem, internalState @*/ { int fdno = -1; int rc; #ifdef HAVE_GETADDRINFO -/*@-unrecog@*/ struct addrinfo hints, *res, *res0; #ifndef NI_MAXSERV #define NI_MAXSERV 32 @@ -1097,7 +1028,7 @@ xx = getnameinfo(res->ai_addr, res->ai_addrlen, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST); fprintf(stderr,"++ connect [%s]:%d on fdno %d\n", - /*@-unrecog@*/ hbuf /*@=unrecog@*/, port, fdno); + hbuf, port, fdno); } break; } @@ -1105,7 +1036,6 @@ } if (rc < 0) goto errxit; -/*@=unrecog@*/ #else /* HAVE_GETADDRINFO */ struct sockaddr_in sin; @@ -1123,41 +1053,30 @@ break; } - /*@-internalglobs@*/ if (connect(fdno, (struct sockaddr *) &sin, sizeof(sin))) { rc = FTPERR_FAILED_CONNECT; break; } - /*@=internalglobs@*/ } while (0); if (rc < 0) goto errxit; if (_ftp_debug) -fprintf(stderr,"++ connect %s:%d on fdno %d\n", -/*@-unrecog -moduncon -evalorderuncon @*/ -inet_ntoa(sin.sin_addr) -/*@=unrecog =moduncon =evalorderuncon @*/ , -(int)ntohs(sin.sin_port), fdno); +fprintf(stderr,"++ connect %s:%d on fdno %d\n", inet_ntoa(sin.sin_addr) (int)ntohs(sin.sin_port), fdno); #endif /* HAVE_GETADDRINFO */ fdSetFdno(ctrl, (fdno >= 0 ? fdno : -1)); return 0; errxit: - /*@-observertrans@*/ fdSetSyserrno(ctrl, errno, ftpStrerror(rc)); - /*@=observertrans@*/ if (fdno >= 0) (void) close(fdno); return rc; } -static int checkResponse(void * _u, FD_t ctrl, - /*@out@*/ int *ecp, /*@out@*/ char ** str) - /*@globals fileSystem @*/ - /*@modifies ctrl, *ecp, *str, fileSystem @*/ +static int checkResponse(void * _u, FD_t ctrl, int *ecp, char ** str) { urlinfo u = (urlinfo) _u; char *buf; @@ -1206,7 +1125,7 @@ if (se > s && se[-1] == '\r') se[-1] = '\0'; if (*se == '\0') - /*@innerbreak@*/ break; + break; if (_ftp_debug) fprintf(stderr, "<- %s\n", s); @@ -1214,7 +1133,7 @@ /* HTTP: header termination on empty line */ if (*s == '\0') { moretodo = 0; - /*@innerbreak@*/ break; + break; } *se++ = '\0'; @@ -1235,7 +1154,7 @@ strncpy(errorCode, e, 3); errorCode[3] = '\0'; } - /*@innercontinue@*/ continue; + continue; } /* HTTP: look for "token: ..." */ @@ -1281,7 +1200,7 @@ if (!strncmp(s, "Allow:", ne)) { } #endif - /*@innercontinue@*/ continue; + continue; } /* HTTP: look for "<TITLE>501 ... </TITLE>" */ @@ -1317,9 +1236,7 @@ return ec; } -static int ftpCheckResponse(urlinfo u, /*@out@*/ char ** str) - /*@globals fileSystem @*/ - /*@modifies u, *str, fileSystem @*/ +static int ftpCheckResponse(urlinfo u, char ** str) { int ec = 0; int rc; @@ -1330,10 +1247,10 @@ switch (ec) { case 550: return FTPERR_FILE_NOT_FOUND; - /*@notreached@*/ break; + break; case 552: return FTPERR_NIC_ABORT_IN_PROGRESS; - /*@notreached@*/ break; + break; default: if (ec >= 400 && ec <= 599) { return FTPERR_BAD_SERVER_RESPONSE; @@ -1344,8 +1261,6 @@ } static int ftpCommand(urlinfo u, char ** str, ...) - /*@globals fileSystem, internalState @*/ - /*@modifies u, *str, fileSystem, internalState @*/ { va_list ap; int len = 0; @@ -1382,8 +1297,6 @@ } static int ftpLogin(urlinfo u) - /*@globals fileSystem, internalState @*/ - /*@modifies u, fileSystem, internalState @*/ { const char * host; const char * user; @@ -1418,9 +1331,8 @@ } if (fdFileno(u->ctrl) >= 0 && fdWritable(u->ctrl, 0) < 1) - /*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/ + (void) fdClose(u->ctrl); -/*@-usereleased@*/ if (fdFileno(u->ctrl) < 0) { rc = tcpConnect(u->ctrl, host, port); if (rc < 0) @@ -1439,21 +1351,14 @@ if ((rc = ftpCommand(u, NULL, "TYPE", "I", NULL))) goto errxit; - /*@-compdef@*/ return 0; - /*@=compdef@*/ errxit: - /*@-observertrans@*/ fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc)); - /*@=observertrans@*/ errxit2: if (fdFileno(u->ctrl) >= 0) - /*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/ - /*@-compdef@*/ + (void) fdClose(u->ctrl); return rc; - /*@=compdef@*/ -/*@=usereleased@*/ } int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg) @@ -1585,7 +1490,6 @@ } /* if (epsv) */ #ifdef HAVE_GETADDRINFO -/*@-unrecog@*/ { struct addrinfo hints, *res, *res0; char pbuf[NI_MAXSERV]; @@ -1627,14 +1531,12 @@ int criterr = 0; while (connect(fdFileno(data), res->ai_addr, (int)res->ai_addrlen) < 0) { if (errno == EINTR) - /*@innercontinue@*/ continue; + continue; criterr++; } if (criterr) { if (res->ai_addr) { -/*@-refcounttrans@*/ xx = fdClose(data); -/*@=refcounttrans@*/ continue; } else { rc = FTPERR_PASSIVE_ERROR; @@ -1649,18 +1551,15 @@ } freeaddrinfo(res0); } -/*@=unrecog@*/ #else /* HAVE_GETADDRINFO */ memset(&dataAddress, 0, sizeof(dataAddress)); dataAddress.sin_family = AF_INET; dataAddress.sin_port = htons(port); - /*@-moduncon@*/ if (!inet_aton(remoteIP, &dataAddress.sin_addr)) { rc = FTPERR_PASSIVE_ERROR; goto errxit; } - /*@=moduncon@*/ rc = socket(AF_INET, SOCK_STREAM, IPPROTO_IP); fdSetFdno(data, (rc >= 0 ? rc : -1)); @@ -1674,7 +1573,6 @@ /* XXX setsockopt SO_KEEPALIVE */ /* XXX setsockopt SO_TOS IPTOS_THROUGHPUT */ - /*@-internalglobs@*/ while (connect(fdFileno(data), (struct sockaddr *) &dataAddress, sizeof(dataAddress)) < 0) { @@ -1683,7 +1581,6 @@ rc = FTPERR_FAILED_DATA_CONNECT; goto errxit; } - /*@=internalglobs@*/ #endif /* HAVE_GETADDRINFO */ if (_ftp_debug) @@ -1703,22 +1600,17 @@ return 0; errxit: - /*@-observertrans@*/ fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc)); - /*@=observertrans@*/ if (fdFileno(data) >= 0) - /*@-refcounttrans@*/ (void) fdClose(data); /*@=refcounttrans@*/ + (void) fdClose(data); return rc; } #ifdef DYING -/*@unchecked@*/ /*@null@*/ static rpmCallbackFunction _urlNotify = NULL; -/*@unchecked@*/ /*@null@*/ static void * _urlNotifyData = NULL; -/*@unchecked@*/ static int _urlNotifyCount = -1; static void urlSetCallback(rpmCallbackFunction notify, void *notifyData, int notifyCount) { @@ -1738,10 +1630,8 @@ int notifier = -1; if (_urlNotify) { - /*@-noeffectuncon @*/ /* FIX: check rc */ - (void)(*_urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE, + (void) (*_urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE, 0, 0, NULL, _urlNotifyData); - /*@=noeffectuncon @*/ } #endif @@ -1767,10 +1657,8 @@ if (_urlNotify && _urlNotifyCount > 0) { int n = itemsCopied/_urlNotifyCount; if (n != notifier) { - /*@-noeffectuncon @*/ /* FIX: check rc */ - (void)(*_urlNotify) (NULL, RPMCALLBACK_INST_PROGRESS, + (void) (*_urlNotify) (NULL, RPMCALLBACK_INST_PROGRESS, itemsCopied, 0, NULL, _urlNotifyData); - /*@=noeffectuncon @*/ notifier = n; } } @@ -1782,19 +1670,15 @@ #ifdef DYING if (_urlNotify) { - /*@-noeffectuncon @*/ /* FIX: check rc */ - (void)(*_urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE, + (void) (*_urlNotify) (NULL, RPMCALLBACK_INST_OPEN_FILE, itemsCopied, itemsCopied, NULL, _urlNotifyData); - /*@=noeffectuncon @*/ } #endif return rc; } -static int urlConnect(const char * url, /*@out@*/ urlinfo * uret) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies *uret, fileSystem, internalState @*/ +static int urlConnect(const char * url, urlinfo * uret) { urlinfo u; int rc = 0; @@ -1807,10 +1691,8 @@ if ((fd = u->ctrl) == NULL) { fd = u->ctrl = fdNew("persist ctrl (urlConnect FTP)"); -/*@-usereleased@*/ fdSetOpen(u->ctrl, url, 0, 0); fdSetIo(u->ctrl, ufdio); -/*@=usereleased@*/ } assert(fd != NULL); @@ -1884,8 +1766,6 @@ #endif static int ftpAbort(urlinfo u, FD_t data) - /*@globals fileSystem, internalState @*/ - /*@modifies u, data, fileSystem, internalState @*/ { static unsigned char ipbuf[3] = { IAC, IP, IAC }; FD_t ctrl; @@ -1904,15 +1784,14 @@ DBGIO(0, (stderr, "-> ABOR\n")); -/*@-usereleased -compdef@*/ if (send(fdFileno(ctrl), ipbuf, sizeof(ipbuf), MSG_OOB) != sizeof(ipbuf)) { - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ + (void) fdClose(ctrl); return FTPERR_SERVER_IO_ERROR; } sprintf(u->buf, "%cABOR\r\n",(char) DM); if (fdWrite(ctrl, u->buf, 7) != 7) { - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ + (void) fdClose(ctrl); return FTPERR_SERVER_IO_ERROR; } @@ -1921,10 +1800,8 @@ tosecs = data->rd_timeoutsecs; data->rd_timeoutsecs = 10; if (fdReadable(data, data->rd_timeoutsecs) > 0) { -/*@-infloopsuncon@*/ while ((ufdio->read)(data, u->buf, u->bufAlloced) > 0) u->buf[0] = '\0'; -/*@=infloopsuncon@*/ } data->rd_timeoutsecs = tosecs; /* XXX ftp abort needs to close the data channel to receive status */ @@ -1944,12 +1821,9 @@ u->ctrl->rd_timeoutsecs = tosecs; return rc; -/*@=usereleased =compdef@*/ } static int ftpFileDone(urlinfo u, FD_t data) - /*@globals fileSystem @*/ - /*@modifies u, data, fileSystem @*/ { int rc = 0; @@ -1966,9 +1840,7 @@ } #ifndef WITH_NEON -static int httpResp(urlinfo u, FD_t ctrl, /*@out@*/ char ** str) - /*@globals fileSystem @*/ - /*@modifies ctrl, *str, fileSystem @*/ +static int httpResp(urlinfo u, FD_t ctrl, char ** str) { int ec = 0; int rc; @@ -1996,8 +1868,6 @@ } static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies ctrl, fileSystem, internalState @*/ { urlinfo u; const char * host; @@ -2026,10 +1896,9 @@ reopen: if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) { - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ + (void) fdClose(ctrl); } -/*@-usereleased@*/ if (fdFileno(ctrl) < 0) { rc = tcpConnect(ctrl, host, port); if (rc < 0) @@ -2086,7 +1955,7 @@ if (rc) { if (!retrying) { /* not HTTP_OK */ retrying = 1; - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ + (void) fdClose(ctrl); goto reopen; } goto errxit; @@ -2097,14 +1966,11 @@ return 0; errxit: - /*@-observertrans@*/ fdSetSyserrno(ctrl, errno, ftpStrerror(rc)); - /*@=observertrans@*/ errxit2: if (fdFileno(ctrl) >= 0) - /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/ + (void) fdClose(ctrl); return rc; -/*@=usereleased@*/ } #endif /* WITH_NEON */ @@ -2114,16 +1980,11 @@ FDSANE(fd); if (fd->u == NULL) return NULL; -/*@-retexpose@*/ return urlLink(fd->u, "ufdGetUrlinfo"); -/*@=retexpose@*/ } /* =============================================================== */ -static ssize_t ufdRead(void * cookie, /*@out@*/ char * buf, size_t count) - /*@globals fileSystem, internalState @*/ - /*@modifies buf, fileSystem, internalState @*/ - /*@requires maxSet(buf) >= (count - 1) @*/ +static ssize_t ufdRead(void * cookie, char * buf, size_t count) { FD_t fd = c2f(cookie); size_t bytesRead; @@ -2154,9 +2015,9 @@ case -1: /* error */ case 0: /* timeout */ return (ssize_t) total; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: /* data to read */ - /*@switchbreak@*/ break; + break; } rc = (int) fdRead(fd, buf + total, count - total); @@ -2165,17 +2026,17 @@ switch (errno) { case EWOULDBLOCK: continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } if (_rpmio_debug) fprintf(stderr, "*** read: rc %d errno %d %s \"%s\"\n", rc, errno, strerror(errno), buf); return rc; - /*@notreached@*/ break; + break; } else if (rc == 0) { return (ssize_t) total; - /*@notreached@*/ break; + break; } bytesRead = (size_t) rc; } @@ -2184,8 +2045,6 @@ } static ssize_t ufdWrite(void * cookie, const char * buf, size_t count) - /*@globals fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/ { FD_t fd = c2f(cookie); size_t bytesWritten; @@ -2219,9 +2078,9 @@ case -1: /* error */ case 0: /* timeout */ return (ssize_t) total; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: /* data to write */ - /*@switchbreak@*/ break; + break; } rc = (int) fdWrite(fd, buf + total, count - total); @@ -2230,17 +2089,17 @@ switch (errno) { case EWOULDBLOCK: continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } if (_rpmio_debug) fprintf(stderr, "*** write: rc %d errno %d %s \"%s\"\n", rc, errno, strerror(errno), buf); return rc; - /*@notreached@*/ break; + break; } else if (rc == 0) { return (ssize_t) total; - /*@notreached@*/ break; + break; } bytesWritten = (size_t) rc; } @@ -2249,8 +2108,6 @@ } static int ufdSeek(void * cookie, _libio_pos_t pos, int whence) - /*@globals fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/ { FD_t fd = c2f(cookie); @@ -2266,13 +2123,12 @@ case URL_IS_MONGO: /* XXX FIXME */ default: return -2; - /*@notreached@*/ break; + break; } return fdSeek(cookie, pos, whence); } -/*@-usereleased@*/ /* LCL: fd handling is tricky here. */ -int ufdClose( /*@only@*/ void * cookie) +int ufdClose(void * cookie) { FD_t fd = c2f(cookie); @@ -2281,7 +2137,6 @@ if (fd->u) { urlinfo u = (urlinfo) fd->u; -/*@-evalorder @*/ if (fd == u->data) fd = u->data = fdFree(fd, "grab data (ufdClose persist)"); else @@ -2290,17 +2145,14 @@ (void) urlFree(fd->u, "url (ufdClose)"); fd->u = NULL; u->ctrl = fdFree(u->ctrl, "grab ctrl (ufdClose)"); -/*@=evalorder @*/ if (urlType(u) == URL_IS_FTP) { /* XXX if not using libio, lose the fp from fpio */ { FILE * fp; - /*@+voidabstract -nullpass@*/ fp = fdGetFILE(fd); if (noLibio && fp) fdSetFp(fd, NULL); - /*@=voidabstract =nullpass@*/ } /* @@ -2327,16 +2179,12 @@ } else { int rc; /* XXX STOR et al require close before ftpFileDone */ - /*@-refcounttrans@*/ rc = fdClose(fd); - /*@=refcounttrans@*/ #if 0 /* XXX error exit from ufdOpen does not have this set */ assert(fd->ftpFileDoneNeeded != 0); #endif - /*@-compdef@*/ /* FIX: u->data undefined */ if (fd->ftpFileDoneNeeded) (void) ftpFileDone(u, fd); - /*@=compdef@*/ return rc; } } @@ -2356,22 +2204,18 @@ * "open data (httpReq)" ftp.c:435 */ -/*@-evalorder @*/ if (fd == u->ctrl) fd = u->ctrl = fdFree(fd, "open data (ufdClose HTTP persist ctrl)"); else if (fd == u->data) fd = u->data = fdFree(fd, "open data (ufdClose HTTP persist data)"); else fd = fdFree(fd, "open data (ufdClose HTTP)"); -/*@=evalorder @*/ /* XXX if not using libio, lose the fp from fpio */ { FILE * fp; - /*@+voidabstract -nullpass@*/ fp = fdGetFILE(fd); if (noLibio && fp) fdSetFp(fd, NULL); - /*@=voidabstract =nullpass@*/ } /* If content remains, then don't persist. */ @@ -2388,12 +2232,8 @@ } return fdClose(fd); } -/*@=usereleased@*/ -/*@-nullstate@*/ /* FIX: u->{ctrl,data}->u undef after XurlLink. */ -/*@null@*/ FD_t ftpOpen(const char *url, /*@unused@*/ int flags, - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo *uret) - /*@modifies *uret @*/ +FD_t ftpOpen(const char *url, int flags, mode_t mode, urlinfo *uret) { urlinfo u = NULL; FD_t fd = NULL; @@ -2408,12 +2248,10 @@ u->data = fdNew("persist data (ftpOpen)"); assert(u->data != NULL); -/*@-unqualifiedtrans@*/ if (u->data->u == NULL) fd = u->data = fdLink(u->data, "grab data (ftpOpen persist data)"); else fd = fdNew("grab data (ftpOpen)"); -/*@=unqualifiedtrans@*/ if (fd != NULL) { fdSetOpen(fd, url, flags, mode); @@ -2421,23 +2259,16 @@ fd->ftpFileDoneNeeded = 0; fd->rd_timeoutsecs = ftpTimeoutSecs; fd->contentLength = fd->bytesRemain = -1; -/*@-usereleased@*/ fd->u = urlLink(u, "url (ufdOpen FTP)"); -/*@=usereleased@*/ } exit: if (uret) *uret = u; - /*@-refcounttrans@*/ return fd; - /*@=refcounttrans@*/ } -/*@=nullstate@*/ -static /*@null@*/ FD_t ufdOpen(const char * url, int flags, mode_t mode) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/ +static FD_t ufdOpen(const char * url, int flags, mode_t mode) { FD_t fd = NULL; const char * cmd; @@ -2448,7 +2279,6 @@ if (_rpmio_debug) fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, (unsigned)flags, (unsigned)mode); -/*@-usereleased@*/ switch (ut) { case URL_IS_FTP: fd = ftpOpen(url, flags, mode, &u); @@ -2530,32 +2360,25 @@ (void) ufdClose(fd); return NULL; } -/*@=usereleased@*/ DBGIO(fd, (stderr, "<--\tufdOpen(\"%s\",%x,0%o) %s\n", url, (unsigned)flags, (unsigned)mode, fdbg(fd))); return fd; } -/*@-type@*/ /* LCL: function typedefs */ static struct FDIO_s ufdio_s = { ufdRead, ufdWrite, ufdSeek, ufdClose, NULL, NULL, NULL, }; -/*@=type@*/ -FDIO_t ufdio = /*@-compmempass@*/ &ufdio_s /*@=compmempass@*/ ; +FDIO_t ufdio = &ufdio_s; /* =============================================================== */ -/*@-type@*/ /* LCL: function typedefs */ static struct FDIO_s fpio_s = { ufdRead, ufdWrite, fdSeek, ufdClose, NULL, NULL, NULL, }; -/*@=type@*/ -FDIO_t fpio = /*@-compmempass@*/ &fpio_s /*@=compmempass@*/ ; +FDIO_t fpio = &fpio_s; /* =============================================================== */ -/*@observer@*/ static const char * getFdErrstr (FD_t fd) - /*@*/ { const char *errstr = NULL; @@ -2608,15 +2431,11 @@ DBGIO(fd, (stderr, "==> Fread(%p,%u,%u,%p) %s\n", buf, (unsigned)size, (unsigned)nmemb, (fd ? fd : NULL), fdbg(fd))); if (fdGetIo(fd) == fpio) { - /*@+voidabstract -nullpass@*/ rc = (int) fread(buf, size, nmemb, fdGetFILE(fd)); - /*@=voidabstract =nullpass@*/ return (size_t) rc; } - /*@-nullderef@*/ _read = FDIOVEC(fd, read); - /*@=nullderef@*/ rc = (int) (_read ? (*_read) (fd, (char *)buf, size * nmemb) : -2); return (size_t) rc; @@ -2631,15 +2450,11 @@ DBGIO(fd, (stderr, "==> Fwrite(%p,%u,%u,%p) %s\n", buf, (unsigned)size, (unsigned)nmemb, (fd ? fd : NULL), fdbg(fd))); if (fdGetIo(fd) == fpio) { - /*@+voidabstract -nullpass@*/ rc = (int) fwrite(buf, size, nmemb, fdGetFILE(fd)); - /*@=voidabstract =nullpass@*/ return (size_t) rc; } - /*@-nullderef@*/ _write = FDIOVEC(fd, write); - /*@=nullderef@*/ rc = (int) (_write ? _write(fd, (const char *)buf, size * nmemb) : -2); return (size_t) rc; @@ -2663,9 +2478,7 @@ if (fdGetIo(fd) == fpio) return fseek(fdGetFILE(fd), (long)offset, whence); - /*@-nullderef@*/ _seek = FDIOVEC(fd, seek); - /*@=nullderef@*/ rc = (_seek ? _seek(fd, pos, whence) : -2); return rc; @@ -2729,7 +2542,6 @@ FDSANE(fd); DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", (fd ? fd : NULL), fdbg(fd))); -/*@-usereleased@*/ fd = fdLink(fd, "Fclose"); if (fd != NULL) while (fd->nfps >= 0) { @@ -2739,10 +2551,8 @@ FILE *fp; int fpno; - /*@+voidabstract -nullpass@*/ fp = fdGetFILE(fd); fpno = fileno(fp); - /*@=voidabstract =nullpass@*/ /* XXX persistent HTTP/1.1 returns the previously opened fp */ if (fd->nfps > 0 && fpno == -1 && fd->fps[fd->nfps-1].io == ufdio && @@ -2754,9 +2564,7 @@ if (fp) rc = fflush(fp); fd->nfps--; - /*@-refcounttrans@*/ rc = ufdClose(fd); - /*@=refcounttrans@*/ if (fdGetFdno(fd) >= 0) break; if (!fd->persist) @@ -2771,17 +2579,11 @@ fd->req = NULL; #endif fd->nfps--; -/*@-exposetrans@*/ fdSetFp(fd, fp); -/*@=exposetrans@*/ -/*@-refcounttrans@*/ (void) fdClose(fd); -/*@=refcounttrans@*/ fdSetFp(fd, NULL); fd->nfps++; -/*@-refcounttrans@*/ (void) fdClose(fd); -/*@=refcounttrans@*/ } else rc = fclose(fp); } @@ -2797,9 +2599,7 @@ } } } else { - /*@-nullderef@*/ fdio_close_function_t _close = FDIOVEC(fd, close); - /*@=nullderef@*/ rc = _close(fd); } if (fd == NULL || fd->nfps == 0) /* XXX fd != NULL ever */ @@ -2810,7 +2610,6 @@ } fd = fdFree(fd, "Fclose"); return ec; -/*@=usereleased@*/ } /** @@ -2837,10 +2636,9 @@ * - HACK: '?' debug I/O + refcnt */ static inline void cvtfmode (const char *m, - /*@out@*/ char *stdio, size_t nstdio, - /*@out@*/ char *other, size_t nother, - /*@out@*/ const char **end, /*@out@*/ int * f) - /*@modifies *stdio, *other, *end, *f @*/ + char *stdio, size_t nstdio, + char *other, size_t nother, + const char **end, int * f) { int flags = 0; char c; @@ -2861,20 +2659,20 @@ default: *stdio = '\0'; return; - /*@notreached@*/ break; + break; } m++; while ((c = *m++) != '\0') { switch (c) { case '.': - /*@switchbreak@*/ break; + break; case '+': flags &= ~(O_RDONLY|O_WRONLY); flags |= O_RDWR; if (--nstdio > 0) *stdio++ = c; continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; case 'x': /* glibc: don't clobber */ flags |= O_EXCL; /*@fallthrough@*/ @@ -2885,11 +2683,11 @@ if (--nstdio > 0) *stdio++ = c; #endif continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; case 'b': if (--nstdio > 0) *stdio++ = c; continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; case 'D': flags |= O_DSYNC; goto other; @@ -2910,7 +2708,7 @@ other: if (--nother > 0) *other++ = c; continue; - /*@notreached@*/ /*@switchbreak@*/ break; + break; } break; } @@ -2951,7 +2749,7 @@ (void) stpcpy( stpcpy(zstdio, stdio), other); if (end == NULL && other[0] == '\0') - /*@-refcounttrans -retalias@*/ return fd; /*@=refcounttrans =retalias@*/ + return fd; if (end && *end) { if (!strcmp(end, "fdio")) { @@ -2959,16 +2757,12 @@ #if defined(WITH_ZLIB) } else if (!strcmp(end, "gzdio")) { iof = gzdio; - /*@-internalglobs@*/ fd = iof->_fdopen(fd, zstdio); - /*@=internalglobs@*/ #endif #if defined(WITH_BZIP2) } else if (!strcmp(end, "bzdio")) { iof = bzdio; - /*@-internalglobs@*/ fd = iof->_fdopen(fd, zstdio); - /*@=internalglobs@*/ #endif #if defined(WITH_XZ) } else if (!strcmp(end, "lzdio")) { @@ -2985,18 +2779,14 @@ if (noLibio) { int fdno = Fileno(fd); FILE * fp = fdopen(fdno, stdio); -/*@+voidabstract -nullpass@*/ if (_rpmio_debug) fprintf(stderr, "*** Fdopen fpio fp %p\n", (void *)fp); -/*@=voidabstract =nullpass@*/ if (fp == NULL) return NULL; /* XXX gzdio/bzdio use fp for private data */ - /*@+voidabstract@*/ if (fdGetFp(fd) == NULL) fdSetFp(fd, fp); fdPush(fd, fpio, fp, fdno); /* Push fpio onto stack */ - /*@=voidabstract@*/ } } } else if (other[0] != '\0') { @@ -3005,14 +2795,12 @@ if (*end == '\0') { #if defined(WITH_ZLIB) iof = gzdio; - /*@-internalglobs@*/ fd = iof->_fdopen(fd, zstdio); - /*@=internalglobs@*/ #endif } } if (iof == NULL) - /*@-refcounttrans -retalias@*/ return fd; /*@=refcounttrans =retalias@*/ + return fd; if (!noLibio) { FILE * fp = NULL; @@ -3048,19 +2836,15 @@ if (fp) { /* XXX gzdio/bzdio use fp for private data */ - /*@+voidabstract -nullpass@*/ if (fdGetFp(fd) == NULL) fdSetFp(fd, fp); fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */ - /*@=voidabstract =nullpass@*/ fd = fdLink(fd, "fopencookie"); } } -/*@-refcounttrans -retalias -usereleased @*/ DBGIO(fd, (stderr, "<== Fdopen(%p,\"%s\") returns fd %p %s\n", ofd, fmode, (fd ? fd : NULL), fdbg(fd))); return fd; -/*@=refcounttrans =retalias =usereleased @*/ } FD_t Fopen(const char *path, const char *_fmode) @@ -3074,9 +2858,7 @@ if (path == NULL || _fmode == NULL) goto exit; -/*@-globs -mods@*/ fmode = rpmExpand(_fmode, NULL); -/*@=globs =mods@*/ if (_rpmio_debug) fprintf(stderr, "==> Fopen(%s, %s)\n", path, fmode); @@ -3120,16 +2902,14 @@ case URL_IS_MONGO: /* XXX FIXME */ default: goto exit; - /*@notreached@*/ break; + break; } /* XXX persistent HTTP/1.1 returns the previously opened fp */ if (isHTTP && ((fp = (FILE *) fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0 || fd->req != NULL)) { - /*@+voidabstract@*/ fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */ - /*@=voidabstract@*/ goto exit; } } @@ -3149,9 +2929,7 @@ void * vh; if (fd == NULL) return -1; if (fdGetIo(fd) == fpio) - /*@+voidabstract -nullpass@*/ return fflush(fdGetFILE(fd)); - /*@=voidabstract =nullpass@*/ vh = fdGetFp(fd); #if defined(WITH_ZLIB) @@ -3186,9 +2964,7 @@ int ec; if (fps->io == fpio) { - /*@+voidabstract -nullpass@*/ ec = ferror(fdGetFILE(fd)); - /*@=voidabstract =nullpass@*/ #if defined(WITH_ZLIB) } else if (fps->io == gzdio) { ec = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0; @@ -3271,9 +3047,9 @@ switch(errno) { default: return errno; - /*@notreached@*/ /*@switchbreak@*/ break; + break; case ENOENT: - /*@switchbreak@*/ break; + break; } rc = Mkdir(d, mode); if (rc) @@ -3297,7 +3073,6 @@ } #define _PATH "/bin:/usr/bin:/sbin:/usr/sbin" -/*@unchecked@*/ /*@observer@*/ static const char *_path = _PATH; #define alloca_strdup(_s) strcpy((char *)alloca(strlen(_s)+1), (_s)) @@ -3390,7 +3165,7 @@ /* Find next element, terminate current element. */ for (re = r; (re = strchr(re, ':')) != NULL; re++) { if (!(re[1] == '/' && re[2] == '/')) - /*@innerbreak@*/ break; + break; } if (re && *re == ':') *re++ = '\0'; @@ . patch -p0 <<'@@ .' Index: rpm/rpmio/rpmio_internal.h ============================================================================ $ cvs diff -u -r2.127.2.8 -r2.127.2.9 rpmio_internal.h --- rpm/rpmio/rpmio_internal.h 17 Apr 2017 18:19:08 -0000 2.127.2.8 +++ rpm/rpmio/rpmio_internal.h 17 Apr 2017 19:25:27 -0000 2.127.2.9 @@ -15,15 +15,10 @@ #include <rpmxar.h> -/*@access pgpDig @*/ /* XXX FIXME: (by refactoring to foo.c) */ -/*@access rpmxar @*/ /* XXX FIXME: (by refactoring to foo.c) */ - /** \ingroup rpmio */ typedef struct _FDSTACK_s { -/*@exposed@*/ FDIO_t io; -/*@dependent@*/ void * fp; int fdno; } FDSTACK_t; @@ -85,10 +80,8 @@ int nfps; /* no. of stacked file handles */ FDSTACK_t fps[8]; /* stacked file handles */ -/*@dependent@*/ /*@relnull@*/ void * u; /* ufdio: URL info */ int ut; /* ufdio: URL type */ -/*@relnull@*/ void * req; /* ufdio: HTTP request */ int rd_timeoutsecs; /* ufdRead: per FD_t timer */ @@ -98,7 +91,6 @@ int wr_chunked; /* ufdio: */ int syserrno; /* last system errno encountered */ -/*@observer@*/ const void *errcookie; /* gzdio/bzdio/ufdio: */ /*null@*/ @@ -106,9 +98,7 @@ int oflags; mode_t omode; -/*@refcounted@*/ /*@relnull@*/ rpmxar xar; /* xar archive wrapper */ -/*@refcounted@*/ /*@relnull@*/ pgpDig dig; /* signature parameters */ FDSTAT_t stats; /* I/O statistics */ @@ -123,20 +113,13 @@ time_t lastModified; /* ufdio: (HTTP) */ int ftpFileDoneNeeded; /* ufdio: (FTP) */ unsigned long long fd_cpioPos; /* cpio: */ -#if defined(__LCLINT__) -/*@refs@*/ - int nrefs; /*!< (unused) keep splint happy */ -#endif }; -/*@access FD_t@*/ #define FDSANE(fd) assert(fd != NULL && fd->magic == FDMAGIC) #define DBG(_fd, _flag, _fmt) \ - /*@-modfilesys@*/ \ if (_rpmio_debug || ((_fd) ? RPMFD_ISSET(((FD_t)(_fd)), _flag) : 0)) \ - fprintf _fmt \ - /*@=modfilesys@*/ + fprintf _fmt #define DBGIO(_fd, _fmt) DBG((_fd), DEBUGIO, _fmt) #define DBGREFS(_fd, _fmt) DBG((_fd), DEBUGREFS, _fmt) @@ -147,45 +130,32 @@ /** \ingroup rpmio */ -/*@observer@*/ const char * fdbg(/*@null@*/ FD_t fd) - /*@*/; +const char * fdbg(FD_t fd); /** \ingroup rpmio */ -int fdFgets(FD_t fd, char * buf, size_t len) - /*@globals errno, fileSystem @*/ - /*@modifies *buf, fd, errno, fileSystem @*/; +int fdFgets(FD_t fd, char * buf, size_t len); /** \ingroup rpmio */ -/*@null@*/ FD_t ftpOpen(const char *url, /*@unused@*/ int flags, - /*@unused@*/ mode_t mode, /*@out@*/ urlinfo *uret) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies *uret, fileSystem, internalState @*/; +FD_t ftpOpen(const char *url, int flags, mode_t mode, urlinfo *uret); /** \ingroup rpmio */ -int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg) - /*@globals fileSystem, internalState @*/ - /*@modifies data, fileSystem, internalState @*/; +int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg); /** \ingroup rpmio */ -int ftpCmd(const char * cmd, const char * url, const char * arg2) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/; +int ftpCmd(const char * cmd, const char * url, const char * arg2); /** \ingroup rpmio */ -int ufdClose( /*@only@*/ void * cookie) - /*@globals fileSystem, internalState @*/ - /*@modifies cookie, fileSystem, internalState @*/; +int ufdClose(void * cookie); /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdSetOpen(FD_t fd, const char * opath, int oflags, mode_t omode) - /*@modifies fd @*/ { FDSANE(fd); if (fd->opath != NULL) { @@ -199,12 +169,9 @@ /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -/*@null@*/ /*@observer@*/ const char * fdGetOPath(FD_t fd) - /*@*/ { FDSANE(fd); return fd->opath; @@ -213,9 +180,8 @@ /** \ingroup rpmio */ RPM_GNUC_PURE -/*@unused@*/ static inline +static inline int fdGetFlags(FD_t fd) - /*@*/ { FDSANE(fd); return fd->flags; @@ -223,9 +189,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline int fdGetOFlags(FD_t fd) - /*@*/ { FDSANE(fd); return fd->oflags; @@ -233,9 +198,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline mode_t fdGetOMode(FD_t fd) - /*@*/ { FDSANE(fd); return fd->omode; @@ -243,69 +207,48 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdSetDig(FD_t fd, pgpDig dig) - /*@globals fileSystem @*/ - /*@modifies fd, dig, fileSystem @*/ { FDSANE(fd); -/*@-assignexpose -castexpose @*/ fd->dig = pgpDigFree(fd->dig); fd->dig = pgpDigLink(dig); -/*@=assignexpose =castexpose @*/ } /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -/*@null@*/ pgpDig fdGetDig(FD_t fd) - /*@*/ { FDSANE(fd); - /*@-compdef -retexpose -refcounttrans -usereleased @*/ return fd->dig; - /*@=compdef =retexpose =refcounttrans =usereleased @*/ } /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdSetXAR(FD_t fd, rpmxar xar) - /*@globals fileSystem @*/ - /*@modifies fd, xar, fileSystem @*/ { FDSANE(fd); -/*@-assignexpose -castexpose @*/ fd->xar = rpmxarLink(xar, "fdSetXAR"); -/*@=assignexpose =castexpose @*/ } /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -/*@null@*/ rpmxar fdGetXAR(FD_t fd) - /*@*/ { FDSANE(fd); - /*@-compdef -refcounttrans -retexpose -usereleased @*/ return fd->xar; - /*@=compdef =refcounttrans =retexpose =usereleased @*/ } /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -/*@null@*/ FDIO_t fdGetIo(FD_t fd) - /*@*/ { FDSANE(fd); return fd->fps[fd->nfps].io; @@ -313,41 +256,28 @@ /** \ingroup rpmio */ -/*@-nullstate@*/ /* FIX: io may be NULL */ -/*@unused@*/ static inline -void fdSetIo(FD_t fd, /*@kept@*/ /*@null@*/ FDIO_t io) - /*@modifies fd @*/ +static inline +void fdSetIo(FD_t fd, FDIO_t io) { FDSANE(fd); - /*@-assignexpose@*/ fd->fps[fd->nfps].io = io; - /*@=assignexpose@*/ } -/*@=nullstate@*/ /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -/*@exposed@*/ /*@dependent@*/ /*@null@*/ FILE * fdGetFILE(FD_t fd) - /*@*/ { FDSANE(fd); - /*@+voidabstract@*/ return ((FILE *)fd->fps[fd->nfps].fp); - /*@=voidabstract@*/ } /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -/*@exposed@*/ /*@dependent@*/ /*@null@*/ void * fdGetFp(FD_t fd) - /*@*/ { FDSANE(fd); return fd->fps[fd->nfps].fp; @@ -355,25 +285,18 @@ /** \ingroup rpmio */ -/*@-nullstate@*/ /* FIX: fp may be NULL */ -/*@unused@*/ static inline -void fdSetFp(FD_t fd, /*@kept@*/ /*@null@*/ void * fp) - /*@modifies fd @*/ +static inline +void fdSetFp(FD_t fd, void * fp) { FDSANE(fd); - /*@-assignexpose@*/ fd->fps[fd->nfps].fp = fp; - /*@=assignexpose@*/ } -/*@=nullstate@*/ /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline int fdGetFdno(FD_t fd) - /*@*/ { FDSANE(fd); return fd->fps[fd->nfps].fdno; @@ -381,9 +304,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdSetFdno(FD_t fd, int fdno) - /*@modifies fd @*/ { FDSANE(fd); fd->fps[fd->nfps].fdno = fdno; @@ -391,9 +313,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdSetContentLength(FD_t fd, ssize_t contentLength) - /*@modifies fd @*/ { FDSANE(fd); fd->contentLength = fd->bytesRemain = contentLength; @@ -401,9 +322,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno) - /*@modifies fd @*/ { FDSANE(fd); if (fd->nfps >= (int)(sizeof(fd->fps)/sizeof(fd->fps[0]) - 1)) @@ -416,9 +336,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdPop(FD_t fd) - /*@modifies fd @*/ { FDSANE(fd); if (fd->nfps < 0) return; @@ -430,9 +349,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline /*@null@*/ -rpmop fdstat_op(/*@null@*/ FD_t fd, fdOpX opx) - /*@*/ +static inline +rpmop fdstat_op(FD_t fd, fdOpX opx) { rpmop op = NULL; @@ -443,10 +361,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline -void fdstat_enter(/*@null@*/ FD_t fd, int opx) - /*@globals internalState @*/ - /*@modifies internalState @*/ +static inline +void fdstat_enter(FD_t fd, int opx) { if (fd == NULL) return; if (fd->stats != NULL) @@ -455,10 +371,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline -void fdstat_exit(/*@null@*/ FD_t fd, int opx, ssize_t rc) - /*@globals internalState @*/ - /*@modifies fd, internalState @*/ +static inline +void fdstat_exit(FD_t fd, int opx, ssize_t rc) { if (fd == NULL) return; if (rc == -1) @@ -541,22 +455,18 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline -void fdSetSyserrno(FD_t fd, int syserrno, /*@kept@*/ const void * errcookie) - /*@modifies fd @*/ +static inline +void fdSetSyserrno(FD_t fd, int syserrno, const void * errcookie) { FDSANE(fd); fd->syserrno = syserrno; - /*@-assignexpose@*/ fd->errcookie = errcookie; - /*@=assignexpose@*/ } /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline int fdGetRdTimeoutSecs(FD_t fd) - /*@*/ { FDSANE(fd); return fd->rd_timeoutsecs; @@ -564,11 +474,9 @@ /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline unsigned long long fdGetCpioPos(FD_t fd) - /*@*/ { FDSANE(fd); return fd->fd_cpioPos; @@ -576,9 +484,8 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdSetCpioPos(FD_t fd, long int cpioPos) - /*@modifies fd @*/ { FDSANE(fd); fd->fd_cpioPos = cpioPos; @@ -586,33 +493,24 @@ /** \ingroup rpmio */ -/*@mayexit@*/ -/*@unused@*/ RPM_GNUC_PURE static inline -FD_t c2f(/*@null@*/ void * cookie) - /*@*/ +FD_t c2f(void * cookie) { - /*@-castexpose@*/ FD_t fd = (FD_t) cookie; - /*@=castexpose@*/ FDSANE(fd); - /*@-refcounttrans -retalias@*/ return fd; /*@=refcounttrans =retalias@*/ + return fd; } /** \ingroup rpmio * Attach digest to fd. */ -/*@unused@*/ static inline +static inline void fdInitDigest(FD_t fd, pgpHashAlgo hashalgo, int _flags) - /*@globals internalState @*/ - /*@modifies fd, internalState @*/ { rpmDigestFlags flags = (rpmDigestFlags) _flags; -/*@+voidabstract@*/ fd->digests = (DIGEST_CTX *) realloc(fd->digests, (fd->ndigests + 1) * sizeof(*fd->digests)); -/*@=voidabstract@*/ fdstat_enter(fd, FDSTAT_DIGEST); fd->digests[fd->ndigests++] = rpmDigestInit(hashalgo, flags); fdstat_exit(fd, FDSTAT_DIGEST, 0); @@ -621,10 +519,8 @@ /** \ingroup rpmio * Attach digest to fd. */ -/*@unused@*/ static inline +static inline void fdInitHmac(FD_t fd, const void * key, size_t keylen) - /*@globals internalState @*/ - /*@modifies internalState @*/ { if (fd->digests != NULL && fd->ndigests > 0 && key != NULL) (void) rpmHmacInit(fd->digests[fd->ndigests-1], key, keylen); @@ -633,10 +529,8 @@ /** \ingroup rpmio * Update digest(s) attached to fd. */ -/*@unused@*/ static inline +static inline void fdUpdateDigests(FD_t fd, const unsigned char * buf, ssize_t buflen) - /*@globals internalState @*/ - /*@modifies fd, internalState @*/ { int i; @@ -657,13 +551,9 @@ /** \ingroup rpmio */ -/*@unused@*/ static inline +static inline void fdFiniDigest(FD_t fd, pgpHashAlgo hashalgo, - /*@null@*/ /*@out@*/ void * datap, - /*@null@*/ /*@out@*/ size_t * lenp, - int asAscii) - /*@globals internalState @*/ - /*@modifies fd, *datap, *lenp, internalState @*/ + void * datap, size_t * lenp, int asAscii) { int i = -1; @@ -689,13 +579,10 @@ /** \ingroup rpmio */ -/*@-mustmod@*/ -/*@unused@*/ static inline +static inline void fdStealDigest(FD_t fd, pgpDig dig) - /*@modifies fd, dig @*/ { int i; -/*@-type@*/ /* FIX: getters for pgpDig internals */ if (fd->ndigests > 0) for (i = fd->ndigests - 1; i >= 0; i--) { DIGEST_CTX ctx = fd->digests[i]; @@ -703,45 +590,35 @@ switch (rpmDigestAlgo(ctx)) { case PGPHASHALGO_MD5: assert(dig->md5ctx == NULL); -/*@-assignexpose -onlytrans@*/ dig->md5ctx = ctx; -/*@=assignexpose =onlytrans@*/ fd->digests[i] = NULL; - /*@switchbreak@*/ break; + break; case PGPHASHALGO_SHA1: case PGPHASHALGO_RIPEMD160: case PGPHASHALGO_SHA256: case PGPHASHALGO_SHA384: case PGPHASHALGO_SHA512: assert(dig->hsha == NULL); -/*@-assignexpose -onlytrans@*/ dig->hsha = ctx; -/*@=assignexpose =onlytrans@*/ fd->digests[i] = NULL; - /*@switchbreak@*/ break; + break; default: - /*@switchbreak@*/ break; + break; } } -/*@=type@*/ } -/*@=mustmod@*/ -/*@-shadow@*/ /** \ingroup rpmio */ -/*@unused@*/ RPM_GNUC_PURE static inline -int fdFileno(/*@null@*/ void * cookie) - /*@*/ +int fdFileno(void * cookie) { FD_t fd; if (cookie == NULL) return -2; fd = c2f(cookie); return fd->fps[0].fdno; } -/*@=shadow@*/ #ifdef __cplusplus } @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org