diff options
Diffstat (limited to 'ext/zip/lib/zip_string.c')
-rw-r--r-- | ext/zip/lib/zip_string.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/ext/zip/lib/zip_string.c b/ext/zip/lib/zip_string.c index 4e8709b5f7..e3905da01b 100644 --- a/ext/zip/lib/zip_string.c +++ b/ext/zip/lib/zip_string.c @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -31,29 +31,29 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - + #include <stdlib.h> #include <string.h> #include "zipint.h" - + zip_uint32_t _zip_string_crc32(const struct zip_string *s) { zip_uint32_t crc; - + crc = (zip_uint32_t)crc32(0L, Z_NULL, 0); - if (s != NULL) + if (s != NULL) crc = (zip_uint32_t)crc32(crc, s->raw, s->length); return crc; } - + int _zip_string_equal(const struct zip_string *a, const struct zip_string *b) @@ -69,7 +69,7 @@ _zip_string_equal(const struct zip_string *a, const struct zip_string *b) return (memcmp(a->raw, b->raw, a->length) == 0); } - + void _zip_string_free(struct zip_string *s) @@ -82,7 +82,7 @@ _zip_string_free(struct zip_string *s) free(s); } - + const zip_uint8_t * _zip_string_get(struct zip_string *string, zip_uint32_t *lenp, zip_flags_t flags, struct zip_error *error) @@ -113,13 +113,13 @@ _zip_string_get(struct zip_string *string, zip_uint32_t *lenp, zip_flags_t flags return string->converted; } } - + if (lenp) *lenp = string->length; return string->raw; } - + zip_uint16_t _zip_string_length(const struct zip_string *s) @@ -130,14 +130,14 @@ _zip_string_length(const struct zip_string *s) return s->length; } - + struct zip_string * _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, struct zip_error *error) { struct zip_string *s; enum zip_encoding_type expected_encoding; - + if (length == 0) return NULL; @@ -155,7 +155,7 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, _zip_error_set(error, ZIP_ER_INVAL, 0); return NULL; } - + if ((s=(struct zip_string *)malloc(sizeof(*s))) == NULL) { _zip_error_set(error, ZIP_ER_MEMORY, 0); return NULL; @@ -180,17 +180,17 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, return NULL; } } - + return s; } - + void _zip_string_write(const struct zip_string *s, FILE *f) { if (s == NULL) return; - + fwrite(s->raw, s->length, 1, f); } |