Back to index

php5  5.3.10
Functions
zip_unchange.c File Reference
#include <stdlib.h>
#include "zipint.h"

Go to the source code of this file.

Functions

 zip_unchange (struct zip *za, int idx)
int _zip_unchange (struct zip *za, int idx, int allow_duplicates)

Function Documentation

int _zip_unchange ( struct zip za,
int  idx,
int  allow_duplicates 
)

Definition at line 51 of file zip_unchange.c.

{
    int i;
    
    if (idx < 0 || idx >= za->nentry) {
       _zip_error_set(&za->error, ZIP_ER_INVAL, 0);
       return -1;
    }

    if (za->entry[idx].ch_filename) {
       if (!allow_duplicates) {
           i = _zip_name_locate(za,
                      _zip_get_name(za, idx, ZIP_FL_UNCHANGED, NULL),
                             0, NULL);
           if (i != -1 && i != idx) {
              _zip_error_set(&za->error, ZIP_ER_EXISTS, 0);
              return -1;
           }
       }

       free(za->entry[idx].ch_filename);
       za->entry[idx].ch_filename = NULL;
    }

    free(za->entry[idx].ch_comment);
    za->entry[idx].ch_comment = NULL;
    za->entry[idx].ch_comment_len = -1;

    _zip_unchange_data(za->entry+idx);

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function:

zip_unchange ( struct zip za,
int  idx 
)

Definition at line 43 of file zip_unchange.c.

{
    return _zip_unchange(za, idx, 0);
}

Here is the call graph for this function: