Changeset 596

Show
Ignore:
Timestamp:
08/26/08 11:24:34
Author:
rachel
Message:

limited_read_time cannot assume that time_t is 4 octets long.
On SunOS 5.10, it is 8 octets.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openpgpsdk/trunk/src/lib/packet-parse.c

    r582 r596  
    535535                             ops_parse_info_t *pinfo) 
    536536    { 
    537     return limited_read_scalar((unsigned *)dest,4,region,pinfo); 
     537    /* 
     538     * Cannot assume that time_t is 4 octets long -  
     539     * there is at least one architecture (SunOS 5.10) where it is 8. 
     540     */ 
     541    if (sizeof(*dest)==4) 
     542        { 
     543        return limited_read_scalar((unsigned *)dest,4,region,pinfo); 
     544        } 
     545    else 
     546        { 
     547        time_t mytime=0; 
     548        int i=0; 
     549        unsigned char c[1]; 
     550        for (i=0; i<4; i++) 
     551            { 
     552            if (!limited_read(c,1,region,pinfo)) 
     553                return 0; 
     554            mytime=(mytime << 8) + c[0]; 
     555            } 
     556        *dest=mytime; 
     557        return 1; 
     558        } 
    538559    } 
    539560 
  • openpgpsdk/trunk/src/lib/packet-print.c

    r574 r596  
    16081608               content->literal_data_header.format, 
    16091609               content->literal_data_header.filename); 
    1610         showtime("    modification time", 
     1610        print_time("    modification time", 
    16111611                 content->literal_data_header.modification_time); 
    16121612        printf("\n");