Changeset df2dff9 for lib/format_erf.c


Ignore:
Timestamp:
08/05/05 11:11:38 (16 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
f99a183
Parents:
da8b03e
Message:

Fixed reading and writing erf without zlib.
Tidyed up trace_output creation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_erf.c

    rda8b03e rdf2dff9  
    478478        void *buffer2 = buffer;
    479479        int rlen;
    480        
     480#if HAVE_ZLIB
    481481        if ((numbytes=gzread(INPUT.file,
    482482                                        buffer,
     
    485485                return -1;
    486486        }
     487#else
     488        if ((numbytes = read(INPUT.file, buffer, dag_record_size)) == -1) {
     489                perror("read");
     490                return -1;
     491        }
     492#endif
    487493        if (numbytes == 0) {
    488494                return 0;
     
    592598static int erf_write_packet(struct libtrace_out_t *libtrace, struct libtrace_packet_t *packet) {
    593599        int numbytes = 0;
    594 
    595         if ((numbytes = gzwrite(libtrace->format_data->output.file, packet->buffer, packet->size)) == 0) {
     600#if HAVE_ZLIB
     601        if ((numbytes = gzwrite(OUTPUT.file, packet->buffer, packet->size)) == 0) {
    596602                perror("gzwrite");
    597603                return -1;
    598604        }
     605#else
     606        if ((numbytes = write(OUTPUT.file, packet->buffer, packet->size)) == 0) {
     607                perror("write");
     608                return -1;
     609        }
     610#endif
    599611        return numbytes;
    600612}
Note: See TracChangeset for help on using the changeset viewer.