+- fix _zip_replace (add two entries with the same name segfaults)
- add pattern support to extract or add files
- stream to add or modify entries
- crypt support for zip (read and write)
int entry_name_len = 0;
struct zip_source *zs;
long offset_start = 0, offset_len = 0;
+ int cur_idx;
if (!this) {
RETURN_FALSE;
if (!zs) {
RETURN_FALSE;
}
- if (zip_add(intern, entry_name, zs) < 0) {
+
+ cur_idx = zip_name_locate(intern, (const char *)entry_name, 0);
+ /* TODO: fix _zip_replace */
+ if (cur_idx<0) {
+ /* reset the error */
+ if (intern->error.str) {
+ _zip_error_fini(&intern->error);
+ }
+ _zip_error_init(&intern->error);
+
+ } else {
+ if (zip_delete(intern, cur_idx) == -1) {
+ RETURN_FALSE;
+ }
+ }
+
+ if (zip_add(intern, entry_name, zs) == -1) {
RETURN_FALSE;
} else {
RETURN_TRUE;
ze_zip_object *ze_obj;
struct zip_source *zs;
int pos = 0;
+ int cur_idx;
if (!this) {
RETURN_FALSE;
RETURN_FALSE;
}
+ cur_idx = zip_name_locate(intern, (const char *)name, 0);
+ /* TODO: fix _zip_replace */
+ if (cur_idx<0) {
+ /* reset the error */
+ if (intern->error.str) {
+ _zip_error_fini(&intern->error);
+ }
+ _zip_error_init(&intern->error);
+
+ } else {
+ if (zip_delete(intern, cur_idx) == -1) {
+ RETURN_FALSE;
+ }
+ }
+
if (zip_add(intern, name, zs) == -1) {
RETURN_FALSE;
+ } else {
+ RETURN_TRUE;
}
}
/* }}} */