Changeset 526:feff4c1f2cb2


Ignore:
Timestamp:
04/23/08 15:45:14 (2 years ago)
Author:
Mateusz Loskot <mateusz@…>
Branch:
default
Convert:
svn:1766ff46-f334-0410-ab20-d63176f87757/trunk@591
Message:

Fixed bug in LASHeader with returning string members generated with non-null-ended bytes arrays.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/lasheader.cpp

    r522 r526  
    5757    p = std::memcpy(m_signature, other.m_signature, eFileSignatureSize); 
    5858    assert(p == m_signature); 
    59 //    m_signature = other.m_signature; 
    6059    p = std::memcpy(m_projectId4, other.m_projectId4, eProjectId4Size);  
    6160    assert(p == m_projectId4); 
    6261    p = std::memcpy(m_systemId, other.m_systemId, eSystemIdSize); 
    6362    assert(p == m_systemId); 
    64 //    m_systemId = other.m_systemId; 
    6563    p = std::memcpy(m_softwareId, other.m_softwareId, eSoftwareIdSize); 
    6664    assert(p == m_softwareId); 
    67 //    m_softwareId = other.m_softwareId; 
    6865    std::vector<uint32_t>(other.m_pointRecordsByReturn).swap(m_pointRecordsByReturn); 
    6966    assert(ePointsByReturnSize >= m_pointRecordsByReturn.size()); 
     
    7875        p = std::memcpy(m_signature, rhs.m_signature, eFileSignatureSize); 
    7976        assert(p == m_signature); 
    80 //        m_signature = rhs.m_signature; 
    8177        m_sourceId = rhs.m_sourceId; 
    8278        m_reserved = rhs.m_reserved; 
     
    9086        p = std::memcpy(m_systemId, rhs.m_systemId, eSystemIdSize); 
    9187        assert(p == m_systemId); 
    92         //m_systemId = rhs.m_systemId; 
    9388        p = std::memcpy(m_softwareId, rhs.m_softwareId, eSoftwareIdSize); 
    9489        assert(p == m_softwareId); 
    95         //m_softwareId = rhs.m_softwareId; 
    9690        m_createDOY = rhs.m_createDOY; 
    9791        m_createYear = rhs.m_createYear; 
     
    147141std::string LASHeader::GetFileSignature() const 
    148142{ 
    149     return m_signature; 
     143    return std::string(m_signature, eFileSignatureSize); 
    150144} 
    151145 
     
    215209std::string LASHeader::GetSystemId(bool pad /*= false*/) const 
    216210{ 
    217     std::string tmp(m_systemId); 
     211    // copy array of chars and trim zeros if smaller than 32 bytes 
     212    std::string tmp(std::string(m_systemId, eSystemIdSize).c_str()); 
    218213 
    219214    // pad right side with spaces 
     
    239234} 
    240235 
    241 std::string  LASHeader::GetSoftwareId(bool pad /*= false*/) const 
    242 { 
    243     std::string tmp(m_softwareId); 
     236std::string LASHeader::GetSoftwareId(bool pad /*= false*/) const 
     237{ 
     238    std::string tmp(std::string(m_softwareId, eSoftwareIdSize).c_str()); 
    244239 
    245240    // pad right side with spaces 
Note: See TracChangeset for help on using the changeset viewer.