Changeset d8f02df


Ignore:
Timestamp:
02/27/06 16:53:10 (15 years ago)
Author:
Perry Lorier <perry@…>
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:
5fb2251
Parents:
8a8e54b
Message:

Cleanup even more warnings (Finding a few bugs where functions don't always
call return!)

Location:
lib
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • lib/fifo.c

    rd5879cc rd8f02df  
    3737#include <string.h> /* bzero */
    3838#include "fifo.h"
     39#include "libtrace_int.h"
    3940
    4041#include <sys/types.h>
     
    8384
    8485        if ((fifo->base = malloc(fifo->length)) == 0) {
    85                 trace_set_err(errno,"malloc failed");
    8686                return 0;
    8787        }
  • lib/format_erf.c

    rd5879cc rd8f02df  
    555555                dag_record_t *erfptr, int pad, void *buffer, size_t size) {
    556556        int numbytes = 0;
    557         assert(size>=0 && size<=65536);
     557        assert(size<=65536);
    558558        /* FIXME: Shouldn't this return != dag_record_size+pad on error? */
    559559        if ((numbytes = LIBTRACE_WRITE(OUTPUT.file, erfptr, dag_record_size + pad)) == 0) {
  • lib/format_legacy.c

    rab4cb04 rd8f02df  
    152152                        packet->type = RT_DATA_LEGACY_ETH;
    153153                        break;
     154                default:
     155                        assert(0);
    154156        }
    155157       
  • lib/format_pcap.c

    rd5879cc rd8f02df  
    161161        pcap_close(INPUT.pcap);
    162162        INPUT.pcap=NULL;
     163
     164        return 0;
    163165}
    164166
     
    260262        packet->payload = (void *)pcappkt;
    261263
    262         assert(pcaphdr->caplen>=0 && pcaphdr->caplen<=65536);
     264        assert(pcaphdr->caplen<=65536);
    263265}
    264266
     
    388390        struct pcap_pkthdr *pcapptr = 0;
    389391        pcapptr = (struct pcap_pkthdr *)packet->header;
    390         assert(pcapptr->caplen>=0 && pcapptr->caplen<=65536);
     392        assert(pcapptr->caplen<=65536);
    391393        return pcapptr->caplen;
    392394}
  • lib/format_rt.c

    rab4cb04 rd8f02df  
    374374                struct libtrace_packet_t *packet) {
    375375       
    376         char buf[RP_BUFSIZE];
    377         int read_required = 0;
    378376        rt_header_t pkt_hdr;
    379         char msg_buf[RP_BUFSIZE];
    380377        int pkt_size = 0;
    381378       
  • lib/format_wag.c

    rab4cb04 rd8f02df  
    185185                        assert(OPTIONS.zlib.level>=0
    186186                                        && OPTIONS.zlib.level<=9);
    187                         break;
     187                        return 0;
    188188#else
    189189                case TRACE_OPTION_OUTPUT_COMPRESS:
     
    204204{
    205205        close(INPUT.fd);
     206
     207        return 0;
    206208}
    207209
     
    224226
    225227static int wag_read(struct libtrace_t *libtrace, void *buffer, size_t len) {
    226         int numbytes;
    227         int framesize;
     228        size_t framesize;
    228229        char *buf_ptr = (char *)buffer;
    229230        int to_read = 0;
    230231        uint16_t magic = 0;
    231         uint16_t lctr = 0;
    232232
    233233        assert(libtrace);
  • lib/libtrace.h

    r0d768c8 rd8f02df  
    765765 */
    766766SIMPLE_FUNCTION
    767 int trace_get_capture_length(const libtrace_packet_t *packet);
     767size_t trace_get_capture_length(const libtrace_packet_t *packet);
    768768
    769769/** Get the size of the packet as it was seen on the wire.
     
    774774 */
    775775SIMPLE_FUNCTION
    776 int trace_get_wire_length(const libtrace_packet_t *packet);
     776size_t trace_get_wire_length(const libtrace_packet_t *packet);
    777777
    778778/** Get the length of the capture framing headers.
     
    785785 */
    786786SIMPLE_FUNCTION
    787 int trace_get_framing_length(const libtrace_packet_t *packet);
     787size_t trace_get_framing_length(const libtrace_packet_t *packet);
    788788
    789789/** Truncate ("snap") the packet at the suggested length
  • lib/trace.c

    rd5879cc rd8f02df  
    292292        libtrace->filter = NULL;
    293293        libtrace->snaplen = 0;
     294        libtrace->started=false;
    294295
    295296        for (i = 0; i < nformats; i++) {
     
    330331
    331332        libtrace->fifo = create_tracefifo(1048576);
     333        if (!libtrace->fifo) {
     334                trace_set_err(libtrace,ENOMEM,"Could not allocate memory for fifo");
     335                free(scan);
     336                return libtrace;
     337        }
    332338        assert(libtrace->fifo);
    333339        free(scan);
    334         libtrace->started=false;
    335340        trace_set_err(libtrace,0,"");
    336341        return libtrace;
     
    594599        memcpy(dest->header,packet->header,trace_get_framing_length(packet));
    595600        memcpy(dest->payload,packet->payload,trace_get_capture_length(packet));
     601
     602        return dest;
    596603}
    597604
     
    631638                do {
    632639                        packet->size=libtrace->format->read_packet(libtrace,packet);
    633                         if (packet->size==-1 || packet->size==0)
     640                        if (packet->size==(size_t)-1 || packet->size==0)
    634641                                return packet->size;
    635642                        if (libtrace->filter) {
     
    11691176}
    11701177
    1171 int trace_get_capture_length(const struct libtrace_packet_t *packet) {
     1178size_t trace_get_capture_length(const libtrace_packet_t *packet) {
    11721179
    11731180        assert(packet->size>0 && packet->size<65536);
     
    11881195 * not be the same as the Capture Len.
    11891196 */
    1190 int trace_get_wire_length(const struct libtrace_packet_t *packet){
     1197size_t trace_get_wire_length(const libtrace_packet_t *packet){
    11911198        assert(packet->size>0 && packet->size<65536);
    11921199
     
    12071214 */
    12081215SIMPLE_FUNCTION
    1209 int trace_get_framing_length(const libtrace_packet_t *packet) {
     1216size_t trace_get_framing_length(const libtrace_packet_t *packet) {
    12101217        if (packet->trace->format->get_framing_length) {
    12111218                return packet->trace->format->get_framing_length(packet);
Note: See TracChangeset for help on using the changeset viewer.