On 11/16/05 16:35, Norman Brandinger wrote:
A recent patch posted by Anad (nicer compiling) produces a compile without alot of messages. Compiler warning are still produced. I noted that there was a warning in items.c line 925. Below are some possible issues that I've uncovered in regard to this.

1. In parser/parse_content.h the comments state that the value returned is an integer, however, it's cast as a long. Either the comment or the code should be reviewed. 2. Both get_content_type() and get_content_length() are set to the same value. This probably isn't what was intended. 3. In parser/msg_parser.c below, the DBG statement wants to display the content length, however, the value that is being used is hdr->parsed, not hdr->body.len.

It appears "on the surface" that there may be some problems here, it's also possible that code was intentionally written this way. Can one of the developers confirm if there is a problem.
it was written this way, the integer value of the content header is stored over the 'void* parsed' attribute. The cast to 'long' comes some time to ensure same size as 'void*'.

Cheers,
Daniel

Regards,
Norm



parser/parse_content.h

/*
* returns the content-length value of a sip_msg as an integer
*/
#define get_content_length(_msg_) ((long)((_msg_)->content_length->parsed))


/*
* returns the content-type value of a sip_msg as an integer
*/
#define get_content_type(_msg_) ((int)(long)((_msg_)->content_type->parsed))




parser/msg_parser.c

               case HDR_CONTENTLENGTH_T:
                       hdr->body.s=tmp;
                       tmp=parse_content_length(tmp,end, &integer);
                       if (tmp==0){
LOG(L_ERR, "ERROR:get_hdr_field: bad content_length header\n");
                               goto error;
                       }
                       hdr->parsed=(void*)(long)integer;
                       hdr->body.len=tmp-hdr->body.s;
                       DBG("DEBUG: get_hdr_body : content_length=%d\n",
                                       (int)(long)hdr->parsed);
                       break;


_______________________________________________
Devel mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/devel


_______________________________________________
Devel mailing list
[email protected]
http://openser.org/cgi-bin/mailman/listinfo/devel

Reply via email to