summaryrefslogtreecommitdiff
path: root/ext/zip/lib/zip_replace.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/zip/lib/zip_replace.c')
-rw-r--r--ext/zip/lib/zip_replace.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/ext/zip/lib/zip_replace.c b/ext/zip/lib/zip_replace.c
index 12db005f2..ae69a86f6 100644
--- a/ext/zip/lib/zip_replace.c
+++ b/ext/zip/lib/zip_replace.c
@@ -1,11 +1,9 @@
/*
- $NiH: zip_replace.c,v 1.20 2006/04/09 14:52:02 wiz Exp $
-
zip_replace.c -- replace file via callback function
- Copyright (C) 1999, 2003, 2004, 2006 Dieter Baron and Thomas Klausner
+ Copyright (C) 1999-2007 Dieter Baron and Thomas Klausner
This file is part of libzip, a library to manipulate ZIP archives.
- The authors can be contacted at <nih@giga.or.at>
+ The authors can be contacted at <libzip@nih.at>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
@@ -35,12 +33,11 @@
-#include "zip.h"
#include "zipint.h"
-PHPZIPAPI int
+ZIP_EXTERN(int)
zip_replace(struct zip *za, int idx, struct zip_source *source)
{
if (idx < 0 || idx >= za->nentry || source == NULL) {
@@ -57,23 +54,22 @@ zip_replace(struct zip *za, int idx, struct zip_source *source)
-PHPZIPAPI int
+int
_zip_replace(struct zip *za, int idx, const char *name,
struct zip_source *source)
{
- if (idx == -1) {
- if (_zip_entry_new(za) == NULL)
- return -1;
- idx = za->nentry - 1;
- }
+ if (idx == -1) {
+ if (_zip_entry_new(za) == NULL)
+ return -1;
-
+ idx = za->nentry - 1;
+ }
+
_zip_unchange_data(za->entry+idx);
if (name && _zip_set_name(za, idx, name) != 0)
- return -1;
-
-
+ return -1;
+
za->entry[idx].state = ((za->cdir == NULL || idx >= za->cdir->nentry)
? ZIP_ST_ADDED : ZIP_ST_REPLACED);
za->entry[idx].source = source;