whpthomas / GPX

Gcode to x3g conversion post processor
GNU General Public License v2.0
98 stars 16 forks source link

Invalid tests for 0xD5 in received s3g/x3g frames #15

Open dcnewman opened 9 years ago

dcnewman commented 9 years ago

Since compiler warnings were disabled with -w, these two important warnings went unnoticed,

gpx.c:5445:38: warning: comparison of constant 213 with expression of type 'char' is always true [-Wtautological-constant-out-of-range-compare] if(gpx->buffer.in[0] != 0xD5) { gpx.c:5460:42: warning: comparison of constant 213 with expression of type 'char' is always false [-Wtautological-constant-out-of-range-compare] if(gpx->buffer.in[0] == 0xD5) break;

Ooops. A fix is to cast to (unsigned char)