Back to index

php5  5.3.10
zip_unchange_data.c
Go to the documentation of this file.
00001 /*
00002   $NiH: zip_unchange_data.c,v 1.14 2004/11/30 23:02:47 wiz Exp $
00003 
00004   zip_unchange_data.c -- undo helper function
00005   Copyright (C) 1999, 2004 Dieter Baron and Thomas Klausner
00006 
00007   This file is part of libzip, a library to manipulate ZIP archives.
00008   The authors can be contacted at <libzip@nih.at>
00009 
00010   Redistribution and use in source and binary forms, with or without
00011   modification, are permitted provided that the following conditions
00012   are met:
00013   1. Redistributions of source code must retain the above copyright
00014      notice, this list of conditions and the following disclaimer.
00015   2. Redistributions in binary form must reproduce the above copyright
00016      notice, this list of conditions and the following disclaimer in
00017      the documentation and/or other materials provided with the
00018      distribution.
00019   3. The names of the authors may not be used to endorse or promote
00020      products derived from this software without specific prior
00021      written permission.
00022  
00023   THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
00024   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00026   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
00027   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00028   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
00029   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00030   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
00031   IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00032   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
00033   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00034 */
00035 
00036 
00037 
00038 #include <stdlib.h>
00039 
00040 #include "zipint.h"
00041 
00042 void
00043 _zip_unchange_data(struct zip_entry *ze)
00044 {
00045     if (ze->source) {
00046        (void)ze->source->f(ze->source->ud, NULL, 0, ZIP_SOURCE_FREE);
00047        free(ze->source);
00048        ze->source = NULL;
00049     }
00050     
00051     ze->state = ze->ch_filename ? ZIP_ST_RENAMED : ZIP_ST_UNCHANGED;
00052 }
00053