File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright (c) 2020-2022, XMOS Ltd, All rights reserved
2
+
3
+ // Suppress some unwanted warnings in the Windows build
4
+ #ifdef _WIN32
5
+ #define _CRT_SECURE_NO_WARNINGS
6
+ #endif
7
+
2
8
#include <assert.h>
3
9
#include <limits.h>
4
10
#include <stdio.h>
@@ -40,7 +46,7 @@ void xscope_print(
40
46
printf ("[DEVICE] " );
41
47
device_print_newline = 0 ;
42
48
}
43
- for (int i = 0 ; i < length ; i ++ ){
49
+ for (unsigned i = 0 ; i < length ; i ++ ){
44
50
char character = * (& data [i ]);
45
51
printf ("%c" , character );
46
52
if (character == '\n' ){
@@ -174,15 +180,15 @@ void xscope_record(
174
180
case XSCOPE_ID_WRITE_BYTES :
175
181
{
176
182
if (VERBOSE ) printf ("[HOST] write idx: %u bytes transfer length: %u\n" , write_file_idx , length );
183
+ if (length > write_size ){
184
+ printf ("[HOST] Error - write will overrun by %d bytes." , length - write_size );
185
+ assert (0 );
186
+ }
177
187
fwrite (databytes , 1 , length , host_files [write_file_idx ].fp );
178
188
write_size -= length ;
179
189
if (write_size == 0 ){
180
190
if (VERBOSE ) printf ("[HOST] Normal end of write transfer\n" );
181
191
}
182
- else if (write_size < 0 ){
183
- printf ("[HOST] Error - write overran by %d bytes." , - write_size );
184
- assert (0 );
185
- }
186
192
else {
187
193
//Still going
188
194
}
You can’t perform that action at this time.
0 commit comments