Пример #1
0
uint32 calculate_crc_for_opened_file(OpenedFile& OFile)
{
	uint32 crc = 0;
	unsigned char *buffer;

	/* Build the crc table */
	if(build_crc_table())
	{
		buffer = new byte[BUFFER_SIZE];
		if(buffer) 
		{
			crc= calculate_file_crc(buffer, BUFFER_SIZE, OFile);
			delete []buffer;
		}
		
		/* free the crc table! */
		free_crc_table();
	}

	return crc;
}
Пример #2
0
unsigned long calculate_crc_for_opened_file(
    short refnum)
{
    unsigned long crc;
    unsigned char *buffer;

    /* Build the crc table */
    if(build_crc_table())
    {
        buffer= (unsigned char *) malloc(BUFFER_SIZE*sizeof(unsigned char));
        if(buffer)
        {
            crc= calculate_file_crc(buffer, BUFFER_SIZE, refnum);

            free(buffer);
        }

        /* free the crc table! */
        free_crc_table();
    }

    return crc;
}