Show
Ignore:
Timestamp:
08/17/08 00:12:18 (5 months ago)
Author:
hobu
Message:

Fix #68 - incorrect return type for the length of the VLR in the ReadVLR functions

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/detail/reader11.cpp

    r816 r830  
    311311    uint32_t count = header.GetRecordsCount(); 
    312312    header.SetRecordsCount(0); 
     313     
    313314    for (uint32_t i = 0; i < count; ++i) 
    314315    { 
     316 
    315317        read_n(vlrh, m_ifs, sizeof(VLRHeader)); 
    316  
    317         int16_t count = vlrh.recordLengthAfterHeader; 
     318         
     319 
     320        uint16_t length = vlrh.recordLengthAfterHeader; 
     321         
     322        if (length < 1) { 
     323            throw std::domain_error("VLR record length must be at least 1 byte long"); 
     324        } 
    318325          
    319326        std::vector<uint8_t> data; 
    320         data.resize(count); 
    321  
    322         read_n(data.front(), m_ifs, count); 
    323           
     327        data.resize(length); 
     328 
     329        read_n(data.front(), m_ifs, length); 
     330 
    324331        LASVLR vlr; 
    325332        vlr.SetReserved(vlrh.reserved); 
     
    331338 
    332339        header.AddVLR(vlr); 
    333     } 
    334      
     340 
     341    } 
     342 
    335343    return true; 
    336344}