ttlappalainen / NMEA0183

Library for handling NMEA0183 messages
76 stars 48 forks source link

forgotten iBuf++ in File NMEA0183.cpp ? #21

Open BerndCirotzki opened 3 years ago

BerndCirotzki commented 3 years ago

I think there is an Issue in your Code. in File "NMEA0183.cpp" in Function "SendBuf"

181 // Could not send immediately, so buffer message 182 if ( strlen(buf)-iBuf >= MsgOutBufFreeSize() ) return false; // No room for message 183 184 size_t wp=MsgOutWritePos; 185 186 for (size_t temp = (MsgOutWritePos + 1) % MsgOutBufSize; 187 buf[iBuf]!=0 && temp!=MsgOutReadPos; 188 temp = (MsgOutWritePos + 1) % MsgOutBufSize ) { 189 MsgOutBuf[MsgOutWritePos]=buf[iBuf]; 190 MsgOutWritePos=temp; 191 iBuf++; // <------ Please add this here !!**** 192 } 193 194 if ( buf[iBuf]!=0 ) { ......

Am I right ?

greetings from Hamburg

ttlappalainen commented 3 years ago

Something strange. I have:

  for (size_t temp = (MsgOutWritePos + 1) % MsgOutBufSize;
       buf[iBuf]!=0 && temp!=MsgOutReadPos;
       temp = (MsgOutWritePos + 1) % MsgOutBufSize, iBuf++ ) {
    MsgOutBuf[MsgOutWritePos]=buf[iBuf];
    MsgOutWritePos=temp;
  }

But yes - same effect and seem to be missing on git.