diff options
author | alk3pInjection <webmaster@raspii.tech> | 2021-08-30 16:43:38 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2021-08-30 16:43:38 +0800 |
commit | cbe033a53bfe49d980774e59025e3b2af91778b7 (patch) | |
tree | 558535f91276162e0be70d07b34ed2e6577e38ad /examples/HCStreaming_ringBuffer.c | |
parent | fdd43c66dd9e77283aa8f7e52a881be44d622441 (diff) | |
parent | d44371841a2f1728a3f36839fd4b7e872d0927d3 (diff) |
Merge tag 'v1.9.3' into lineage-18.1HEADlineage-18.1
Change-Id: Iad56c1b17a32f9f356a4c1ff9557f0e79addf481
Diffstat (limited to 'examples/HCStreaming_ringBuffer.c')
-rw-r--r-- | examples/HCStreaming_ringBuffer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/HCStreaming_ringBuffer.c b/examples/HCStreaming_ringBuffer.c index a878577..bc8391e 100644 --- a/examples/HCStreaming_ringBuffer.c +++ b/examples/HCStreaming_ringBuffer.c @@ -26,6 +26,7 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> +#include <assert.h> enum { MESSAGE_MAX_BYTES = 1024, @@ -39,7 +40,8 @@ size_t write_int32(FILE* fp, int32_t i) { } size_t write_bin(FILE* fp, const void* array, int arrayBytes) { - return fwrite(array, 1, arrayBytes, fp); + assert(arrayBytes >= 0); + return fwrite(array, 1, (size_t)arrayBytes, fp); } size_t read_int32(FILE* fp, int32_t* i) { @@ -47,7 +49,8 @@ size_t read_int32(FILE* fp, int32_t* i) { } size_t read_bin(FILE* fp, void* array, int arrayBytes) { - return fread(array, 1, arrayBytes, fp); + assert(arrayBytes >= 0); + return fread(array, 1, (size_t)arrayBytes, fp); } @@ -174,7 +177,7 @@ int main(int argc, const char** argv) return 0; } - if (!strcmp(argv[1], "-p")) pause = 1, fileID = 2; + if (!strcmp(argv[1], "-p")) { pause = 1; fileID = 2; } snprintf(inpFilename, 256, "%s", argv[fileID]); snprintf(lz4Filename, 256, "%s.lz4s-%d", argv[fileID], 9); |