From c15266f569c77cbddc9b72c0fb83befcf00a0ab6 Mon Sep 17 00:00:00 2001 From: jbj Date: Sat, 9 Oct 2004 17:44:27 +0000 Subject: [PATCH] Splint fiddles. CVS patchset: 7436 CVS date: 2004/10/09 17:44:27 --- rpmdb/Makefile.am | 2 +- rpmdb/header.c | 10 ++++++++-- rpmdb/rpmdb.c | 5 ++++- system.h | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/rpmdb/Makefile.am b/rpmdb/Makefile.am index 95e0fd1..277031d 100644 --- a/rpmdb/Makefile.am +++ b/rpmdb/Makefile.am @@ -67,7 +67,7 @@ tagtbl.c: Makefile.am $(top_srcdir)/lib/rpmlib.h @echo '/*@observer@*/ /*@unchecked@*/' >> $@ @echo 'static const struct headerTagTableEntry_s rpmTagTbl[] = {' >> $@ ${AWK} '/(RPMTAG_[A-Z0-9]*)[ \t]+([0-9]*)/ && !/internal/ { tt = "NULL"; if ($$5 == "c") {tt = "CHAR"} if ($$5 == "h") {tt = "INT16"} if ($$5 == "i") {tt = "INT32"} if ($$5 == "l") {tt = "INT64"} if ($$5 == "s") {tt = "STRING"} if ($$5 == "x") {tt = "BIN"} if ($$5 == "s[]") {tt = "STRING_ARRAY"} if ($$5 == "s{}") {tt = "I18NSTRING"} if ($$2 == "=") { printf("\t{ \"%s\", %s RPM_%s_TYPE },\n", $$1, $$3, tt) } else { printf("\t{ \"%s\", %s, RPM_%s_TYPE },\n", $$2, $$3, tt) } }' < $(top_srcdir)/lib/rpmlib.h >> $@ - @echo ' { NULL, 0 }' >> $@ + @echo ' { NULL, 0, 0 }' >> $@ @echo '};' >> $@ @echo '' >> $@ @echo '/*@observer@*/ /*@unchecked@*/' >> $@ diff --git a/rpmdb/header.c b/rpmdb/header.c index f5bc72c..5e1e0dd 100644 --- a/rpmdb/header.c +++ b/rpmdb/header.c @@ -2506,7 +2506,9 @@ static char * hsaReserve(headerSprintfArgs hsa, size_t need) * @param val tag value to find * @return tag name, NULL on not found */ +/*@observer@*/ /*@null@*/ static const char * myTagName(headerTagTableEntry tbl, int val) + /*@*/ { static char name[128]; const char * s; @@ -2535,6 +2537,7 @@ static const char * myTagName(headerTagTableEntry tbl, int val) * @return tag value, 0 on not found */ static int myTagValue(headerTagTableEntry tbl, const char * name) + /*@*/ { for (; tbl->name != NULL; tbl++) { if (!xstrcasecmp(tbl->name, name)) @@ -3343,11 +3346,14 @@ static char * singleSprintf(headerSprintfArgs hsa, sprintfToken token, if (isxml) { const char * tagN = myTagName(hsa->tags, spft->u.tag.tag); - need = strlen(tagN) + sizeof(" \n") - 1; + need = sizeof(" \n") - 1; + if (tagN != NULL) + need += strlen(tagN); t = hsaReserve(hsa, need); /*@-boundswrite@*/ te = stpcpy(t, " \n"); /*@=boundswrite@*/ hsa->vallen += (te - t); diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 4e15d03..c2dad54 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -14,7 +14,7 @@ /*@=noparams@*/ #if defined(__LCLINT__) /*@-declundef -exportheader -redecl @*/ /* LCL: missing annotation */ -extern int fnmatch (const char *pattern, const char *string, int flags) +extern int fnmatch (const char *__pattern, const char *__name, int __flags) /*@*/; /*@=declundef =exportheader =redecl @*/ #endif @@ -65,6 +65,7 @@ int dbiTagsMax = 0; /* We use this to comunicate back to the the rpm transaction * what their install instance was on a rpmdbAdd(). */ +/*@unchecked@*/ unsigned int myinstall_instance = 0; /* Bit mask macros. */ @@ -375,9 +376,11 @@ union _dbswap { }; #define _DBSWAP(_a) \ +/*@-bounds@*/ \ { unsigned char _b, *_c = (_a).uc; \ _b = _c[3]; _c[3] = _c[0]; _c[0] = _b; \ _b = _c[2]; _c[2] = _c[1]; _c[1] = _b; \ +/*@=bounds@*/ \ } /** diff --git a/system.h b/system.h index a751fdc..c23e025 100644 --- a/system.h +++ b/system.h @@ -597,7 +597,7 @@ extern int glob_pattern_p (const char *__pattern, int __quote) /*@=constuse@*/ #endif -extern int fnmatch (const char *pattern, const char *string, int flags) +extern int fnmatch (const char *__pattern, const char *__name, int __flags) /*@*/; /*@=declundef =incondefs @*/ #endif -- 2.7.4