/** \ingroup rpmio
* \name RPMIO Vectors.
*/
-typedef ssize_t (*fdio_read_function_t) (void *cookie, char *buf, size_t nbytes);
-typedef ssize_t (*fdio_write_function_t) (void *cookie, const char *buf, size_t nbytes);
+typedef ssize_t (*fdio_read_function_t) (void *cookie, void *buf, size_t nbytes);
+typedef ssize_t (*fdio_write_function_t) (void *cookie, const void *buf, size_t nbytes);
typedef int (*fdio_seek_function_t) (void *cookie, _libio_pos_t pos, int whence);
typedef int (*fdio_close_function_t) (void *cookie);
typedef FD_t (*fdio_ref_function_t) ( void * cookie);
/** \ingroup rpmio
* Update digest(s) attached to fd.
*/
-static void fdUpdateDigests(FD_t fd, const unsigned char * buf, size_t buflen);
+static void fdUpdateDigests(FD_t fd, const void * buf, size_t buflen);
/**
*/
/**
*/
-static ssize_t fdRead(void * cookie, char * buf, size_t count)
+static ssize_t fdRead(void * cookie, void * buf, size_t count)
{
FD_t fd = c2f(cookie);
ssize_t rc;
rc = read(fdFileno(fd), buf, (count > fd->bytesRemain ? fd->bytesRemain : count));
fdstat_exit(fd, FDSTAT_READ, rc);
- if (fd->digests && rc > 0) fdUpdateDigests(fd, (void *)buf, rc);
+ if (fd->digests && rc > 0) fdUpdateDigests(fd, buf, rc);
DBGIO(fd, (stderr, "==>\tfdRead(%p,%p,%ld) rc %ld %s\n", cookie, buf, (long)count, (long)rc, fdbg(fd)));
/**
*/
-static ssize_t fdWrite(void * cookie, const char * buf, size_t count)
+static ssize_t fdWrite(void * cookie, const void * buf, size_t count)
{
FD_t fd = c2f(cookie);
int fdno = fdFileno(fd);
if (fd == NULL || fd->bytesRemain == 0) return 0; /* XXX simulate EOF */
- if (fd->digests && count > 0) fdUpdateDigests(fd, (void *)buf, count);
+ if (fd->digests && count > 0) fdUpdateDigests(fd, buf, count);
if (count == 0) return 0;
}
/* =============================================================== */
-static ssize_t gzdRead(void * cookie, char * buf, size_t count)
+static ssize_t gzdRead(void * cookie, void * buf, size_t count)
{
FD_t fd = c2f(cookie);
gzFile gzfile;
}
} else if (rc >= 0) {
fdstat_exit(fd, FDSTAT_READ, rc);
- if (fd->digests && rc > 0) fdUpdateDigests(fd, (void *)buf, rc);
+ if (fd->digests && rc > 0) fdUpdateDigests(fd, buf, rc);
}
return rc;
}
-static ssize_t gzdWrite(void * cookie, const char * buf, size_t count)
+static ssize_t gzdWrite(void * cookie, const void * buf, size_t count)
{
FD_t fd = c2f(cookie);
gzFile gzfile;
if (fd == NULL || fd->bytesRemain == 0) return 0; /* XXX simulate EOF */
- if (fd->digests && count > 0) fdUpdateDigests(fd, (void *)buf, count);
+ if (fd->digests && count > 0) fdUpdateDigests(fd, buf, count);
gzfile = gzdFileno(fd);
if (gzfile == NULL) return -2; /* XXX can't happen */
}
/* =============================================================== */
-static ssize_t bzdRead(void * cookie, char * buf, size_t count)
+static ssize_t bzdRead(void * cookie, void * buf, size_t count)
{
FD_t fd = c2f(cookie);
BZFILE *bzfile;
fd->errcookie = bzerror(bzfile, &zerror);
} else if (rc >= 0) {
fdstat_exit(fd, FDSTAT_READ, rc);
- if (fd->digests && rc > 0) fdUpdateDigests(fd, (void *)buf, rc);
+ if (fd->digests && rc > 0) fdUpdateDigests(fd, buf, rc);
}
return rc;
}
-static ssize_t bzdWrite(void * cookie, const char * buf, size_t count)
+static ssize_t bzdWrite(void * cookie, const void * buf, size_t count)
{
FD_t fd = c2f(cookie);
BZFILE *bzfile;
if (fd == NULL || fd->bytesRemain == 0) return 0; /* XXX simulate EOF */
- if (fd->digests && count > 0) fdUpdateDigests(fd, (void *)buf, count);
+ if (fd->digests && count > 0) fdUpdateDigests(fd, buf, count);
bzfile = bzdFileno(fd);
fdstat_enter(fd, FDSTAT_WRITE);
}
/* =============================================================== */
-static ssize_t lzdRead(void * cookie, char * buf, size_t count)
+static ssize_t lzdRead(void * cookie, void * buf, size_t count)
{
FD_t fd = c2f(cookie);
LZFILE *lzfile;
fd->errcookie = "Lzma: decoding error";
} else if (rc >= 0) {
fdstat_exit(fd, FDSTAT_READ, rc);
- if (fd->digests && rc > 0) fdUpdateDigests(fd, (void *)buf, rc);
+ if (fd->digests && rc > 0) fdUpdateDigests(fd, buf, rc);
}
return rc;
}
-static ssize_t lzdWrite(void * cookie, const char * buf, size_t count)
+static ssize_t lzdWrite(void * cookie, const void * buf, size_t count)
{
FD_t fd = c2f(cookie);
LZFILE *lzfile;
if (fd == NULL || fd->bytesRemain == 0) return 0; /* XXX simulate EOF */
- if (fd->digests && count > 0) fdUpdateDigests(fd, (void *)buf, count);
+ if (fd->digests && count > 0) fdUpdateDigests(fd, buf, count);
lzfile = lzdFileno(fd);
#if _USE_LIBIO
{ cookie_io_functions_t ciof;
- ciof.read = iof->read;
- ciof.write = iof->write;
+ ciof.read = (cookie_read_function_t *) iof->read;
+ ciof.write = (cookie_write_function_t *) iof->write;
ciof.seek = iof->seek;
ciof.close = iof->close;
fp = fopencookie(fd, stdio, ciof);
fdstat_exit(fd, FDSTAT_DIGEST, (ssize_t) 0);
}
-static void fdUpdateDigests(FD_t fd, const unsigned char * buf, size_t buflen)
+static void fdUpdateDigests(FD_t fd, const void * buf, size_t buflen)
{
if (fd && fd->digests) {
fdstat_enter(fd, FDSTAT_DIGEST);