diff --git a/demod_2400.c b/demod_2400.c index e85db98..fd734b3 100644 --- a/demod_2400.c +++ b/demod_2400.c @@ -58,6 +58,7 @@ static inline int slice_phase4(uint16_t *m) { // void demodulate2400(struct mag_buf *mag) { + static struct modesMessage zeroMessage; struct modesMessage mm; unsigned char msg1[MODES_LONG_MSG_BYTES], msg2[MODES_LONG_MSG_BYTES], *msg; uint32_t j; @@ -70,7 +71,6 @@ void demodulate2400(struct mag_buf *mag) uint64_t sum_scaled_signal_power = 0; - memset(&mm, 0, sizeof(mm)); msg = msg1; for (j = 0; j < mlen; j++) { @@ -297,6 +297,7 @@ void demodulate2400(struct mag_buf *mag) msglen = modesMessageLenByType(bestmsg[0] >> 3); // Set initial mm structure details + mm = zeroMessage; mm.timestampMsg = mag->sampleTimestamp + (j*5) + bestphase; // compute message receive time as block-start-time + difference in the 12MHz clock diff --git a/net_io.c b/net_io.c index 2d5dfc4..96df46b 100644 --- a/net_io.c +++ b/net_io.c @@ -716,6 +716,7 @@ static int decodeBinMessage(struct client *c, char *p) { int j; char ch; unsigned char msg[MODES_LONG_MSG_BYTES]; + static struct modesMessage zeroMessage; struct modesMessage mm; MODES_NOTUSED(c); memset(&mm, 0, sizeof(mm)); @@ -732,6 +733,8 @@ static int decodeBinMessage(struct client *c, char *p) { } if (msgLen) { + mm = zeroMessage; + // Mark messages received over the internet as remote so that we don't try to // pass them off as being received by this instance when forwarding them mm.remote = 1; @@ -810,8 +813,10 @@ static int decodeHexMessage(struct client *c, char *hex) { int l = strlen(hex), j; unsigned char msg[MODES_LONG_MSG_BYTES]; struct modesMessage mm; + static struct modesMessage zeroMessage; + MODES_NOTUSED(c); - memset(&mm, 0, sizeof(mm)); + mm = zeroMessage; // Mark messages received over the internet as remote so that we don't try to // pass them off as being received by this instance when forwarding them