aboutsummaryrefslogtreecommitdiff
path: root/src/ootx_decoder.c
diff options
context:
space:
mode:
authorJustin Berger <jdavidberger@gmail.com>2018-06-29 19:21:29 +0000
committerJustin Berger <jdavidberger@gmail.com>2018-06-29 19:21:29 +0000
commit50061dff9f31848045f397fda3f39b9bc0398077 (patch)
tree99881e9a6dcc76d4454149e78a6c4cf3b07b9103 /src/ootx_decoder.c
parenta017681e4575f0f0de64d82013da4c8bca30178d (diff)
downloadlibsurvive-50061dff9f31848045f397fda3f39b9bc0398077.tar.gz
libsurvive-50061dff9f31848045f397fda3f39b9bc0398077.tar.bz2
Blacklisted devices now dont claim interface; fixed ootx option
Diffstat (limited to 'src/ootx_decoder.c')
-rw-r--r--src/ootx_decoder.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/ootx_decoder.c b/src/ootx_decoder.c
index e110d11..253dd18 100644
--- a/src/ootx_decoder.c
+++ b/src/ootx_decoder.c
@@ -4,10 +4,11 @@
/* ootx data decoder */
+#include "ootx_decoder.h"
+#include "string.h"
+#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#include <assert.h>
-#include "ootx_decoder.h"
#ifdef NOZLIB
#include "crc32.h"
@@ -124,10 +125,12 @@ void ootx_pump_bit(ootx_decoder_context *ctx, uint8_t dbit) {
if( !dbit )
{
// printf("Bad sync bit\n");
- ootx_error(ctx, "OOTX Decoder: Bad sync bit");
-
- if (ctx->ignore_sync_bit_error == 0)
+ if (ctx->ignore_sync_bit_error == 0) {
+ ootx_error(ctx, "OOTX Decoder: Bad sync bit");
ootx_reset_buffer(ctx);
+ } else {
+ ootx_error(ctx, "OOTX Decoder: Ignoring bad sync bit");
+ }
}
ctx->bits_processed = 0;
}
@@ -157,7 +160,7 @@ void ootx_pump_bit(ootx_decoder_context *ctx, uint8_t dbit) {
op.length = *(ctx->payload_size);
op.data = ctx->buffer+2;
- op.crc32 = *(uint32_t*)(op.data+padded_length);
+ memcpy(&op.crc32, op.data + padded_length, sizeof(uint32_t));
uint32_t crc = crc32( 0L, 0 /*Z_NULL*/, 0 );
crc = crc32( crc, op.data,op.length);