- Timestamp:
- Jan 2, 2009, 6:16:47 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/GPSS/gpssDecoder.cpp
r1426 r1427 57 57 errmsg.clear(); 58 58 59 if (_mode == MODE_SEARCH) { 60 _buffer.clear(); 61 } 59 62 _buffer.append(data, dataLen); 60 63 61 64 for (;;) { 62 65 66 if (_buffer.size() < 1) { 67 _mode = MODE_SEARCH; 68 return success; 69 } 70 63 71 if (_mode == MODE_SEARCH) { 64 if (_buffer.size() < 1) {65 _mode = MODE_SEARCH;66 return success;67 }68 72 if (_buffer[0] == 0x02) { 69 73 _mode = MODE_TYPE; 74 } 75 else { 76 _mode = MODE_SEARCH; 70 77 } 71 78 _buffer.erase(0,1); … … 73 80 74 81 else if (_mode == MODE_TYPE) { 75 if (_buffer.size() < 1) {76 _mode = MODE_SEARCH;77 return success;78 }79 82 if (_buffer[0] == 0x00) { 80 83 _mode = MODE_EPOCH; … … 82 85 _mode = MODE_EPH; 83 86 } else { 84 errmsg.push_back("Unknown record type");85 87 _mode = MODE_SEARCH; 86 88 } … … 112 114 memcpy(&epochHdr, _buffer.data(), sizeof(epochHdr)); 113 115 _buffer.erase(0,sizeof(epochHdr)); 116 if (_buffer.size() < epochHdr.n_svs * sizeof(t_obsInternal)) { 117 _mode = MODE_SEARCH; 118 return success; 119 } 114 120 for (int is = 1; is <= epochHdr.n_svs; is++) { 115 if (_buffer.size() < sizeof(t_obsInternal)) {116 _mode = MODE_SEARCH;117 return success;118 }119 121 t_obs* obs = new t_obs(); 120 122 memcpy(&(obs->_o), _buffer.data(), sizeof(t_obsInternal)); … … 138 140 139 141 else { 140 if (_buffer.size() < 1) {141 _mode = MODE_SEARCH;142 return success;143 }144 142 _buffer.erase(0,1); 145 143 _mode = MODE_SEARCH;
Note:
See TracChangeset
for help on using the changeset viewer.