examples/ezusb: Replace rewind with fseek, to check for errors

Replace rewind, which gives no error result, with fseek, which does.

Fixes all clang-tidy bugprone-unsafe-functions warnings

References #1479
This commit is contained in:
Sean McBride
2024-04-09 13:25:55 -04:00
committed by Tormod Volden
parent e678b3fad5
commit 00454ab087
3 changed files with 7 additions and 3 deletions

View File

@@ -13,7 +13,6 @@ bugprone-*,\
-bugprone-signed-char-misuse,\
-bugprone-suspicious-string-compare,\
-bugprone-switch-missing-default-case,\
-bugprone-unsafe-functions,\
-bugprone-too-small-loop-variable,\
clang-analyzer-*,\
-clang-analyzer-core.NullDereference,\

View File

@@ -815,7 +815,12 @@ int ezusb_load_ram(libusb_device_handle *device, const char *path, int fx_type,
}
/* at least write the interrupt vectors (at 0x0000) for reset! */
rewind(image);
status = fseek(image, 0L, SEEK_SET);
if (ret < 0) {
logerror("unable to rewind file %s\n", path);
ret = status;
goto exit;
}
if (verbose)
logerror("2nd stage: write on-chip memory\n");
status = parse_ihex(image, &ctx, is_external, ram_poke);

View File

@@ -1 +1 @@
#define LIBUSB_NANO 11913
#define LIBUSB_NANO 11914