Back to index

php5  5.3.10
Functions
zip_rename.c File Reference
#include <string.h>
#include "zipint.h"

Go to the source code of this file.

Functions

 zip_rename (struct zip *za, int idx, const char *name)

Function Documentation

zip_rename ( struct zip za,
int  idx,
const char *  name 
)

Definition at line 43 of file zip_rename.c.

{
    const char *old_name;
    int old_is_dir, new_is_dir;
    
    if (idx >= za->nentry || idx < 0 || name[0] == '\0') {
       _zip_error_set(&za->error, ZIP_ER_INVAL, 0);
       return -1;
    }

    if ((old_name=zip_get_name(za, idx, 0)) == NULL)
       return -1;
                                                            
    new_is_dir = (name[strlen(name)-1] == '/');
    old_is_dir = (old_name[strlen(old_name)-1] == '/');

    if (new_is_dir != old_is_dir) {
       _zip_error_set(&za->error, ZIP_ER_INVAL, 0);
       return -1;
    }

    return _zip_set_name(za, idx, name);
}

Here is the call graph for this function: