Back to index

php5  5.3.10
Functions
zip_filerange_crc.c File Reference
#include <stdio.h>
#include <errno.h>
#include "zipint.h"

Go to the source code of this file.

Functions

int _zip_filerange_crc (FILE *fp, off_t start, off_t len, uLong *crcp, struct zip_error *errp)

Function Documentation

int _zip_filerange_crc ( FILE *  fp,
off_t  start,
off_t  len,
uLong *  crcp,
struct zip_error errp 
)

Definition at line 45 of file zip_filerange_crc.c.

{
    Bytef buf[BUFSIZE];
    size_t n;

    *crcp = crc32(0L, Z_NULL, 0);

    if (fseeko(fp, start, SEEK_SET) != 0) {
       _zip_error_set(errp, ZIP_ER_SEEK, errno);
       return -1;
    }
    
    while (len > 0) {
       n = len > BUFSIZE ? BUFSIZE : len;
       if ((n=fread(buf, 1, n, fp)) <= 0) {
           _zip_error_set(errp, ZIP_ER_READ, errno);
           return -1;
       }

       *crcp = crc32(*crcp, buf, n);

       len-= n;
    }

    return 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: