RPM Package Manager, CVS Repository
http://rpm5.org/cvs/
____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson
Root: /v/rpm/cvs Email: [EMAIL PROTECTED]
Module: rpm Date: 23-Nov-2007 20:34:08
Branch: HEAD Handle: 2007112319340800
Modified files:
rpm CHANGES
rpm/rpmdb rpmwf.h
rpm/rpmio rpmxar.c rpmxar.h
Log:
- rpmxar.c: rearrange the messy markup and defines.
- remove messy HAVE_XAR_H from installed rpmxar.h include.
Summary:
Revision Changes Path
1.1878 +2 -0 rpm/CHANGES
1.10 +2 -1 rpm/rpmdb/rpmwf.h
2.10 +57 -41 rpm/rpmio/rpmxar.c
2.8 +7 -13 rpm/rpmio/rpmxar.h
____________________________________________________________________________
patch -p0 <<'@@ .'
Index: rpm/CHANGES
============================================================================
$ cvs diff -u -r1.1877 -r1.1878 CHANGES
--- rpm/CHANGES 23 Nov 2007 18:35:46 -0000 1.1877
+++ rpm/CHANGES 23 Nov 2007 19:34:08 -0000 1.1878
@@ -1,4 +1,6 @@
5.0a2 -> 5.0a3:
+ - jbj: rpmxar.c: rearrange the messy markup and defines.
+ - jbj: remove messy HAVE_XAR_H from installed rpmxar.h include.
- jbj: retrofit 3 needed typedef's when compiling w/o HAVE_XAR_H.
- jbj: rescusitate txar, pass private buffer through rpmxarPush.
- jbj: re-add rpm2cpio.c.
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmdb/rpmwf.h
============================================================================
$ cvs diff -u -r1.9 -r1.10 rpmwf.h
--- rpm/rpmdb/rpmwf.h 23 Nov 2007 18:29:01 -0000 1.9
+++ rpm/rpmdb/rpmwf.h 23 Nov 2007 19:34:08 -0000 1.10
@@ -49,7 +49,8 @@
#endif
rpmRC rpmwfPushXAR(rpmwf wf, const char * fn)
- /[EMAIL PROTECTED] wf @*/;
+ /[EMAIL PROTECTED] fileSystem @*/
+ /[EMAIL PROTECTED] wf, fileSystem @*/;
rpmRC rpmwfPullXAR(rpmwf wf, const char * fn)
/[EMAIL PROTECTED] fileSystem @*/
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmxar.c
============================================================================
$ cvs diff -u -r2.9 -r2.10 rpmxar.c
--- rpm/rpmio/rpmxar.c 23 Nov 2007 18:35:46 -0000 2.9
+++ rpm/rpmio/rpmxar.c 23 Nov 2007 19:34:08 -0000 2.10
@@ -1,10 +1,62 @@
#include "system.h"
-#define _RPMXAR_INTERNAL
-#include <rpmio_internal.h>
+/* XXX Get rid of the pugly #ifdef's */
+#if defined(WITH_XAR) && defined(HAVE_XAR_H)
+
+#include "xar.h"
+#if defined(__LCLINT__)
+/[EMAIL PROTECTED] [EMAIL PROTECTED]/
+/[EMAIL PROTECTED]@*/
+xar_t xar_open(const char *file, int32_t flags)
+ /[EMAIL PROTECTED]/;
+int xar_close(/[EMAIL PROTECTED]@*/ xar_t x)
+ /[EMAIL PROTECTED] fileSystem @*/
+ /[EMAIL PROTECTED] x, fileSystem @*/;
+/[EMAIL PROTECTED]@*/
+xar_iter_t xar_iter_new(void)
+ /[EMAIL PROTECTED]/;
+/[EMAIL PROTECTED]@*/
+xar_file_t xar_file_first(xar_t x, xar_iter_t i)
+ /[EMAIL PROTECTED] x, i @*/;
+/[EMAIL PROTECTED]@*/
+xar_file_t xar_file_next(xar_iter_t i)
+ /[EMAIL PROTECTED] i @*/;
+/[EMAIL PROTECTED]@*/
+xar_file_t xar_add_frombuffer(xar_t x, /[EMAIL PROTECTED]@*/ xar_file_t
parent,
+ const char *name, char *buffer, size_t length)
+ /[EMAIL PROTECTED] fileSystem @*/
+ /[EMAIL PROTECTED] x, fileSystem @*/;
+int32_t xar_extract_tobuffersz(xar_t x, xar_file_t f,
+ char **buffer, size_t *size)
+ /[EMAIL PROTECTED] fileSystem @*/
+ /[EMAIL PROTECTED] x, f, *buffer, *size @*/;
+/[EMAIL PROTECTED]@*/
+char *xar_get_path(xar_file_t f)
+ /[EMAIL PROTECTED]/;
+/[EMAIL PROTECTED] [EMAIL PROTECTED]/
+
+#endif /* __LCLINT__ */
+
+#else /* WITH_XAR */
+#define READ 0
+#define WRITE 1
+#define xar_open(_fn, _f) (NULL)
+#define xar_close(_x) (1)
+#define xar_iter_new() (NULL)
+#define xar_iter_free(_i)
+#define xar_file_first(_x, _i) (NULL)
+#define xar_file_next(_i) (NULL)
+#define xar_add_frombuffer(_x, _parent, _fn, _b, _bsize) (NULL)
+#define xar_extract_tobuffersz(_x, _f, _b, _bsize) (1)
+#define xar_get_path(_f) "*No XAR*"
+#endif /* WITH_XAR */
+
+#define _RPMXAR_INTERNAL
#include <rpmxar.h>
+#include <rpmio_internal.h>
+
#include "debug.h"
/[EMAIL PROTECTED] FD_t @*/
@@ -44,21 +96,15 @@
if (xar->nrefs > 1)
return rpmxarUnlink(xar, "rpmxarFree");
-#if defined(WITH_XAR)
if (xar->i) {
-/[EMAIL PROTECTED]@*/
xar_iter_free(xar->i);
-/[EMAIL PROTECTED]@*/
xar->i = NULL;
}
if (xar->x) {
int xx;
-/[EMAIL PROTECTED]@*/
xx = xar_close(xar->x);
-/[EMAIL PROTECTED]@*/
xar->x = NULL;
}
-#endif /* WITH_XAR */
xar->member = _free(xar->member);
xar->b = _free(xar->b);
@@ -76,56 +122,38 @@
rpmxar rpmxarNew(const char * fn, const char * fmode)
{
rpmxar xar = xcalloc(1, sizeof(*xar));
-#if defined(WITH_XAR)
int flags = ((fmode && *fmode == 'w') ? WRITE : READ);
-#endif /* WITH_XAR */
assert(fn != NULL);
-#if defined(WITH_XAR)
-/[EMAIL PROTECTED]@*/
xar->x = xar_open(fn, flags);
if (flags == READ) {
xar->i = xar_iter_new();
xar->first = 1;
}
-/[EMAIL PROTECTED]@*/
-#endif /* WITH_XAR */
return rpmxarLink(xar, "rpmxarNew");
}
int rpmxarNext(rpmxar xar)
{
-/[EMAIL PROTECTED]@*/
if (_xar_debug)
fprintf(stderr, "--> rpmxarNext(%p) first %d\n", xar, xar->first);
-/[EMAIL PROTECTED]@*/
-#if defined(WITH_XAR)
-/[EMAIL PROTECTED]@*/
if (xar->first) {
xar->f = xar_file_first(xar->x, xar->i);
xar->first = 0;
} else
xar->f = xar_file_next(xar->i);
-/[EMAIL PROTECTED]@*/
-#endif /* WITH_XAR */
return (xar->f == NULL ? 1 : 0);
}
int rpmxarPush(rpmxar xar, const char * fn, char * b, size_t bsize)
{
-/[EMAIL PROTECTED]@*/
if (_xar_debug)
fprintf(stderr, "--> rpmxarPush(%p, %s) %p[%u]\n", xar, fn, b,
(unsigned)bsize);
-/[EMAIL PROTECTED]@*/
if (xar->x && b != NULL) {
-#if defined(WITH_XAR)
-/[EMAIL PROTECTED]@*/
xar->f = xar_add_frombuffer(xar->x, NULL, fn, b, bsize);
-/[EMAIL PROTECTED]@*/
-#endif
if (xar->f == NULL)
return 2;
}
@@ -134,13 +162,7 @@
int rpmxarPull(rpmxar xar, const char * fn)
{
-#if defined(WITH_XAR)
-/[EMAIL PROTECTED]@*/
const char * path = xar_get_path(xar->f);
-/[EMAIL PROTECTED]@*/
-#else
- const char * path = xstrdup("*No XAR*");
-#endif /* WITH_XAR */
int rc = 1;
if (fn != NULL && strcmp(fn, path)) {
@@ -153,16 +175,12 @@
xar->b = _free(xar->b);
xar->bsize = xar->bx = 0;
-#if defined(WITH_XAR)
-/[EMAIL PROTECTED] -nullstate @*/
+/[EMAIL PROTECTED] @*/
rc = (int) xar_extract_tobuffersz(xar->x, xar->f, &xar->b, &xar->bsize);
-/[EMAIL PROTECTED] =nullstate @*/
-#endif /* WITH_XAR */
+/[EMAIL PROTECTED] @*/
-/[EMAIL PROTECTED]@*/
if (_xar_debug)
-fprintf(stderr, "--> rpmxarPull(%p, %s) %p[%u] rc %d\n", xar, fn, xar->b,
(unsigned)xar->bsize, rc);
-/[EMAIL PROTECTED]@*/
+fprintf(stderr, "--> rpmxarPull(%p, %s) %p[%u] rc %d\n", xar, xar->member,
xar->b, (unsigned)xar->bsize, rc);
if (rc)
return 1;
@@ -173,10 +191,8 @@
int rpmxarSwapBuf(rpmxar xar, char * b, size_t bsize,
char ** obp, size_t * obsizep)
{
-/[EMAIL PROTECTED]@*/
if (_xar_debug)
fprintf(stderr, "*** rpmxarSwapBuf(%p, %p[%u], %p, %p) %p[%u]\n", xar, b,
(unsigned) bsize, obp, obsizep, xar->b, (unsigned) xar->bsize);
-/[EMAIL PROTECTED]@*/
if (xar) {
if (obsizep != NULL)
@@ .
patch -p0 <<'@@ .'
Index: rpm/rpmio/rpmxar.h
============================================================================
$ cvs diff -u -r2.7 -r2.8 rpmxar.h
--- rpm/rpmio/rpmxar.h 23 Nov 2007 18:35:46 -0000 2.7
+++ rpm/rpmio/rpmxar.h 23 Nov 2007 19:34:08 -0000 2.8
@@ -12,21 +12,13 @@
typedef /[EMAIL PROTECTED]@*/ /[EMAIL PROTECTED]@*/ struct rpmxar_s * rpmxar;
#ifdef _RPMXAR_INTERNAL
-#if defined(HAVE_XAR_H)
-#include "xar.h"
-#else
-typedef void * xar_t;
-typedef void * xar_file_t;
-typedef void * xar_iter_t;
-#endif
-
struct rpmxar_s {
/[EMAIL PROTECTED]@*/
- xar_t x;
+ void * x; /*!< xar_t */
/[EMAIL PROTECTED]@*/
- xar_file_t f;
+ void * f; /*!< xar_file_t */
/[EMAIL PROTECTED]@*/
- xar_iter_t i;
+ void * i; /*!< xar_iter_t */
/[EMAIL PROTECTED]@*/
const char * member; /*!< Current archive member. */
/[EMAIL PROTECTED]@*/
@@ -96,7 +88,8 @@
/[EMAIL PROTECTED] xar, fileSystem @*/;
int rpmxarPush(rpmxar xar, const char * fn, char * b, size_t bsize)
- /[EMAIL PROTECTED] xar @*/;
+ /[EMAIL PROTECTED] fileSystem @*/
+ /[EMAIL PROTECTED] xar, fileSystem @*/;
int rpmxarPull(rpmxar xar, /[EMAIL PROTECTED]@*/ const char * fn)
/[EMAIL PROTECTED] fileSystem @*/
@@ -104,7 +97,8 @@
int rpmxarSwapBuf(rpmxar xar, /[EMAIL PROTECTED]@*/ char * b, size_t bsize,
/[EMAIL PROTECTED]@*/ char ** obp, /[EMAIL PROTECTED]@*/ size_t
* obsizep)
- /[EMAIL PROTECTED] xar, *obp, *obsizep @*/;
+ /[EMAIL PROTECTED] fileSystem @*/
+ /[EMAIL PROTECTED] xar, *obp, *obsizep, fileSystem @*/;
/[EMAIL PROTECTED]@*/
ssize_t xarRead(void * cookie, /[EMAIL PROTECTED]@*/ char * buf, size_t
count)
@@ .
______________________________________________________________________
RPM Package Manager http://rpm5.org
CVS Sources Repository [email protected]