write_to_temp(struct archive_write *a, const void *buff, size_t s)
{
struct _7zip *zip;
- unsigned char *p;
+ const unsigned char *p;
ssize_t ws;
zip = (struct _7zip *)a->format_data;
}
}
- p = (unsigned char *)buff;
+ p = (const unsigned char *)buff;
while (s) {
ws = write(zip->temp_fd, p, s);
if (ws < 0) {
file_cmp_node(const struct archive_rb_node *n1,
const struct archive_rb_node *n2)
{
- struct file *f1 = (struct file *)n1;
- struct file *f2 = (struct file *)n2;
+ const struct file *f1 = (const struct file *)n1;
+ const struct file *f2 = (const struct file *)n2;
if (f1->name_len == f2->name_len)
return (memcmp(f1->utf16name, f2->utf16name, f1->name_len));
static int
file_cmp_key(const struct archive_rb_node *n, const void *key)
{
- struct file *f = (struct file *)n;
+ const struct file *f = (const struct file *)n;
return (f->name_len - *(const char *)key);
}
/*#define DEBUG_PRINT_TOC 1 */
+#define BAD_CAST_CONST (const xmlChar *)
+
#define HEADER_MAGIC 0x78617221
#define HEADER_SIZE 28
#define HEADER_VERSION 1
write_to_temp(struct archive_write *a, const void *buff, size_t s)
{
struct xar *xar;
- unsigned char *p;
+ const unsigned char *p;
ssize_t ws;
xar = (struct xar *)a->format_data;
- p = (unsigned char *)buff;
+ p = (const unsigned char *)buff;
while (s) {
ws = write(xar->temp_fd, p, s);
if (ws < 0) {
{
int r;
- r = xmlTextWriterStartElement(writer, BAD_CAST(key));
+ r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(key));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
}
if (attrkey != NULL && attrvalue != NULL) {
r = xmlTextWriterWriteAttribute(writer,
- BAD_CAST(attrkey), BAD_CAST(attrvalue));
+ BAD_CAST_CONST(attrkey), BAD_CAST_CONST(attrvalue));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
}
}
if (value != NULL) {
- r = xmlTextWriterWriteString(writer, BAD_CAST(value));
+ r = xmlTextWriterWriteString(writer, BAD_CAST_CONST(value));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
if (value == NULL)
return (ARCHIVE_OK);
- r = xmlTextWriterStartElement(writer, BAD_CAST(key));
+ r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(key));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
return (ARCHIVE_FATAL);
}
if (value != NULL) {
- r = xmlTextWriterWriteString(writer, BAD_CAST(value));
+ r = xmlTextWriterWriteString(writer, BAD_CAST_CONST(value));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
} while (p != NULL);
if (n > 0) {
- r = xmlTextWriterStartElement(writer, BAD_CAST(element));
+ r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(element));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
goto exit_toc;
}
r = xmlTextWriterWriteAttribute(writer, BAD_CAST("style"),
- BAD_CAST(getalgname(xar->opt_toc_sumalg)));
+ BAD_CAST_CONST(getalgname(xar->opt_toc_sumalg)));
if (r < 0) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
file_cmp_node(const struct archive_rb_node *n1,
const struct archive_rb_node *n2)
{
- struct file *f1 = (struct file *)n1;
- struct file *f2 = (struct file *)n2;
+ const struct file *f1 = (const struct file *)n1;
+ const struct file *f2 = (const struct file *)n2;
return (strcmp(f1->basename.s, f2->basename.s));
}
static int
file_cmp_key(const struct archive_rb_node *n, const void *key)
{
- struct file *f = (struct file *)n;
+ const struct file *f = (const struct file *)n;
return (strcmp(f->basename.s, (const char *)key));
}
file_hd_cmp_node(const struct archive_rb_node *n1,
const struct archive_rb_node *n2)
{
- struct hardlink *h1 = (struct hardlink *)n1;
- struct hardlink *h2 = (struct hardlink *)n2;
+ const struct hardlink *h1 = (const struct hardlink *)n1;
+ const struct hardlink *h2 = (const struct hardlink *)n2;
return (strcmp(archive_entry_pathname(h1->file_list.first->entry),
archive_entry_pathname(h2->file_list.first->entry)));
static int
file_hd_cmp_key(const struct archive_rb_node *n, const void *key)
{
- struct hardlink *h = (struct hardlink *)n;
+ const struct hardlink *h = (const struct hardlink *)n;
return (strcmp(archive_entry_pathname(h->file_list.first->entry),
(const char *)key));