Changeset 226 for trunk/lib


Ignore:
Timestamp:
04/05/11 15:01:41 (14 years ago)
Author:
tim
Message:

several fixes for pyregfi Windows portability
better error handling within pyregfi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/regfi.c

    r225 r226  
    573573
    574574
    575 off_t regfi_raw_seek(REGFI_RAW_FILE* self, off_t offset, int whence)
    576 {
     575int64_t regfi_raw_seek(REGFI_RAW_FILE* self, uint64_t offset, int whence)
     576{
     577  if(sizeof(off_t) == 4 && offset > 2147483647)
     578  {
     579    errno = EOVERFLOW;
     580    return -1;
     581  }
    577582  return lseek(*(int*)self->state, offset, whence);
    578583}
     
    587592 * Convenience function to wrap up the ugly callback stuff
    588593 *****************************************************************************/
    589 off_t regfi_seek(REGFI_RAW_FILE* file_cb, off_t offset, int whence)
     594uint64_t regfi_seek(REGFI_RAW_FILE* file_cb, uint64_t offset, int whence)
    590595{
    591596  return file_cb->seek(file_cb, offset, whence);
     
    15611566  REGFI_HBIN* hbin = NULL;
    15621567  uint32_t hbin_off, cache_secret;
    1563   int32_t file_length;
     1568  int64_t file_length;
    15641569  bool rla;
    15651570
     
    15671572   * and one hbin.
    15681573   */
    1569   file_length = file_cb->seek(file_cb, 0, SEEK_END);
     1574  file_length = regfi_seek(file_cb, 0, SEEK_END);
    15701575  if(file_length < REGFI_REGF_SIZE+REGFI_HBIN_ALLOC)
    15711576  {
     
    15741579    return NULL;
    15751580  }
    1576   file_cb->seek(file_cb, 0, SEEK_SET);
     1581  regfi_seek(file_cb, 0, SEEK_SET);
    15771582
    15781583  if(output_encoding != REGFI_ENCODING_UTF8
Note: See TracChangeset for help on using the changeset viewer.