Changeset 1426 in ntrip for trunk/BNC/GPSS
- Timestamp:
- Jan 2, 2009, 5:57:41 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/GPSS/gpssDecoder.cpp
r1425 r1426 62 62 63 63 if (_mode == MODE_SEARCH) { 64 if (_buffer.size() < 1) return success; 64 if (_buffer.size() < 1) { 65 _mode = MODE_SEARCH; 66 return success; 67 } 65 68 if (_buffer[0] == 0x02) { 66 69 _mode = MODE_TYPE; … … 70 73 71 74 else if (_mode == MODE_TYPE) { 72 if (_buffer.size() < 1) return success; 75 if (_buffer.size() < 1) { 76 _mode = MODE_SEARCH; 77 return success; 78 } 73 79 if (_buffer[0] == 0x00) { 74 80 _mode = MODE_EPOCH; … … 84 90 else if (_mode == MODE_EPOCH || _mode == MODE_EPH) { 85 91 int recordSize; 86 if (_buffer.size() < sizeof(recordSize)) return success; 92 if (_buffer.size() < sizeof(recordSize)) { 93 _mode = MODE_SEARCH; 94 return success; 95 } 87 96 memcpy(&recordSize, _buffer.data(), sizeof(recordSize)); 88 97 if (_mode == MODE_EPOCH) { … … 97 106 else if (_mode == MODE_EPOCH_BODY) { 98 107 EPOCHHEADER epochHdr; 99 if (_buffer.size() < sizeof(epochHdr)) return success; 108 if (_buffer.size() < sizeof(epochHdr)) { 109 _mode = MODE_SEARCH; 110 return success; 111 } 100 112 memcpy(&epochHdr, _buffer.data(), sizeof(epochHdr)); 101 113 _buffer.erase(0,sizeof(epochHdr)); 102 114 for (int is = 1; is <= epochHdr.n_svs; is++) { 103 if (_buffer.size() < sizeof(t_obsInternal)) return success; 115 if (_buffer.size() < sizeof(t_obsInternal)) { 116 _mode = MODE_SEARCH; 117 return success; 118 } 104 119 t_obs* obs = new t_obs(); 105 120 memcpy(&(obs->_o), _buffer.data(), sizeof(t_obsInternal)); … … 111 126 112 127 else if (_mode == MODE_EPH_BODY) { 113 if (_buffer.size() < sizeof(gpsephemeris)) return success; 128 if (_buffer.size() < sizeof(gpsephemeris)) { 129 _mode = MODE_SEARCH; 130 return success; 131 } 114 132 gpsephemeris* gpsEph = new gpsephemeris; 115 133 memcpy(gpsEph, _buffer.data(), sizeof(gpsephemeris)); … … 120 138 121 139 else { 122 if (_buffer.size() < 1) return success; 140 if (_buffer.size() < 1) { 141 _mode = MODE_SEARCH; 142 return success; 143 } 123 144 _buffer.erase(0,1); 124 145 _mode = MODE_SEARCH;
Note:
See TracChangeset
for help on using the changeset viewer.