Audio-Scan

 view release on metacpan or  search on metacpan

Scan.xs  view on Meta::CPAN

#ifdef _MSC_VER
  BOOL fOk;
  WIN32_FILE_ATTRIBUTE_DATA fileInfo;

  fOk = GetFileAttributesEx(file, GetFileExInfoStandard, (void *)&fileInfo);
  mtime = fileInfo.ftLastWriteTime.dwLowDateTime;
  size = (uint64_t)fileInfo.nFileSizeLow;
#else
  struct stat buf;

  if (stat(file, &buf) != -1) {
    mtime = (int)buf.st_mtime;
    size = (uint64_t)buf.st_size;
  }
#endif

  memset(hashstr, 0, sizeof(hashstr));
  snprintf(hashstr, sizeof(hashstr) - 1, "%s%d%llu", file, mtime, size);
  hash = hashlittle(hashstr, strlen(hashstr), 0);
  
  return hash;

src/common.c  view on Meta::CPAN

  off_t file_size;

  PerlIO_seek(infile, 0, SEEK_END);
  file_size = PerlIO_tell(infile);
  PerlIO_seek(infile, 0, SEEK_SET);

  return file_size;
#else
  struct stat buf;

  if ( !fstat( PerlIO_fileno(infile), &buf ) ) {
    return buf.st_size;
  }

  warn("Unable to stat: %s\n", strerror(errno));

  return 0;
#endif
}

int



( run in 1.067 second using v1.01-cache-2.11-cpan-49f99fa48dc )