Changeset 1127 for trunk/src


Ignore:
Timestamp:
01/26/09 13:54:14 (3 years ago)
Author:
ludovic.rousseau
Message:

use #defined named NAD, PCB, LEN and DATA instead of hard coded numbers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ifd/proto-t1.c

    r1084 r1127  
    5757 
    5858#define T1_BUFFER_SIZE          (3 + 254 + 2) 
     59 
     60#define NAD 0 
     61#define PCB 1 
     62#define LEN 2 
     63#define DATA 3 
    5964 
    6065/* internal state, do not mess with it. */ 
     
    236241                } 
    237242 
    238                 pcb = sdata[1]; 
     243                pcb = sdata[PCB]; 
    239244                switch (t1_block_type(pcb)) { 
    240245                case T1_R_BLOCK: 
     
    293298                        t1->nr ^= 1; 
    294299 
    295                         if (ct_buf_put(&rbuf, sdata + 3, sdata[2]) < 0) 
     300                        if (ct_buf_put(&rbuf, sdata + 3, sdata[LEN]) < 0) 
    296301                                goto error; 
    297302 
     
    329334                        case T1_S_IFS: 
    330335                                ifd_debug(1, "CT sent S-block with ifs=%u", 
    331                                           sdata[3]); 
    332                                 if (sdata[3] == 0) 
     336                                          sdata[DATA]); 
     337                                if (sdata[DATA] == 0) 
    333338                                        goto resync; 
    334                                 t1->ifsc = sdata[3]; 
    335                                 ct_buf_putc(&tbuf, sdata[3]); 
     339                                t1->ifsc = sdata[DATA]; 
     340                                ct_buf_putc(&tbuf, sdata[DATA]); 
    336341                                break; 
    337342                        case T1_S_WTX: 
     
    339344                                 * yet */ 
    340345                                ifd_debug(1, "CT sent S-block with wtx=%u", 
    341                                           sdata[3]); 
    342                                 t1->wtx = sdata[3]; 
    343                                 ct_buf_putc(&tbuf, sdata[3]); 
     346                                          sdata[DATA]); 
     347                                t1->wtx = sdata[DATA]; 
     348                                ct_buf_putc(&tbuf, sdata[DATA]); 
    344349                                break; 
    345350                        default: 
     
    622627                if (t1_block_type(pcb) == T1_S_BLOCK && 
    623628                    T1_S_TYPE(pcb) == T1_S_IFS && T1_S_IS_RESPONSE(pcb)) { 
    624                         if (sdata[2] != 1 || sdata[3] != ifsd) 
     629                        if (sdata[LEN] != 1 || sdata[DATA] != ifsd) 
    625630                                goto error; 
    626631                        break; 
Note: See TracChangeset for help on using the changeset viewer.