blob: f8a3f1923d5495446f2fc721e5a73a19b3209b47 [file] [log] [blame]
Dieter Baronbbb63691999-07-26 22:04:20 +00001/*
Dieter Baron35bf0fd2004-12-22 16:32:01 +00002 $NiH: zip_unchange_data.c,v 1.14 2004/11/30 23:02:47 wiz Exp $
Dieter Baron1c5ffe22002-06-06 09:27:17 +00003
Dieter Baronbbb63691999-07-26 22:04:20 +00004 zip_unchange_data.c -- undo helper function
Dieter Baron2a8ad422004-04-16 09:40:31 +00005 Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
Dieter Baronbbb63691999-07-26 22:04:20 +00006
Dieter Barondd9afca2003-10-02 14:13:37 +00007 This file is part of libzip, a library to manipulate ZIP archives.
Dieter Baronbbb63691999-07-26 22:04:20 +00008 The authors can be contacted at <nih@giga.or.at>
9
Dieter Barondd9afca2003-10-02 14:13:37 +000010 Redistribution and use in source and binary forms, with or without
11 modification, are permitted provided that the following conditions
12 are met:
13 1. Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15 2. Redistributions in binary form must reproduce the above copyright
16 notice, this list of conditions and the following disclaimer in
17 the documentation and/or other materials provided with the
18 distribution.
19 3. The names of the authors may not be used to endorse or promote
20 products derived from this software without specific prior
21 written permission.
22
23 THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
24 OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
25 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
27 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
29 GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
30 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
31 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32 OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
33 IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Dieter Baronbbb63691999-07-26 22:04:20 +000034*/
35
36
37
Thomas Klausnerc1364c51999-07-26 02:44:54 +000038#include <stdlib.h>
Thomas Klausner290861a2004-11-30 23:02:48 +000039
Thomas Klausneraf93f081999-07-26 01:39:56 +000040#include "zipint.h"
41
Thomas Klausneref9a02f2004-11-18 15:06:20 +000042void
Thomas Klausneraf93f081999-07-26 01:39:56 +000043_zip_unchange_data(struct zip_entry *ze)
44{
Thomas Klausneref9a02f2004-11-18 15:06:20 +000045 if (ze->source) {
Dieter Baron35bf0fd2004-12-22 16:32:01 +000046 (void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE);
Thomas Klausneref9a02f2004-11-18 15:06:20 +000047 free(ze->source);
48 ze->source = NULL;
Thomas Klausneraf93f081999-07-26 01:39:56 +000049 }
50
Dieter Baronb2ed74d2004-04-14 14:01:31 +000051 ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED;
Thomas Klausneraf93f081999-07-26 01:39:56 +000052}
53