summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-02-05 12:31:32 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-02-05 12:31:32 +0200
commite7ac5fb183c4c0e5762d7f18c1c19c03fcdc2b3c (patch)
tree0fc441c19b03cbd26c17465a42f5e64b4a6a7373
parent630a5a4c1a34f12ae264cba870005de0858353e6 (diff)
downloadlibrpm-tizen-e7ac5fb183c4c0e5762d7f18c1c19c03fcdc2b3c.tar.gz
librpm-tizen-e7ac5fb183c4c0e5762d7f18c1c19c03fcdc2b3c.tar.bz2
librpm-tizen-e7ac5fb183c4c0e5762d7f18c1c19c03fcdc2b3c.zip
Add rpm_mode_t type, use where spotted
- bring the types under some sort of control, previously mixture of int16_t, uint16_t and unsigned short was used..
-rw-r--r--build/files.c4
-rw-r--r--build/rpmfc.c6
-rw-r--r--build/rpmfc.h2
-rw-r--r--lib/query.c2
-rw-r--r--lib/rpmfi.c12
-rw-r--r--lib/rpmfi.h4
-rw-r--r--lib/rpmfi_internal.h2
-rw-r--r--lib/rpmtypes.h1
-rw-r--r--lib/transaction.c8
-rw-r--r--lib/verify.c12
10 files changed, 27 insertions, 26 deletions
diff --git a/build/files.c b/build/files.c
index 1c99c123a..985830a1b 100644
--- a/build/files.c
+++ b/build/files.c
@@ -1145,8 +1145,8 @@ static void genCpioListAndHeader(FileList fl,
(void) headerAddOrAppendEntry(h, RPMTAG_FILEMTIMES, RPM_INT32_TYPE,
&(flp->fl_mtime), 1);
}
- if (sizeof(flp->fl_mode) != sizeof(uint16_t)) {
- uint16_t pmode = (uint16_t)flp->fl_mode;
+ if (sizeof(flp->fl_mode) != sizeof(rpm_mode_t)) {
+ rpm_mode_t pmode = (rpm_mode_t)flp->fl_mode;
(void) headerAddOrAppendEntry(h, RPMTAG_FILEMODES, RPM_INT16_TYPE,
&(pmode), 1);
} else {
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 79ee500d1..2c286caa9 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -1215,7 +1215,7 @@ assert(dix >= 0);
return 0;
}
-rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode)
+rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode)
{
ARGV_t fcav = NULL;
ARGV_t dav;
@@ -1254,7 +1254,7 @@ assert(xx != -1); /* XXX figger a proper return path. */
for (fc->ix = 0; fc->ix < fc->nfiles; fc->ix++) {
const char * ftype;
- int16_t mode = (fmode ? fmode[fc->ix] : 0);
+ rpm_mode_t mode = (fmode ? fmode[fc->ix] : 0);
s = argv[fc->ix];
assert(s != NULL);
@@ -1521,7 +1521,7 @@ rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg)
rpmds ds;
int flags = 0; /* XXX !scareMem */
ARGV_t av;
- int16_t * fmode;
+ rpm_mode_t * fmode;
int ac = rpmfiFC(fi);
const void ** p;
char buf[BUFSIZ];
diff --git a/build/rpmfc.h b/build/rpmfc.h
index ea57fd579..b459ead25 100644
--- a/build/rpmfc.h
+++ b/build/rpmfc.h
@@ -117,7 +117,7 @@ rpmfc rpmfcNew(void);
* @param fmode files mode_t array (or NULL)
* @return RPMRC_OK on success
*/
-rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, int16_t * fmode);
+rpmRC rpmfcClassify(rpmfc fc, ARGV_t argv, rpm_mode_t * fmode);
/** \ingroup rpmfc
* Build file/package dependency dictionary and mappings.
diff --git a/lib/query.c b/lib/query.c
index 8e774fbd5..523390cd6 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -181,7 +181,7 @@ int showQueryPackage(QVA_t qva, rpmts ts, Header h)
if (fi != NULL)
while ((i = rpmfiNext(fi)) >= 0) {
rpmfileAttrs fflags;
- unsigned short fmode;
+ rpm_mode_t fmode;
unsigned short frdev;
rpm_time_t fmtime;
rpmfileState fstate;
diff --git a/lib/rpmfi.c b/lib/rpmfi.c
index 05431bcf2..0dd597137 100644
--- a/lib/rpmfi.c
+++ b/lib/rpmfi.c
@@ -149,9 +149,9 @@ uint32_t rpmfiVFlags(rpmfi fi)
return VFlags;
}
-uint16_t rpmfiFMode(rpmfi fi)
+rpm_mode_t rpmfiFMode(rpmfi fi)
{
- uint16_t fmode = 0;
+ rpm_mode_t fmode = 0;
if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
if (fi->fmodes != NULL)
@@ -428,7 +428,7 @@ const char * ftstring (rpmFileTypes ft)
}
}
-rpmFileTypes rpmfiWhatis(uint16_t mode)
+rpmFileTypes rpmfiWhatis(rpm_mode_t mode)
{
if (S_ISDIR(mode)) return XDIR;
if (S_ISCHR(mode)) return CDEV;
@@ -491,7 +491,7 @@ rpmFileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing)
}
}
- diskWhat = rpmfiWhatis((int16_t)sb.st_mode);
+ diskWhat = rpmfiWhatis((rpm_mode_t)sb.st_mode);
dbWhat = rpmfiWhatis(rpmfiFMode(ofi));
newWhat = rpmfiWhatis(rpmfiFMode(nfi));
@@ -564,7 +564,7 @@ int rpmfiConfigConflict(const rpmfi fi)
return 0;
}
- diskWhat = rpmfiWhatis((int16_t)sb.st_mode);
+ diskWhat = rpmfiWhatis((rpm_mode_t)sb.st_mode);
newWhat = rpmfiWhatis(rpmfiFMode(fi));
if (newWhat != LINK && newWhat != REG)
@@ -636,7 +636,7 @@ Header relocateFileList(const rpmts ts, rpmfi fi,
uint32_t * fFlags = NULL;
rpm_color_t * fColors = NULL;
rpm_color_t * dColors = NULL;
- uint16_t * fModes = NULL;
+ rpm_mode_t * fModes = NULL;
Header h;
int nrelocated = 0;
int fileAlloced = 0;
diff --git a/lib/rpmfi.h b/lib/rpmfi.h
index 3dd202a36..077601a0e 100644
--- a/lib/rpmfi.h
+++ b/lib/rpmfi.h
@@ -195,7 +195,7 @@ uint32_t rpmfiVFlags(rpmfi fi);
* @param fi file info set
* @return current file mode, 0 on invalid
*/
-uint16_t rpmfiFMode(rpmfi fi);
+rpm_mode_t rpmfiFMode(rpmfi fi);
/** \ingroup rpmfi
* Return current file state from file info set.
@@ -403,7 +403,7 @@ void rpmfiBuildFNames(Header h, rpm_tag_t tagN,
* @param mode file mode bits (from header)
* @return file type
*/
-rpmFileTypes rpmfiWhatis(uint16_t mode);
+rpmFileTypes rpmfiWhatis(rpm_mode_t mode);
/** \ingroup rpmfi
* Return file info comparison.
diff --git a/lib/rpmfi_internal.h b/lib/rpmfi_internal.h
index 9060b18fc..c036b7d2b 100644
--- a/lib/rpmfi_internal.h
+++ b/lib/rpmfi_internal.h
@@ -47,7 +47,7 @@ struct rpmfi_s {
/*?null?*/
const rpm_time_t * fmtimes; /*!< File modification time(s) (from header) */
/*?null?*/
- uint16_t * fmodes; /*!< File mode(s) (from header) */
+ rpm_mode_t * fmodes; /*!< File mode(s) (from header) */
/*?null?*/
const uint16_t * frdevs; /*!< File rdev(s) (from header) */
/*?null?*/
diff --git a/lib/rpmtypes.h b/lib/rpmtypes.h
index a55b74a93..18ab753d6 100644
--- a/lib/rpmtypes.h
+++ b/lib/rpmtypes.h
@@ -28,6 +28,7 @@ typedef uint32_t rpm_color_t;
typedef uint32_t rpm_off_t;
typedef uint32_t rpm_time_t;
+typedef uint16_t rpm_mode_t;
typedef struct headerToken_s * Header;
typedef struct headerIterator_s * HeaderIterator;
diff --git a/lib/transaction.c b/lib/transaction.c
index 0aab8542c..e7ff1437d 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -140,7 +140,7 @@ static int handleInstInstalledFiles(const rpmts ts,
continue;
if (!(fi->mapflags & CPIO_SBIT_CHECK)) {
- int16_t omode = rpmfiFMode(otherFi);
+ rpm_mode_t omode = rpmfiFMode(otherFi);
if (S_ISREG(omode) && (omode & 06000) != 0) {
fi->mapflags |= CPIO_SBIT_CHECK;
}
@@ -386,7 +386,7 @@ static void handleOverlappedFiles(const rpmts ts,
int otherPkgNum, otherFileNum;
rpmfi otherFi;
int32_t FFlags;
- int16_t FMode;
+ rpm_mode_t FMode;
const rpmfi * recs;
int numRecs;
@@ -822,7 +822,7 @@ static void skipFiles(const rpmts ts, rpmfi fi)
if (fi != NULL) /* XXX lclint */
while ((i = rpmfiNext(fi)) >= 0) {
const char * fdn, * fbn;
- int16_t fFMode;
+ rpm_mode_t fFMode;
if (XFA_SKIPPING(fi->actions[i]))
continue;
@@ -1740,7 +1740,7 @@ rpmlog(RPMLOG_DEBUG, _("computing file dispositions\n"));
if (rpmteType(p) == TR_REMOVED) {
fi = rpmfiInit(fi, 0);
while ((i = rpmfiNext(fi)) >= 0) {
- int16_t mode;
+ rpm_mode_t mode;
if (XFA_SKIPPING(fi->actions[i]))
continue;
(void) rpmfiSetFX(fi, i);
diff --git a/lib/verify.c b/lib/verify.c
index dbdfeae11..b8ec7b36c 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -24,7 +24,7 @@ extern int _rpmds_unspecified_epoch_noise;
int rpmVerifyFile(const rpmts ts, const rpmfi fi,
rpmVerifyAttrs * res, rpmVerifyAttrs omitMask)
{
- unsigned short fmode = rpmfiFMode(fi);
+ rpm_mode_t fmode = rpmfiFMode(fi);
rpmfileAttrs fileAttrs = rpmfiFFlags(fi);
rpmVerifyAttrs flags = rpmfiVFlags(fi);
const char * fn = rpmfiFN(fi);
@@ -146,14 +146,14 @@ int rpmVerifyFile(const rpmts ts, const rpmfi fi,
}
if (flags & RPMVERIFY_MODE) {
- unsigned short metamode = fmode;
- unsigned short filemode;
+ rpm_mode_t metamode = fmode;
+ rpm_mode_t filemode;
/*
- * Platforms (like AIX) where sizeof(unsigned short) != sizeof(mode_t)
- * need the (unsigned short) cast here.
+ * Platforms (like AIX) where sizeof(rpm_mode_t) != sizeof(mode_t)
+ * need the (rpm_mode_t) cast here.
*/
- filemode = (unsigned short)sb.st_mode;
+ filemode = (rpm_mode_t)sb.st_mode;
/*
* Comparing the type of %ghost files is meaningless, but perms are OK.