Logo Search packages:      
Sourcecode: cabextract version File versions  Download package

int(* mschm_decompressor::fast_find)(struct mschm_decompressor *self, struct mschmd_header *chm, char *filename, struct mschmd_file *f_ptr, int f_size)

Finds file details quickly.

Instead of reading all CHM helpfile headers and building a list of files, fast_open() and fast_find() are intended for finding file details only when they are needed. The CHM file format includes an on-disk file index to allow this.

Given a case-sensitive filename, fast_find() will search the on-disk index for that file.

If the file was found, the caller-provided mschmd_file structure will be filled out like so:

  • section: the correct value for the found file
  • offset: the correct value for the found file
  • length: the correct value for the found file
  • all other structure elements: NULL or 0

If the file was not found, MSPACK_ERR_OK will still be returned as the result, but the caller-provided structure will be filled out like so:

  • section: NULL
  • offset: 0
  • length: 0
  • all other structure elements: NULL or 0

This method is intended to be used in conjunction with CHM helpfiles opened with fast_open(), but it also works with helpfiles opened using the regular open().

Parameters:
self a self-referential pointer to the mschm_decompressor instance being called
chm the CHM helpfile to search for the file
filename the filename of the file to search for
f_ptr a pointer to a caller-provded mschmd_file structure
f_size sizeof(struct mschmd_file)
Returns:
an error code, or MSPACK_ERR_OK if successful
See also:
open(), close(), fast_find(), extract()


Generated by  Doxygen 1.6.0   Back to index