Changeset 1438 in ntrip for trunk/BNC/GPSS


Ignore:
Timestamp:
Jan 3, 2009, 1:15:04 PM (16 years ago)
Author:
mervart
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/GPSS/gpssDecoder.cpp

    r1437 r1438  
    8080  _buffer += QByteArray(data, dataLen);
    8181
     82  bool obsFound = false;
     83  bool ephFound = false;
    8284  int iBeg;
    8385  while ( (iBeg = _buffer.indexOf(0x02)) != -1) {
     
    8991    // Observations
    9092    // ------------
    91     if      (char(_buffer[1]) == 0x00) {
     93    if      (_buffer.length() > 0 && char(_buffer[1]) == 0x00) {
    9294
    9395      int reqLength = 2 + sizeof(recordSize) + sizeof(EPOCHHEADER);
     
    109111          if (crc == crcCal) {
    110112            for (int is = 0; is < epochHdr.n_svs; is++) {
     113              obsFound = true;
    111114              t_obs* obs = new t_obs();
    112115              memcpy(&(obs->_o), _buffer.data() + 2 + sizeof(recordSize) +
     
    123126    // Ephemeris
    124127    // ---------
    125     else if (char(_buffer[1]) == 0x01) {
     128    else if (_buffer.length() > 0 && char(_buffer[1]) == 0x01) {
    126129      int reqLength = 2 + sizeof(recordSize) + sizeof(gpsephemeris) +
    127         sizeof(crc) + 1;
     130                      sizeof(crc) + 1;
    128131
    129132      if (_buffer.length() >= reqLength) {
     
    134137
    135138        if (crc == crcCal) {
     139          ephFound = true;
    136140          gpsephemeris* gpsEph = new gpsephemeris;
    137141          memcpy(gpsEph, _buffer.data() + 2 + sizeof(recordSize),
     
    148152  }
    149153
    150   return success;
     154  if (obsFound || ephFound) {
     155    return success;
     156  }
     157  else {
     158    return failure;
     159  }
    151160}
Note: See TracChangeset for help on using the changeset viewer.