Ethereal-dev: RE: [Ethereal-dev] packet-http.c bug or typo?

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Biot Olivier <Olivier.Biot@xxxxxxxxxxx>
Date: Wed, 11 Feb 2004 10:20:03 +0100
Hi Didier,

This looks like it only shows up when the tab expands to 8 spaces; when it
expands to 4 spaces, it should read (as lines 856--857 use diffenent tab
expansion than the other lines):

        if (isHttpRequestOrReply && req_dissector) {
            if (!stat_info->request_method)
                stat_info->request_method = g_malloc( index+1 );
            strncpy( stat_info->request_method, data, index);
            stat_info->request_method[index] = '\0';
        }

Which is correct. The last "fix" you proposed puts braces after the if()
clause, but it shouldn't be required. We (and I mean myself for sure :)
should take care in not ruining indentation...

I think we want to add a section to README.developer on the white space
convention in source files. Some conventions I've seen so far:
* Tab expansion: 8 or 4 spaces
* Indentation: 2, 4 or 8 spaces

Commonest are 8-space tabs, 2-space or 4-space indentation.

I propose that we add a short notice in every source file describing the
tabulation and indentation convention that applies to each file.

Note for VI users:
# Set tab size to N spaces
:set ts=N
# Set indentation (or when you hit the TAB key) to M spaces
:set sw=M

I *tend* to use N=M=4 in most of my source files, however I am aware that
not all text editors support tab expansions that differ from the default 8
stops. Maybe we should politely state that using tab expansion different
from the de facto default of 8 spaces is a Bad Idea.

Regards,

Olivier

|From: didier
|
|Hi,
|Can you double check packet-http.c around line 854.
|                 if (isHttpRequestOrReply && req_dissector) {
|                         if (!stat_info->request_method)
|                                 stat_info->request_method = g_malloc( 
|index+1 );
|                                 strncpy( stat_info->request_method, 
|data, index);
|                                 
|stat_info->request_method[index] = '\0';
|                 }
|it's
|                 if (isHttpRequestOrReply && req_dissector) {
|                         if (!stat_info->request_method) {
|                                 stat_info->request_method = g_malloc( 
|index+1 );
|                                 strncpy( stat_info->request_method, 
|data, index);
|                                 
|stat_info->request_method[index] = '\0';
|			}
|                 }
|or
|                 if (isHttpRequestOrReply && req_dissector) {
|                         if (!stat_info->request_method) {
|                                 stat_info->request_method = g_malloc( 
|index+1 );
|			}
|                         strncpy( stat_info->request_method, 
|data, index);
|                         stat_info->request_method[index] = '\0';
|                 }
|
|Didier