version 1.1.1.1, 2012/02/21 23:48:05
|
version 1.1.1.2, 2013/07/22 01:32:11
|
Line 1
|
Line 1
|
/* |
/* |
zip_set_file_comment.c -- set comment for file in archive |
zip_set_file_comment.c -- set comment for file in archive |
Copyright (C) 2006-2007 Dieter Baron and Thomas Klausner | Copyright (C) 2006-2009 Dieter Baron and Thomas Klausner |
|
|
This file is part of libzip, a library to manipulate ZIP archives. |
This file is part of libzip, a library to manipulate ZIP archives. |
The authors can be contacted at <libzip@nih.at> |
The authors can be contacted at <libzip@nih.at> |
Line 40
|
Line 40
|
|
|
|
|
ZIP_EXTERN(int) |
ZIP_EXTERN(int) |
zip_set_file_comment(struct zip *za, int idx, const char *comment, int len) | zip_set_file_comment(struct zip *za, zip_uint64_t idx, |
| const char *comment, int len) |
{ |
{ |
char *tmpcom; |
char *tmpcom; |
|
|
if (idx < 0 || idx >= za->nentry | if (idx >= za->nentry |
|| len < 0 || len > MAXCOMLEN |
|| len < 0 || len > MAXCOMLEN |
|| (len > 0 && comment == NULL)) { |
|| (len > 0 && comment == NULL)) { |
_zip_error_set(&za->error, ZIP_ER_INVAL, 0); |
_zip_error_set(&za->error, ZIP_ER_INVAL, 0); |
|
return -1; |
|
} |
|
|
|
if (ZIP_IS_RDONLY(za)) { |
|
_zip_error_set(&za->error, ZIP_ER_RDONLY, 0); |
return -1; |
return -1; |
} |
} |
|
|