VirtualBox

Changeset 50135 in vbox for trunk/src/VBox/Devices


Ignore:
Timestamp:
Jan 21, 2014 9:28:21 AM (11 years ago)
Author:
vboxsync
Message:

Devices/NAT: a warning and spaces

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Network/slirp/resolv_conf_parser.c

    r50131 r50135  
    11/* $Id$ */
    22/** @file
    3  * resolv_conf_parser.c - parser of resolv.conf resolver(5) 
     3 * resolv_conf_parser.c - parser of resolv.conf resolver(5)
    44 */
    55
     
    2929#include "resolv_conf_parser.h"
    3030
    31 enum RCP_TOKEN {
     31enum RCP_TOKEN
     32{
    3233  tok_eof = -1, /* EOF */
    3334  tok_string = -2, /* string */
     
    9091        int xdigit, digit, dot_number;
    9192        RT_ZERO(parser->rcpp_str_buffer);
    92        
     93
    9394        dot_number = 0;
    9495        xdigit = 1;
     
    116117                {
    117118                    int port = 0;
    118                     do 
     119                    do
    119120                    {
    120121                        *ptr++ = tok;
     
    127128
    128129                    PARSER_BUFFER_EXCEEDED(parser, ptr);
    129                    
    130                     if (port == 0) 
     130
     131                    if (port == 0)
    131132                        return tok_ipv6;
    132133                    else if (port == 1)
    133134                        return tok_ipv6_port;
    134                     else 
     135                    else
    135136                    {
    136137                        /* eats rest of the token */
    137                         do 
     138                        do
    138139                        {
    139140                            *ptr++ = tok;
    140141                            tok = GETCHAR(parser);
    141                         } while(   PARSER_STOP(tok, parser, ptr) 
     142                        } while(   PARSER_STOP(tok, parser, ptr)
    142143                                && (isalnum(tok) || tok == '.'  || tok == '_' || tok == '-'));
    143144
    144145                        PARSER_BUFFER_EXCEEDED(parser, ptr);
    145                        
     146
    146147                        return tok_string;
    147148                    }
     
    161162                    digit &= (isdigit(tok) || (tok == '.'));
    162163                    tok = GETCHAR(parser);
    163                 } while(   PARSER_STOP(tok, parser, ptr) 
     164                } while(   PARSER_STOP(tok, parser, ptr)
    164165                        && (isalnum(tok) || tok == '.' || tok == '_' || tok == '-'));
    165                
     166
    166167                PARSER_BUFFER_EXCEEDED(parser, ptr);
    167168
     
    175176        } while(   PARSER_STOP(tok, parser, ptr)
    176177                && (isalnum(tok) || tok == ':' || tok == '.' || tok == '-' || tok == '_'));
    177        
     178
    178179        PARSER_BUFFER_EXCEEDED(parser, ptr);
    179180
     
    207208            tok = GETCHAR(parser);
    208209        } while (tok != EOF && tok != '\r' && tok != '\n');
    209        
     210
    210211        if (tok == EOF) return tok_eof;
    211212
     
    239240    {
    240241        struct rcp_state *st;
     242        RTNETADDR *address;
     243        char *str_address;
     244
    241245        Assert(parser->rcpp_state);
    242        
     246
    243247        st = parser->rcpp_state;
    244         RTNETADDR *address = &st->rcps_nameserver[st->rcps_num_nameserver];
    245         char *str_address = &st->rcps_nameserver_str_buffer[st->rcps_num_nameserver * RCPS_IPVX_SIZE];
     248        address = &st->rcps_nameserver[st->rcps_num_nameserver];
     249        str_address = &st->rcps_nameserver_str_buffer[st->rcps_num_nameserver * RCPS_IPVX_SIZE];
    246250#ifdef RT_OS_DARWIN
    247251        if (   tok == tok_ipv4_port
     
    266270
    267271            strcpy(str_address, parser->rcpp_str_buffer);
    268        
     272
    269273            st->rcps_str_nameserver[st->rcps_num_nameserver] = str_address;
    270274
     
    279283                    int rc = RTNetStrToIPv4Addr(parser->rcpp_str_buffer, &address->uAddr.IPv4);
    280284                    if (RT_FAILURE(rc)) return tok_error;
    281                    
     285
    282286                    address->enmType = RTNETADDRTYPE_IPV4;
    283287                }
     
    325329    st = parser->rcpp_state;
    326330
    327     if (   tok != tok_number 
     331    if (   tok != tok_number
    328332        || tok == tok_eof)
    329333        return tok_error;
     
    349353
    350354    /**
    351      * It's nowhere specified how resolver should react on dublicats 
     355     * It's nowhere specified how resolver should react on dublicats
    352356     * of 'domain' declarations, let's assume that resolv.conf is broken.
    353357     */
     
    359363    strcpy(st->rcps_domain_buffer, parser->rcpp_str_buffer);
    360364    /**
    361      * We initialize this pointer in place, just make single pointer check 
    362      * in 'domain'-less resolv.conf. 
     365     * We initialize this pointer in place, just make single pointer check
     366     * in 'domain'-less resolv.conf.
    363367     */
    364368    st->rcps_domain = st->rcps_domain_buffer;
     
    383387    Assert(parser->rcpp_state);
    384388    st = parser->rcpp_state;
    385    
     389
    386390    /**
    387      * We asume that duplication of search list in resolv.conf isn't correct. 
     391     * We asume that duplication of search list in resolv.conf isn't correct.
    388392     */
    389393    if (   tok == tok_eof
     
    406410        trailing -= len + 1; /* 1 reserved for '\0' */
    407411
    408         st->rcps_searchlist[i] = ptr; 
    409 
    410     } while(  (tok = rcp_get_token(parser)) == tok_string 
     412        st->rcps_searchlist[i] = ptr;
     413
     414    } while(  (tok = rcp_get_token(parser)) == tok_string
    411415            && ++i != RCPS_MAX_SEARCHLIST);
    412416
     
    420424 *      ::= portexpr | expr
    421425 *      ::= domainexpr | expr
    422  *      ::= searchexpr | expr 
     426 *      ::= searchexpr | expr
    423427 *      ::= searchlistexpr | expr
    424428 *      ::= search_orderexpr | expr
     
    432436
    433437    while(   tok != tok_eof
    434           && tok != tok_error) 
     438          && tok != tok_error)
    435439    {
    436440        switch (tok)
     
    476480
    477481    /**
    478      * for debugging need: with RCP_STANDALONE it's possible 
     482     * for debugging need: with RCP_STANDALONE it's possible
    479483     * to run simplefied scenarious like
    480484     *
    481      * # cat /etc/resolv.conf | rcp-test-0 
     485     * # cat /etc/resolv.conf | rcp-test-0
    482486     * or in lldb
    483487     * # process launch -i /etc/resolv.conf
     
    501505        RTStrmClose(parser.rcpp_stream);
    502506
    503     if (rc == -1) 
     507    if (rc == -1)
    504508        return -1;
    505509
     
    512516        state->rcps_port = 53;
    513517
    514     for(i = 0;  (state->rcps_flags & RCPSF_NO_STR2IPCONV) == 0 
     518    for(i = 0;  (state->rcps_flags & RCPSF_NO_STR2IPCONV) == 0
    515519             && i != RCPS_MAX_NAMESERVERS; ++i)
    516520    {
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette