[xar commit] r221 - in trunk/xar: . lib

1 view
Skip to first unread message

codesite...@google.com

unread,
Aug 19, 2008, 10:43:27 AM8/19/08
to xar-c...@googlegroups.com
Author: bbraun
Date: Tue Aug 19 07:42:43 2008
New Revision: 221

Modified:
trunk/xar/ChangeLog
trunk/xar/lib/lzmaxar.c

Log:
lib/lzmaxar.c: if lzma compression is specified but not compiled in, throw
an error.


Modified: trunk/xar/ChangeLog
==============================================================================
--- trunk/xar/ChangeLog (original)
+++ trunk/xar/ChangeLog Tue Aug 19 07:42:43 2008
@@ -1,4 +1,6 @@
devel
+ 2008-08-19 Rob Braun bbr...@synack.net
+ * lib/lzmaxar.c: if lzma compression is specified but not compiled in,
throw an error.
2008-08-17 Rob Braun bbr...@synack.net
* lib/archive.c: Make sure the binary header and toc checksum types
match. Contributed by Apple.
2008-08-15 Rob Braun bbr...@synack.net

Modified: trunk/xar/lib/lzmaxar.c
==============================================================================
--- trunk/xar/lib/lzmaxar.c (original)
+++ trunk/xar/lib/lzmaxar.c Tue Aug 19 07:42:43 2008
@@ -98,12 +98,12 @@
}

int xar_lzma_fromheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in,
size_t *inlen, void **context) {
-#ifdef HAVE_LIBLZMA
const char *opt;
+ xar_prop_t tmpp;
+#ifdef HAVE_LIBLZMA
void *out = NULL;
size_t outlen, offset = 0;
lzma_ret r;
- xar_prop_t tmpp;

/* on first run, we init the context and check the compression type */
if( !LZMA_CONTEXT(context) ) {
@@ -166,6 +166,19 @@
free(*in);
*in = out;
*inlen = offset;
+#else
+ opt = NULL;
+ tmpp = xar_prop_pget(p, "encoding");
+ if( tmpp )
+ opt = xar_attr_pget(f, tmpp, "style");
+ if( !opt ) return 0;
+ if( strcmp(opt, "application/x-lzma") != 0 ) return 0;
+ xar_err_new(x);
+ xar_err_set_file(x, f);
+ xar_err_set_errno(x, 0);
+ xar_err_set_string(x, "lzma support not compiled in.");
+ xar_err_callback(x, XAR_SEVERITY_FATAL, XAR_ERR_ARCHIVE_EXTRACTION);
+
#endif /* HAVE_LIBLZMA */
return 0;
}
@@ -196,11 +209,11 @@
}

int32_t xar_lzma_toheap_in(xar_t x, xar_file_t f, xar_prop_t p, void **in,
size_t *inlen, void **context) {
+ const char *opt;
#ifdef HAVE_LIBLZMA
void *out = NULL;
size_t outlen, offset = 0;
lzma_ret r;
- const char *opt;

/* on first run, we init the context and check the compression type */
if( !LZMA_CONTEXT(context) ) {
@@ -316,6 +329,18 @@
free(*in);
*in = out;
*inlen = offset;
+#else
+ opt = xar_opt_get(x, XAR_OPT_COMPRESSION);
+ if( !opt )
+ return 0;
+ if( strcmp(opt, XAR_OPT_VAL_LZMA) != 0 )
+ return 0;
+ xar_err_new(x);
+ xar_err_set_file(x, f);
+ xar_err_set_errno(x, 0);
+ xar_err_set_string(x, "lzma support not compiled in.");
+ xar_err_callback(x, XAR_SEVERITY_FATAL, XAR_ERR_ARCHIVE_CREATION);
+
#endif /* HAVE_LIBLZMA */
return 0;
}

Reply all
Reply to author
Forward
0 new messages