- Timestamp:
- Jan 3, 2009, 11:15:03 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/GPSS/gpssDecoder.cpp
r1429 r1430 63 63 _buffer = _buffer.mid(iBeg); 64 64 65 // Record Size66 // -----------67 65 int recordSize; 68 if (_buffer.length() >= int(2 + sizeof(recordSize)) && 69 ( char(_buffer[1]) == 0x00 || char(_buffer[1]) == 0x01) ) { 70 memcpy(&recordSize, _buffer.data()+2, sizeof(recordSize)); 71 } 72 else { 73 break; 74 } 66 int crc; 75 67 76 68 // Observations … … 82 74 sizeof(epochHdr)); 83 75 84 if (_buffer.length() >= int(2 + sizeof(recordSize) + sizeof(epochHdr) + 85 epochHdr.n_svs * sizeof(t_obsInternal))) { 86 for (int is = 1; is <= epochHdr.n_svs; is++) { 76 int reqLength = 2 + sizeof(recordSize) + sizeof(epochHdr) + 77 epochHdr.n_svs * sizeof(t_obsInternal) + sizeof(crc) + 1; 78 79 if (_buffer.length() >= reqLength) { 80 for (int is = 0; is < epochHdr.n_svs; is++) { 87 81 t_obs* obs = new t_obs(); 88 memcpy(&(obs->_o), _buffer.data(), sizeof(t_obsInternal)); 82 memcpy(&(obs->_o), _buffer.data() + 2 + sizeof(recordSize) + 83 sizeof(epochHdr) + is * sizeof(t_obsInternal), 84 sizeof(t_obsInternal)); 89 85 _obsList.push_back(obs); 90 86 } … … 96 92 // --------- 97 93 else if (char(_buffer[1]) == 0x01) { 98 if (_buffer.length() >= int(2+sizeof(recordSize)+ sizeof(gpsephemeris))){ 94 int reqLength = 2 + sizeof(recordSize) + sizeof(gpsephemeris) + 95 sizeof(crc) + 1; 96 if (_buffer.length() >= reqLength) { 99 97 gpsephemeris* gpsEph = new gpsephemeris; 100 memcpy(gpsEph, _buffer.data(), sizeof(gpsephemeris)); 98 memcpy(gpsEph, _buffer.data() + 2 + sizeof(recordSize) + 99 sizeof(gpsephemeris), sizeof(gpsephemeris)); 101 100 emit newGPSEph(gpsEph); 102 101 }
Note:
See TracChangeset
for help on using the changeset viewer.