Skip to content

Commit

Permalink
Merge pull request #24 from danielpieczko/fix/compiler_warnings
Browse files Browse the repository at this point in the history
Fix build warnings seen on Windows
  • Loading branch information
shuchitak authored Mar 8, 2022
2 parents 5b68d3b + a4e54b3 commit bc5a3a1
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions host/xscope_io_host.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
// Copyright (c) 2020-2022, XMOS Ltd, All rights reserved

// Suppress some unwanted warnings in the Windows build
#ifdef _WIN32
#define _CRT_SECURE_NO_WARNINGS
#endif

#include <assert.h>
#include <limits.h>
#include <stdio.h>
Expand Down Expand Up @@ -40,7 +46,7 @@ void xscope_print(
printf("[DEVICE] ");
device_print_newline = 0;
}
for (int i = 0; i < length; i++){
for (unsigned i = 0; i < length; i++){
char character = *(&data[i]);
printf("%c", character);
if (character == '\n'){
Expand Down Expand Up @@ -174,15 +180,15 @@ void xscope_record(
case XSCOPE_ID_WRITE_BYTES:
{
if(VERBOSE) printf("[HOST] write idx: %u bytes transfer length: %u\n", write_file_idx, length);
if(length > write_size){
printf("[HOST] Error - write will overrun by %d bytes.", length - write_size);
assert(0);
}
fwrite(databytes, 1, length, host_files[write_file_idx].fp);
write_size -= length;
if(write_size == 0){
if(VERBOSE) printf("[HOST] Normal end of write transfer\n");
}
else if(write_size < 0){
printf("[HOST] Error - write overran by %d bytes.", -write_size);
assert(0);
}
else{
//Still going
}
Expand Down

0 comments on commit bc5a3a1

Please sign in to comment.