Changeset 53


Ignore:
Timestamp:
Feb 20, 2008, 2:50:51 PM (11 years ago)
Author:
cameron
Message:

Restore fstat(fileno(infilee)) as at rev 46.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/xmlbuffer.c

    r52 r53  
    273273XML_Buffer_Interface * XML_Buffer_Interface::BufferFactory(char* filename) {
    274274        int chars_read;
    275         struct stat fileinfo;
    276         stat(filename, &fileinfo);
    277         int buffer_packs = (fileinfo.st_size + BUFFER_PADDING + PACKSIZE - 1)/PACKSIZE;
    278         BytePack * src_data = simd_new(buffer_packs);
    279         unsigned char * bytedata = (unsigned char *) src_data;
    280275        FILE *infile;
    281276        infile = fopen(filename, "rb");
     
    284279                exit(-1);
    285280        }
     281        struct stat fileinfo;
     282        if(fstat(fileno(infile), &fileinfo)!=0) {
     283                fprintf(stderr, "Error: cannot fstat %s for file size.\n", filename);
     284                exit(-1);
     285        }
     286        int buffer_packs = (fileinfo.st_size + BUFFER_PADDING + PACKSIZE - 1)/PACKSIZE;
     287        BytePack * src_data = simd_new(buffer_packs);
     288        unsigned char * bytedata = (unsigned char *) src_data;
    286289        chars_read = fread(bytedata, 1, fileinfo.st_size, infile);
    287290        if (chars_read != fileinfo.st_size) {
Note: See TracChangeset for help on using the changeset viewer.